Hi Justin,
The main site does log users in, and stores their
information in a
domain-wide cookie. However, to my knowledge, since the sites sit
on two
physically separate servers, I cannot use the REMOTE_USER
authentication
hack that is available on
mediawiki.org.
So basically, I'm looking for a way for Mediawiki to take the
username that
is available in the domain-wide cookie and authenticate using
that. Has
anyone seen an implementation like that or know where I can find
out how to
do that?
HEAD and 1.5 have ExternalAuth hook, which allows to bind external
authentication methods, this is example Auth class I've written as an
example (of course, more sophisticated methods can be used..):
--Domas
<?
global $wgHooks;
$wgHooks['AutoAuthenticate'][] = 'AuthServerMagic';
function AuthServerMagic(&$user) {
if ($_SERVER["REMOTE_USER"] == "") {
return new User();
}
$user = User::newFromName( $_SERVER["REMOTE_USER"] );
if ( $user->getID() == 0 ) {
$user->addToDatabase();
$user->setToken();
} else {
/* Should cache some day, I guess :) */
$user->loadFromDatabase();
}
return true;
}
?>