Skip to content
Github mirror of MediaWiki extension SimpleSAMLphp - our actual code is hosted with Gerrit (please see for contributing
PHP JavaScript
Branch: master
Clone or download
translatewiki Localisation updates from
Change-Id: Iaeb5d4e28613f8f14661a1526b447aa3780d6c8c
Latest commit 1986041 Dec 6, 2019


Define custom user info provider

If you want to modify any of the fields username, realname or email before login, you can configure a custom callback for $wgSimpleSAMLphp_MandatoryUserInfoProviderFactories. The factory method has the following signature:

factoryCallback( \Config $config ) : MediaWiki\Extension\SimpleSAMLphp\IUserInfoProvider

For simple usecases one can use MediaWiki\Extension\SimpleSAMLphp\UserInfoProvider\GenericCallback:

$wgSimpleSAMLphp_MandatoryUserInfoProviderFactories['username'] = function( $config ) {
    return new MediaWiki\Extension\SimpleSAMLphp\UserInfoProvider\GenericCallback( function( $attributes ) {
        if ( !isset( $attributes['mail'] ) ) {
            throw new Exception( 'missing email address' );
        $parts = explode( '@', $attributes['mail'][0] );
        return strtolower( $parts[0] );
    } );
You can’t perform that action at this time.