Extension:Shibboleth

From MediaWiki.org
Jump to navigation Jump to search
PluggableAuth Icon.svg This extension requires the PluggableAuth extension to be installed first.
MediaWiki extensions manual
OOjs UI icon advanced.svg
Shibboleth
Release status: stable
Implementation User identity
Description Extends the PluggableAuth extension to provide authentication using Shibboleth.
Author(s) Attila Laszlo (n0rthwaytalk)
Latest version v1.0.0-rc.1 (2018-03-05)
Compatibility policy master
MediaWiki 1.29+
PHP 7.0+
License MIT License
Download GitHub
  • $wgShibboleth_Username
  • $wgShibboleth_Email
  • $wgShibboleth_DisplayName
  • $wgShibboleth_Logout_Base_Url
  • $wgShibboleth_Logout_Target_Url
  • $wgShibboleth_GroupMap
Translate the Shibboleth extension if it is available at translatewiki.net
Check usage and version matrix.

The Shibboleth extension extends the PluggableAuth extension to provide authentication using Shibboleth Apache module.

Installation[edit]

This extension requires the PluggableAuth extension and Shibboleth Apache module to be installed first.
  • Download and place the file(s) in a directory called Shibboleth in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:

wfLoadExtension( 'Shibboleth' );

  • Configure as required
  • Done! Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configure[edit]

Values must be provided for the following mandatory configuration variables:

Flag Default Description
$wgShibboleth_Username no default value The name of the attribute to be used for the user's username.
$wgShibboleth_Email no default value The name of the attribute to be used for the user's email address.
$wgShibboleth_DisplayName no default value The name of the attribute(s) to be used for the user's real name.
$wgShibboleth_Logout_Base_Url no default value Single Logout (SLO) base URL
$wgShibboleth_Logout_Target_Url no default value Single Logout (SLO) target URL

In addition, the following optional configuration variable is provided:

Flag Default Description
$wgShibboleth_GroupMap null Mapping from SAML attributes to MediaWiki groups of the form:
$wgShibboleth_GroupMap = array('attr_name' => 'groups','sysop' => 'wiki_admin','bureaucrat' => 'wiki_editor', '...');
No group mapping is performed if $wgShibboleth_GroupMap is null.

Use case: your SAML IdP reads groups from LDAP or Database and stores this information inside an attribute of the SAML response. You want to use this to map MediaWiki groups to users belonging to some known groups given by your IdP.

Example:

  • Your IdP sends an attribute named "groups" with a list of names like "administrator", "student", "teacher", ... in the SAML response after authentication.
  • All users that have the value "administrator" in the "groups" attribute shall be mapped to the MediaWiki "sysop" group to give them admin rights within your MediaWiki instance.
  • Create a group map in your LocalSettings.php as follows: $wgShibboleth_GroupMap = array('attr_name' => 'groups','sysop' => 'administrator',);

You can come up with rather complex mappings that fit your needs. If you have more than one attribute from SAML, just add it to the array with the array of values you like to map.

Hint: If a user belongs to a MediaWiki group that is no longer mapped to that user (for example, by losing the group membership in the SAML user data source), the user will be removed from that MediaWiki group at next log in. In that way you can mass remove groups from SAML and their memberships, too - just scramble the mapping values so they don't match the SAML response, but don't mess up the MediaWiki group name.

Single Logout (SLO)[edit]

Shibboleth Single Logout (SLO) URL structure:

$wgShibboleth_Logout_Base_Url . Shibboleth.sso/Logout?return= . $wgShibboleth_Logout_Target_Url

https://wiki.example.org/Shibboleth.sso/Logout?return=https://wiki.example.org/index.php

Known Bugs[edit]

The very first time when the user authenticates with Shibboleth, $wgShibboleth_GroupMap does not take effect due T184736 bug. It requires a relogin (logout then login) to be able to map the given configuration. (Fixed in latest version of PluggableAuth)

See also[edit]