[Mediawiki-l] Intranet Single Signon

Chris McIntosh cmcintosh at gmail.com
Wed Nov 16 18:09:13 UTC 2005


I am modifying the source code to allow our internal Intranet users to
automatically log in to the wiki based on their username applied by apache.
I do this by using mod_ntlm to get their NTLM credentials and then want to
seemlessly log them in.

The problem I am having is setting up the user variable (wgUser) properly. I
have tried the following.

For now I have it near the bottom of Setup.php just to test around line 300.


if ( $wgUseRemoteUser)
{
if ($userid = $wgUser->idFromName($wgIP))
{
$wgUser->setId($userid);
$wgUser->loadFromDatabase();
}
else
{
$wgUser = $wgUser->newFromName($wgIP);
$wgUser->setId($wgUser->getMaxId());
$wgUser->addToDatabase();
}
$wgUser->setToken() ;
$wgUser->setCookies();
}

The problem with this approach is I can't change any preferences for this
user. Everything else seems fine but if I try and change a setting like
Underline links, the preference page won't save. I have tracked that down to
the edit token not being set properly, but I am not sure how to set it. If I
remove the check in SpecialPreferences where it calls matchEditToken then
everything works fine.

Any advice?

Thanks
Chris McIntosh



More information about the MediaWiki-l mailing list