Emu
This extension allows Mediawiki to authenticate against a remote Drupal 4.6/ 4.7 site.
The full GPL source is available at http://www.prattenplus.net/emu
Overview
Emu enables Mediawiki to make encrypted authentication requests over the internet to a remote Drupal Installation. You may customise the Drupal role that a person must have before being authenticated.
Partial Source
Here is the core of the extension from 0.91 version.
<?php /* Emu Remote Authentication against Drupal (4.6/ 4.7) v0.9.1 Copyright: Emu@prattenplus.net Licence: GPL No warranty URL: www.prattenplus.net/emu See readme.txt for more information. */ require_once($IP."/includes/AuthPlugin.php"); require_once($IP.'/extensions/emu_shared.inc'); require_once($IP.'/extensions/emu_sharedconfig.inc'); require_once($IP.'/extensions/emu_mediawikiconfig.inc'); /** * Authentication plugin using Emu. */ class Emu extends AuthPlugin { function userExists( $username ) { global $drupalurl, $emu_debug; $request = "<emu><action>userExists</action><user>".$username."</user></emu>"; $ans = emu_askdrupal($drupalurl,$request); if ($emu_debug) { print htmlspecialchars($request.'<br />'.$ans);} return (emu_extractreply($ans,"response")=="OK"); } function authenticate( $username, $password ) { global $drupalurl, $emu_debug, $emu_whichrole; $request = "<emu><action>authenticate</action><user>".$username."</user><pass>".$password."</pass></emu>"; $ans = emu_askdrupal($drupalurl, $request ); if ($emu_debug) { print htmlspecialchars($request.'<br />'.$ans);} return (emu_extractreply($ans,"response")=="OK"&&strpos("forcefirstmatchoff0".emu_extractreply($ans,"roles"),$emu_whichrole)); } function autoCreate() { //allow mediawiki to auto create local users. return true; } function strict() { // users must authenticate against drupal return true; } function setPassword( $password ) { //access to drupal is read only return false; } function addUser( $user, $password ) { return false; } function updateExternalDB( $user ) { return false; } } $wgExtensionCredits['other'][] = array( 'name' => 'Emu ', 'version' => '0.9.1', 'author' => 'David Pratten', 'url' => 'http://meta.wikimedia.org/wiki/Emu', 'description' => 'mu Remote Authentication against Drupal (4.6/ 4.7)' ); # This code was based on the code for QISSingleSignOn retrieved 23-Jan-2006 from http://meta.wikimedia.org/wiki/QISSingleSignOn # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # http://www.gnu.org/copyleft/gpl.html ?>