Provides XWiki authentication by trusting HTTP Headers and getting information about new users from those same headers.
- Check that the
auth_field
contains a value- Get the UserID from the
id_field
and convert it as described in the configuration. - If this is a new session, or the current user in session is not the actual user:
- If the user does not exists
- Create a new user
- Map all field described in
field_mapping
into user's properties of that user
- If
group_mapping
is defined, synchronize the membership of that user to match groups provided.- Add user to group provided in the
group_field
header (as needed) - Remove it from all mapped group not provided in the
group_field
header (as needed)
- Add user to group provided in the
- If the user does not exists
- The user is authenticated and memorize for the current session.
- Get the UserID from the
- If no remote user (
auth_field
) is provided, fallback to standard XWiki authentication.
#-# Name of the header field used to check for the authentication of a user.
#-# The content of this field should not be empty to have this authenticator to proceed, and it will be put
#-# in the debugging log. But not real usage of this header value is done by the authenticator.
#-# The default is to use the REMOTE_USER header.
# xwiki.authentication.headers.auth_field=remote_user
#-# Name of the header field holding the UserID of the authenticated user.
#-# This name will be used as the unique user name. It will be transformed in lowercase, and it will be
#-# cleaned by replacing dots (.) by equal signs (=), and replacing at signs (@) by underscores (_).
#-# For example John.Doe@example.com will became john=doe_example=com.
#-# The default is to use the REMOTE_USER header.
# xwiki.authentication.headers.id_field=remote_user
#-# Name of a header field containing a shared secret value.
#-# While not mandatory, this field is hardly recommended to properly authenticate that headers has not be forged.
#-# If not set, a warning will remind you in the log, since this is really a risky situation.
# xwiki.authentication.headers.secret_field=
#-# The shared secred that should match the content of the shared secret header field.
# xwiki.authentication.headers.secret_value= (no default, only used when set)
#-# Name of a header field holding the list of group the user is a member of.
#-# If not configure, no group synchronization is provided.
# xwiki.authentication.headers.group_field=
#-# A separator used to split the list of groups into group names.
#-# Default to the pipe character.
# xwiki.authentication.headers.group_value_separator=|
#-# Mapping between group names found in the list of groups and XWiki groups.
# xwiki.authentication.headers.groups_mapping=groupA=XWiki.XWikiGroupA,groupB=XWiki.XWikiGroupB
#-# Mapping between header fields and XWiki users fields.
# xwiki.authentication.headers.fields_mapping=email=mail,first_name=givenname,last_name=sn
- build with
mvn install
- copy this authenticator jar file from
target
intoWEB_INF/lib/
- setup
xwiki.cfg
with:xwiki.authentication.authclass=com.xwiki.authentication.headers.XWikiHeadersAuthenticator
<!-- Header authenticator debugging -->
<logger name="com.xwiki.authentication.headers.XWikiHeadersAuthenticator" level="debug"/>
See http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Logging for general information about logging in XWiki.