User Authentication

XWiki supports different authentication mechanisms for authenticating users:

Invalid macro parameters used for the [toc] macro. Cause: [Failed to validate bean: [must be greater than or equal to 1]]. Click on this message for details.

The form authentication is the default mechanism.

Note that currently XWiki allows only one method of authentication to be enabled at a time which means you cannot implement policies such as if the user is not found in LDAP then check if he's in the XWiki database. This will probably be improved in the future.

Form Authentication

TODO

LDAP Authentication

Generic LDAP configuration

In order to enable the LDAP support you have to change the authentication method in WEB-INF/xwiki.cfg as follows:

xwiki.authentication.ldap=1

You can setup the LDAP configuration either on the XWiki.XWikiPreferences page or in the xwiki.cfg file

  • XWiki.XWikiPreferences: you will need to use the class editor to add the following fields:
    • ldap_server
    • ldap_port
    • ldap_check_level
    • ldap_base_DN
    • ldap_bind_DN
    • ldap_bind_pass
    • ldap_UID_attr
    • ldap_fields_mapping
  • xwiki.cfg: use the following properties in the xwiki.cfg file
    • xwiki.authentication.ldap.server
    • xwiki.authentication.ldap.port
    • xwiki.authentication.ldap.check_level
    • xwiki.authentication.ldap.base_DN
    • xwiki.authentication.ldap.bind_DN
    • xwiki.authentication.ldap.bind_pass
    • xwiki.authentication.ldap.UID_attr
    • xwiki.authentication.ldap.fields_mapping

Example:

xwiki.authentication.ldap=1
xwiki.authentication.ldap.authclass=com.xpn.xwiki.user.impl.LDAP.LDAPAuthServiceImpl
xwiki.authentication.ldap.server=dsmaster
xwiki.authentication.ldap.check_level=1
xwiki.authentication.ldap.port=389
xwiki.authentication.ldap.base_DN=department=USER,department=INFORMATIK,department=1230,o=MP
xwiki.authentication.ldap.bind_DN=cn={0},department=USER,department=INFORMATIK,department=1230,o=MP
xwiki.authentication.ldap.bind_pass={1}
xwiki.authentication.ldap.UID_attr=uid

 

LDAP Configuration for Active Directory

Here are values of the properties you need to set if your LDAP server implementation is Miscrosoft Active Directory:

  • ldap_server: name/IP of AD server machine
  • ldap_port: port (e.g. 389)
  • ldap_check_level: 1
  • ldap_base_DN: name of root DN (e.g. dc=ad,dc=company,dc=com)
  • ldap_bind_DN: domain{0} (e.g. ad{0} where {0} will be replaced by username during validation)
  • ldap_bind_pass: {1} (where {1} will be replaced by password during validation)
  • ldap_UID_attr: sAMAccountName
  • ldap_fields_mapping: name=sAMAccountName,last_name=sn,first_name=givenName,fullname=displayName,mail=mail,ldap_dn=dn

eXo Authentication

The eXo authentication is used automatically by adding/editing the xwiki.exo=1 property in WEB-INF/xwiki.cfg.

Custom Authentication

This allows plugging to any existing authentication mechanism such as SiteMinder, etc. To configure a custom authentication do the following:

  1. Implement the XWikiAuthService interface.
  2. Edit the WEB-INF/xwiki.cfg file and add a xwiki.authentication.authclass property pointing to your class. For example:
xwiki.authentication.authclass = com.acme.MyCustomAuthenticationService

Authentication parameters

You can set each of these parameters by setting:

xwiki.authentication.~~param_name~~=~~param_value~~
NameOptionalAllowed valuesDefault valueDescription
cookiedomainsYesStringServer host nameWhich host(s) should your cookies be sent to; use only if you want to share cookies across domains, otherwise should be commented out
cookielifeYesNumber14Number of days cookies take to expire
cookiepathYesString/The webapp path that XWiki cookies should be sent to; if you have anything else running on your web server, this should be set to /xwiki
protectionYesall, validation, encryption, noneallProtection level for the "remember me" functionality
realnameYesStringXWikiSets the realm name (should be realmname???)
unauthorized_codeYes???
default_pageYesString/bin/view/Main/WebHomePage to redirect to if
xredirect parameter is not set
loginpageYesString/bin/login/XWiki/XWikiLoginPage to redirect to when not logged in
logoutpageYesString/bin/logout/XWiki/XWikiLogoutPage to redirect to after logged out
errorpageYesString/bin/loginerror/XWiki/XWikiLoginPage to redirect to if there is an error logging in
useipYestrue / falsetrueSpecify to use the IP address when encrypting the cookie data; if IP address changes will need to re-login.
encryptionalgorithmYes??Set the Encryption Algorithm used to encrypt and decrypt cookies
encryptionmodeYes??Set the Encryption Mode used to encrypt and decrypt cookies
encryptionpaddingYes??Set the Encryption Padding used to encrypt and decrypt cookies
validationKeyNo*?n/aSet the Validation Key used to generate hash value; the hash value is stored with the cookie and used to verify that the cookie has not been tampered with.
encryptionKeyNo**?n/aSet the Encryption Key used to create a secret key, the secret key is passed to the Cipher object to be used during encryption and decryption of cookie values.
loginsubmitpageYesString/loginsubmit/XWiki/XWikiLogin 
  • Only required if protection = encryption or all (the default)
    • Only required if protection = validation or all (the default)
Tags:
   

Get Connected