Extension talk:SAMLAuth

In the statement below... You must install, and configure SimpleSAMLphp as a SAML 2.0 Service Provider on the same domain as the Media Wiki instance.

What exactly do you mean by "same domain"?

Supposing that my domain is www.example.com ...


 * 1) Could my SP be sp.example.com ?
 * 2) If not, what it could be?
 * 3) If I had to have something like www.example.com/sp could I employ mod_rewrite and tell Apache to redirect to sp.example.com ?

Thanks a lot :)

Richard Gomes 03:13, 3 January 2011 (UTC)


 * Should work. Check http://en.wikipedia.org/wiki/Security_Assertion_Markup_Language 134.91.30.112 11:44, 18 June 2012 (UTC)

Support for user groups
I am just thinking whether it would be a big effort to add support for user groups. I will use this page to brainstorm a bit. Maybe I have time to implement it at some point...

The idea would be to read the groups from a configurable SAML attribute when the user logs in. We would then compare the list of values with the actual groups that the user has (which we get with getGroups from the user class), add the missing (with addGroup) and remove the superflous ones (with removeGroup).

Support for MediaWiki 1.18+
In MediaWiki 1.18, the internal user handling has changed, so SAMLAuth 0.3 doesn't work with MediaWiki 1.18 and above. The same issue concerns other authentification modules (for example HttpAuth and Shibboleth Authentication). The following patch is a workaround for the problem:

diff -pur old/SpecialSAMLAuth/SpecialSAMLAuth_body.php new/SpecialSAMLAuth/SpecialSAMLAuth_body.php --- old/SpecialSAMLAuth/SpecialSAMLAuth_body.php	2013-06-09 15:55:50.000000000 +0200 +++ new/SpecialSAMLAuth/SpecialSAMLAuth_body.php	2013-06-09 15:54:39.000000000 +0200 @@ -114,7 +114,7 @@ class SAMLAuth extends SpecialPage { $token = LoginForm::getLoginToken; $params = new FauxRequest(array( 'wpName' => $simplesaml_UN, -                   'wpPassword' => '', +                   'wpPassword' => 'a', 'wpDomain' => '', 'wpRemember' => '', 'wpLoginToken' => $token, @@ -148,7 +148,7 @@ class SAMLAuth extends SpecialPage { $user->setRealName($simplesaml_RN); }                 $wgUser->saveSettings; -               $wgUser->setupSession; +               wfSetupSession; $wgSamlAuthDebug && error_log('Debug simpleSAMLphp + MediaWiki: USER-IDENTIFIED [' . $simplesaml_UN . ']'); $wgUser->setCookies; } @@ -176,9 +176,18 @@ class SAMLAuth extends SpecialPage { $loginForm = new LoginForm($params); $result = $loginForm->authenticateUserData; +               /* For security, scramble the password to ensure the user can +                * only login through simpleSAMLphp. This set the password to a 15 byte +                * random string. +                */ +                $pass = null; +               for($i = 0; $i < 15; ++$i) +                       $pass .= chr(mt_rand(0,255)); +               $loginForm->mPassword = $pass; +                 //Now we _do_ the black magic $loginForm->mRemember = false; -               $loginForm->initUser(&$user, TRUE); +               $loginForm->initUser($user, TRUE); // set the user values $user->setOption('SAMLAuth_IdentityProvider', $idp); @@ -188,14 +197,6 @@ class SAMLAuth extends SpecialPage { if($simplesaml_RN != null) { $user->setRealName($simplesaml_RN); } -               /* For security, scramble the password to ensure the user can -                * only login through simpleSAMLphp. This set the password to a 15 byte -                * random string. -                */ -                $pass = null; -               for($i = 0; $i < 15; ++$i) -                       $pass .= chr(mt_rand(0,255)); -               $user->setPassword($pass); // email confirmation loop global $wgEmailAuthentication; @@ -206,7 +207,7 @@ class SAMLAuth extends SpecialPage { //Finish it off $user->setToken; $user->saveSettings; -               $user->setupSession; +               wfSetupSession; $user->setCookies; $wgUser = $user; $user->addNewUserLogEntry;

Save it as  and execute the following command in  :

patch -p1 < SpecialSAMLAuth.patch

Strict Standards: Declaration should be compatible with that of AuthPlugin
Attempting to install on MW 1.21.1.

Receiving the following error:

Strict Standards: Declaration of SAMLAuthLogin::addUser should be compatible with that of AuthPlugin::addUser in C:\inetpub\sites\ \wiki\extensions\SpecialSAMLAuth\SpecialSAMLAuth_body.php on line 296

I noticed that on the AuthPlugin documentation, it states that the LocalSettings.php requires:

require_once( "$IP/extensions/MyAuthPlugin/MyAuthPlugin.php" ); $wgAuth = new MyAuthPlugin;

not just

require_once( "\$IP/extensions/SpecialSAMLAuth/SpecialSAMLAuth.php" );

Using this information, I updated my LocalSettings.php accordingly.

Now the following error has moved from line 296 to 245

Strict Standards: Declaration of SAMLAuthLogin::addUser should be compatible with that of AuthPlugin::addUser in C:\inetpub\sites\ \wiki\extensions\SpecialSAMLAuth\SpecialSAMLAuth_body.php on line 245

It also breaks the Error Logging/Troubleshooting tools and will no longer load my Profile.

Any assistance would be greatly appreciated. Thank you in advance.

--Technomensch (talk) 20:31, 29 August 2013 (UTC)

Enable SAML Integration on site with existing users?
Q: I have a wiki that has a few hundred users. I am migrating to a new server (easy) but I want to enable SAML. The user IDs will collide. What is the cleanest way to migrate and enable SAML retroactively without losing contributions by users (e.g. bbob now logs in with SAML based login and still is bbob the same user he was for the laster year)? 148.177.1.217 18:25, 4 October 2013 (UTC)