mirror of
https://github.com/filegator/filegator.git
synced 2025-08-19 04:01:52 +02:00
deploy: 6e9194ad9d
This commit is contained in:
249
configuration/auth.html
Normal file
249
configuration/auth.html
Normal file
@@ -0,0 +1,249 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>FileGator - Documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="https://docs.filegator.io/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://docs.filegator.io/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://docs.filegator.io/css/highlight.tomorrow-night.css">
|
||||
<link rel="stylesheet" href="https://docs.filegator.io/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="navbar navbar-default navbar-fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="https://docs.filegator.io/">
|
||||
FileGator
|
||||
<small class="hidden-xs hidden-sm">
|
||||
Documentation
|
||||
</small>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="https://github.com/filegator/filegator">
|
||||
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
|
||||
|
||||
</a>
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
|
||||
<nav id="sidebar" class="col-sm-3 col-lg-2" role="navigation">
|
||||
|
||||
<p class="text-muted">
|
||||
Getting Started
|
||||
</p>
|
||||
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/index.html">
|
||||
What is FileGator
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/install.html">
|
||||
Installation
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/accounts.html">
|
||||
Users
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/development.html">
|
||||
Development
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">
|
||||
Configuration
|
||||
</p>
|
||||
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/basic.html">
|
||||
Basic
|
||||
</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="https://docs.filegator.io/configuration/auth.html">
|
||||
Auth
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/session.html">
|
||||
Session
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/storage.html">
|
||||
Storage
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/logging.html">
|
||||
Logging
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/security.html">
|
||||
Security
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/router.html">
|
||||
Router
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/configuration/tmpfs.html">
|
||||
Tmpfs
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">
|
||||
Languages
|
||||
</p>
|
||||
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="">
|
||||
<a href="https://docs.filegator.io/translations/default.html">
|
||||
Translations
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
|
||||
<h2 id="default-auth-service">Default Auth service</h2>
|
||||
<p>By default, users are stored in json file. For some use-cases, this is enough. It also makes this app lightweight since no database is required.</p>
|
||||
<p>Default handler accepts only file name parameter. This file should be writable by the web server.</p>
|
||||
<pre><code> 'Filegator\Services\Auth\AuthInterface' => [
|
||||
'handler' => '\Filegator\Services\Auth\Adapters\JsonFile',
|
||||
'config' => [
|
||||
'file' => __DIR__.'/private/users.json',
|
||||
],
|
||||
],
|
||||
</code></pre>
|
||||
<h2 id="configuring-auth-service-to-use-database">Configuring Auth service to use database</h2>
|
||||
<p>You can use mysql database to store your users.</p>
|
||||
<p>First, create a table <code>users</code> with this sql query:</p>
|
||||
<pre><code>CREATE TABLE `users` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`role` varchar(20) NOT NULL,
|
||||
`permissions` varchar(200) NOT NULL,
|
||||
`homedir` varchar(2000) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `username` (`username`)
|
||||
) CHARSET=utf8 COLLATE=utf8_bin;</code></pre>
|
||||
<p>Then, import default users with sql query:</p>
|
||||
<pre><code>INSERT INTO `users` (`username`, `name`, `role`, `permissions`, `homedir`, `password`)
|
||||
VALUES
|
||||
('guest', 'Guest', 'guest', '', '/', ''),
|
||||
('admin', 'Admin', 'admin', 'read|write|upload|download|batchdownload|zip', '/', '$2y$10$Nu35w4pteLfc7BDCIkDPkecjw8wsH8Y2GMfIewUbXLT7zzW6WOxwq');</code></pre>
|
||||
<p>At the end, open <code>configuration.php</code> and update AuthInterface handler to reflect your database settings:</p>
|
||||
<pre><code> 'Filegator\Services\Auth\AuthInterface' => [
|
||||
'handler' => '\Filegator\Services\Auth\Adapters\Database',
|
||||
'config' => [
|
||||
'driver' => 'mysqli',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => 'password',
|
||||
'database' => 'filegator',
|
||||
],
|
||||
],</code></pre>
|
||||
<h2 id="configuring-auth-service-to-use-wordpress">Configuring Auth service to use WordPress</h2>
|
||||
<p>Replace your current Auth handler in <code>configuration.php</code> file like this:</p>
|
||||
<pre><code> 'Filegator\Services\Auth\AuthInterface' => [
|
||||
'handler' => '\Filegator\Services\Auth\Adapters\WPAuth',
|
||||
'config' => [
|
||||
'wp_dir' => '/var/www/my_wordpress_site/',
|
||||
'permissions' => ['read', 'write', 'upload', 'download', 'batchdownload', 'zip'],
|
||||
'private_repos' => false,
|
||||
],
|
||||
],</code></pre>
|
||||
<p>Adjust in the config above:</p>
|
||||
<ul>
|
||||
<li><code>wp_dir</code> should be the directory path of your wordpress installation</li>
|
||||
<li><code>permissions</code> is the array of permissions given to each user</li>
|
||||
<li><code>private_repos</code> each user will have its own sub folder, admin will see everything (false/true)</li>
|
||||
</ul>
|
||||
<p>Note: With more recent versions of FileGator you can set <code>guest_redirection</code> in your <code>configuration.php</code> to redirect logged-out users back to your WP site:</p>
|
||||
<pre><code>'frontend_config' => [
|
||||
...
|
||||
'guest_redirection' => 'http://example.com/wp-admin/',
|
||||
...
|
||||
]</code></pre>
|
||||
<h2 id="configuring-auth-service-to-use-ldap">Configuring Auth service to use LDAP</h2>
|
||||
<p>Replace your current Auth handler in <code>configuration.php</code> file like this:</p>
|
||||
<pre><code> 'Filegator\Services\Auth\AuthInterface' => [
|
||||
'handler' => '\Filegator\Services\Auth\Adapters\LDAP',
|
||||
'config' => [
|
||||
'private_repos' => false,
|
||||
'ldap_server'=>'ldap://192.168.1.1',
|
||||
'ldap_bindDN'=>'uid=ldapbinduser,cn=users,dc=ldap,dc=example,dc=com',
|
||||
'ldap_bindPass'=>'ldapbinduser-password',
|
||||
'ldap_baseDN'=>'cn=users,dc=ldap,dc=example,dc=com',
|
||||
'ldap_filter'=>'(uid=*)', //ex: 'ldap_filter'=>'(&(uid=*)(memberOf=cn=administrators,cn=groups,dc=ldap,dc=example,dc=com))',
|
||||
'ldap_attributes' => ["uid","cn","dn"],
|
||||
'ldap_userFieldMapping'=> [
|
||||
'username' =>'uid',
|
||||
'username_AddDomain' =>'@example.com',
|
||||
'username_RemoveDomains' =>['@department1.example.com', '@department2.example.com'],
|
||||
'name' =>'cn',
|
||||
'userDN' =>'dn',
|
||||
'default_permissions' => 'read|write|upload|download|batchdownload|zip',
|
||||
'admin_usernames' =>['user1', 'user2'],
|
||||
],
|
||||
],
|
||||
],</code></pre>
|
||||
<h2 id="custom-authentication-using-3rd-party">Custom Authentication using 3rd party</h2>
|
||||
<p>If you want to use FileGator as a part of another application, you probably already have users stored somewhere else. What you need in this case is to build a new custom Auth adapter that matches the <a href="https://github.com/filegator/filegator/blob/master/backend/Services/Auth/AuthInterface.php">AuthInterface</a> to connect those two. This new adapter will try to authenticate users in your application and translate each user into filegator <a href="https://github.com/filegator/filegator/blob/master/backend/Services/Auth/User.php">User</a> object.</p>
|
||||
<h2 id="api-authentication">API authentication</h2>
|
||||
<p>Front-end will use session based authentication to authenticate and consume the back-end.</p>
|
||||
<p>Note: The application will not work if you disable cookies.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
|
||||
<script src="//yandex.st/highlightjs/7.5/highlight.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("section>h1").wrap('<div class="page-header" />');
|
||||
// Syntax highlighting
|
||||
hljs.initHighlightingOnLoad();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Ticksel analytics v1.0 -->
|
||||
<script type="text/javascript">
|
||||
var _tcfg = _tcfg || [];
|
||||
(function() {
|
||||
_tcfg.push(["tags", "filegator-io,filegator-io-docs"]);
|
||||
var u="https://a.interactive32.com/js/safetick.js"; _tcfg.push(["account_id", 8348834]);
|
||||
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
|
||||
g.type="text/javascript"; g.async=true; g.src=u; g.setAttribute("crossorigin", "anonymous");
|
||||
s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
<noscript><img src="https://a.interactive32.com/beam?account_id=8348834&referrer=&tags=filegator-io,filegator-io-docs" style="border:0;" width="0" height="0" alt="" /></noscript>
|
||||
<!-- End Ticksel Code -->
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user