Extension:Shibboleth Authentication Plus

Overview
This extension enriches the functionality of Shibboleth Authentication Extension by supporting group-based user authentication / authorization and by implementing a messaging mechanism for user notification during the authentication/authorization process. It is already in use in the Grnet Wikis MediaWiki Farm.

Current Version: 1.0

Compatibility
This extension is designed for MediaWiki 1.7 and latest versions. If you want to use this extension with the 1.6 version or previous ones, refer to bugs 5819 and 6006 and apply the SVN changes that occurred.

Shibboleth Environment Configuration
The extension requires that shibboleth environment has been configured and set up on the web server the wiki is hosted on. Once Shibboleth is running on the web server, make sure your configuration file is correctly set-up. Further assistance with the environment configuration can be provided by the administrator of the Shibboleth Service Provider (SP) that hosts your application. The extension uses lazy sessions in order to allow the standard wiki authentication to co-exist alongside with the Shibboleth authentication. Therefore, the relevant environment configuration should be made as described below. Full sessions are also acceptable for use.

You will require to indicate the extension which WAYF url to use. Following is the part of the SP configuration file (shibboleth.xml), where the WAYF url should be completed:

...   

Following is the part of the Apache's Vhosts configuration file (vhosts.conf) that enables lazy sessions: ...  AuthType shibboleth Require shibboleth 

If you don't want lazy sessions but instead would rather require shibboleth authentication, then use: ...  AuthType shibboleth ShibRequireSession On       Require valid-user 

Download the Extension
The code of this extension is composed of three parts. The extended code of the Shibboleth Authentication Extension, the code that implements the group-based user authentication/authorization and the code that implements the messaging mechanism. There is a detailed description of the Shibboleth Authentication Plus Extension code at the following sections.

Shibboleth Authentication Extension Code
Download the code of the Shibboleth Authentication Extension and place it in the extensions folder, in a file called ShibAuthPlugin.php. Go to the function AutoAuth, define the global variable $shib_GRP and replace the defined "if expression" with the following one:

The only changes that have been made in the code of Shibboleth Authentication Extension are the definition of the $shib_GRP variable that contains the list of user groups, the mapping of that list to the local groups and the assignment of the user to the local groups.

Shibboleth Authentication Plus Extension Code
In this section you can see the code of the Shibboleth Authentication Plus Extension. The extension implements a mechanism for group-based user authentication and authorization. Authentication is based on eduPersonPrincipalName which provides a unique identifier of the user across the federation. The value of eduPersonPrincipalName is assigned to the variable $shib_UN (Shibboleth Authentication Extension variable). The authorization scheme is based on eduPersonOrgUnitDN and its constituent components. The value of eduPersonOrgUnitDN variable has the following format: ou=group1, ou=group2, o=domain, c=suffix (e.g ou=editor, o=university, c=com). The extension collects the groups of "your_domain" and maps them to the current list of the local groups (the locally defined groups should be a subset of all possible values the "ou"s in users' DN could get).Upon the completion of the mapping process of "ou" values to local groups, the group membership of the user is stored in the array variable $shib_GRP (Shibboleth Authentication Plus Extension variable). The user takes the authorization privileges of these groups. Place the code in the extensions folder, in a file called ShibAuthPlusPlugin.php and replace the "o=your_domain,c=your_suffix" expression with your own domain.

In addition, the Shibboleth Authentication Plus Extension implements a messaging mechanism in order to inform the users during the process of his Authentication and Authorization. You can see the generated messages by simply adding the   variable in your desirable wiki page. Place the code in the extensions folder, in a file called ShibAuthPlusMessaging.php.

Shibboleth Authentication Plus Extension Configuration
Now it's time to configure and load the extension. To do that, just add the following lines to LocalSettings.php in the root of the mediawiki directory (most of the configuration instructions have been taken from the Shibboleth Authentication Extension page).

One important point in the configuration process is the definition of the local groups list. That list has to map the list of the expected shibboleth groups. This is required for the correct operation of the Authorization process. If the extension does not map any of the shibboleth groups to any of the local groups, the user takes the privileges of an anonymous user.