Wiki Konfiguration
Aus StudyWiki
Inhaltsverzeichnis |
[bearbeiten] User Authentification via .HTACCESS
[bearbeiten] Background
MediaWiki by default allows anyone via IP or login to see and modify the contents of the Wiki. By default, the login accounts are created and used only within MediaWiki. If a site administrator wishes to integrate a MediaWiki site with an existing user authentication framework, an extension is needed. Most web servers, including Apache, provide several user authentication mechanisms, including basic www-authenticate and public/private key SSL authentication. Once the web server authenticates a user, it sets available a CGI/Server environment variable named REMOTE_USER.
[bearbeiten] Design
When the user first hits the wiki, the web server authenticates the user and sets the REMOTE_USER variable. The MediaWiki code is then invoked. At the end of Setup.php, before any real processing begins, the extension's hook is called. This code depends primarily on the fact that user is always authenticated by the web server prior to any MediaWiki code being executed.
If the user already has an existing, valid MediaWiki session and account, the hook takes no further action. MediaWiki already has what it needs.
If the user has an existing valid MediaWiki account, but not a session, the hook simply ensures that MediaWiki uses the username in REMOTE_USER in creating a session, cookies, etc, and takes no further action.
If the user has not created an account, the hook uses MediaWiki's initUser() function to create an account, and sets various default user-options. See the hook's initUser function to change these default options. The hook then issues a Location directive to the browser, using the same URL that was called. When the browser reloads, the user account has been created, a session is now created, and MediaWiki behaves as normal.
If the user has cookies turned off, they will probably find themselves in an endless redirection loop.
[bearbeiten] Installation
[bearbeiten] LocalSettings.php
Insert the following lines before the closing ?>:
require_once('extensions/Auth_remoteuser.php');
$wgAuth = new Auth_remoteuser();
[bearbeiten] extensions/Auth_remoteuser.php
Download and install the code [1] as extensions/Auth_remoteuser.php
Code kann auch auf der meta.wikimedia.org seite gefunden werden: [2]
[bearbeiten] Web Server configuration
For basic authentication, one can set up a .htaccess as follows:
AuthType Basic AuthName Wiki AuthUserFile /var/www/admin/.htpasswd require valid-user
[bearbeiten] Short way to Install
The first thing you'll need to do is edit your LocalSettings.php file.
Insert the following lines before the closing ?>:
require_once('extensions/Auth_remoteuser.php');
$wgAuth = new Auth_remoteuser();
Next, download the Auth_remoteuser.php extension using wget to directory extensions/
wget http://www.washington.edu/computing/web/publishing/Auth_remoteuser.php
For basic authentication, set up a .htaccess as follows in the wiki root directory:
AuthType Basic AuthName Zeus Wiki AuthUserFile /var/www/admin/.htaccess require valid-user
[bearbeiten] Interessante Link's
http://www.washington.edu/computing/web/publishing/mediawiki.html
oder als andere Variante: http://meta.wikimedia.org/wiki/PwAuthPlugin
