HelpOnAuthentication
Contents
How Authentication works with MoinMoin
MoinMoin supports configurable, modular authenticators to support all sorts of builtin and 3rd party authentication methods.
You use the auth configuration value to set up a list of authenticators that are processed in exactly that order.
When an external user database is used, you do not want to recreate all users in moin manually. For this case the authenticator objects which support user profile creation/updating have a parameter autocreate. If you set it to True a new user profile will be created/updated automatically when a (new) user has passed authentication.
Presently the following authenticators are supported:
Server setup |
Authentication |
Authenticator class in moin |
All |
by moin via username/password |
MoinMoin.auth.MoinAuth |
by PHP session |
MoinMoin.auth.php_session.PHPSessionAuth |
|
by moin via external cookie |
see contrib/auth_externalcookie/ and HelpOnAuthentication/ExternalCookie |
|
by OpenID |
MoinMoin.auth.openidrp.OpenIDAuth |
|
OpenID verification by http://botbouncer.com/ |
MoinMoin.auth.botbouncer.BotBouncer |
|
by moin via LDAP |
MoinMoin.auth.ldap_login.LDAPAuth |
|
by moin via a remote moin wiki |
MoinMoin.auth.interwiki - still experimental |
|
by moin configuration, fixed username |
MoinMoin.auth.GivenAuth |
|
any Web Server setting REMOTE_USER |
e.g. for HTTP Basic, HTTP Digest, SSPI (aka NTLM) or LDAP auth |
MoinMoin.auth.GivenAuth |
Apache+SSL |
by Apache via SSL client certificate |
MoinMoin.auth.sslclientcert.SSLClientCertAuth |
Other pseudo-authenticators - These are not strictly authenticators, as they don't authenticate users, but use auth information for other purposes:
MoinMoin.auth.log.AuthLog
will just log login/logout/request, nothing else
MoinMoin.auth.smb_mount.SMBMount
mount some smb share using user/password from login, umount on logout
Shipped plugins
MoinAuth (default)
This is the default auth list moin uses (so if you just want that, you don't need to configure it).
Given authentication
given by REMOTE_USER environment variable
Webservers (like e.g. Apache) often support all sorts of authentication plugins (e.g. HTTP basic auth). If the webserver is configured for authentication, it handles authentication before moin gets called. When visiting a resource requiring authentication, you get queried for username/password by a dialog box of your browser. When you submit, 2 things can happen:
username/password is incorrect, usually it will just ask again (if you cancel, it will deny access with a 401 not authorized error)
- username/password is correct, the webserver passes the authorized username to Moin (via REMOTE_USER).
Moin's GivenAuth authenticator will, by default, just try to log in the user with the username it recieved from REMOTE_USER.
To activate usage of REMOTE_USER for authentication you have to add following lines to wikiconfig.py:
given by other environment variable
Instead of reading the username from REMOTE_USER, moin can also read it from some other environment variable:
decoding of the user name
REMOTE_USER (or whatever you specify as env_var) is a encoded string and needs to be decoded to unicode. If you don't specify the coding, moin will try 'utf-8' and 'latin-1' (in that order). For non-ASCII characters, this might lead to incorrect results if another coding was used by the web server.
If it fails, you can specify the coding manually:
1 auth = [GivenAuth(env_var='WHATEVER', autocreate=True, coding='cp850')]
transformation of the user name
Sometimes the user name we receive in REMOTE_USER needs some transformation, so it can sanely be used in the wiki.
GivenAuth has some flags to support some standard transformations, enable whatever you like (give True - the default is all False, meaning disabled transformation):
Flag |
Input |
Output |
strip_maildomain |
joe@example.org |
joe |
strip_windomain |
DOMAIN\joe |
joe |
titlecase |
joe doe |
Joe Doe |
remove_blanks |
Joe Doe |
JoeDoe |
The transformations (if enabled) will happen in the order shown.
For example, for some windows domain environments, this might make sense:
1 auth = [GivenAuth(autocreate=True, strip_windomain=True, titlecase=True, remove_blanks=True)]
fixed user given by configuration
You can also hardcode a username into your configuration:
Everyone and everything accessing the wiki will now be logged in as user Joe Doe automatically.
SSL client certification authentication
To activate authentication via SSL client certificates you have to add following lines to wikiconfig.py:
SSL client certification authentication must be used with a web server like Apache that handles the SSL bits and just presents a few environment variables to Moin.
The SSLClientCertAuth authenticator has a few parameters that you pass to the constructor (example below):
Parameter |
Default |
Meaning |
authorities |
None |
a list of authorities that are accepted, or None to accept all |
email_key |
True |
indicates whether the email in the certificate should be used to find the Moin user |
name_key |
True |
indiciates whether the name in the certificate should be used to find the Moin user |
use_email |
False |
if set to True, the account email cannot be changed and is forced to the one given in the certificate |
use_name |
False |
if set to True, the account name cannot be changed and is forced to the one given in the certificate |
autocreate |
False |
if set to True, automatically create moin user profiles |
For example, to accept only certificates that Apache has verified and that are signed by a certain authority, use:
or similar.
PHP session
To activate Single-Sign-On integration with PHP applications, use this module. It reads PHP session files and therefore directly integrates with existing PHP authentication systems.
To use this module, use the following lines of code in your configuration:
PHPSessionAuth has the following parameters:
1 PHPSessionAuth(apps=['egw'], s_path="/tmp", s_prefix="sess_")
apps is a list of enabled applications
s_path is the path of the PHP session files
s_prefix is the prefix of the PHP session files
The only supported PHP application is eGroupware 1.2 currently. But it should be fairly easy to add a few lines of code that extract the necessary information from the PHP session, if you do that, please open a feature request with a patch.
OpenID (with BotBouncer)
The OpenID authentication plugin allows users to sign in using their OpenID and connect that OpenID to a new or existing Moin account. To allow users to sign in with OpenID, add the plugin to the auth list, or to require OpenID with http://botbouncer.com/ verification use:
1 from MoinMoin.auth.openidrp import OpenIDAuth