Extension: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 = " userExists  ".$username."  "; $ans = emu_askdrupal($drupalurl,$request); if ($emu_debug) { print htmlspecialchars($request.' '.$ans);} return (emu_extractreply($ans,"response")=="OK"); }       function authenticate( $username, $password ) { global $drupalurl, $emu_debug, $emu_whichrole; $request = " authenticate  ".$username."  ".$password."  "; $ans = emu_askdrupal($drupalurl, $request ); if ($emu_debug) { print htmlspecialchars($request.' '.$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)' );


 * 1) This code was based on the code for QISSingleSignOn retrieved 23-Jan-2006 from http://meta.wikimedia.org/wiki/QISSingleSignOn
 * 2) This program is free software; you can redistribute it and/or modify
 * 3) it under the terms of the GNU General Public License as published by
 * 4) the Free Software Foundation; either version 2 of the License, or
 * 5) (at your option) any later version.
 * 6) This program is distributed in the hope that it will be useful,
 * 7) but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 8) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * 9) GNU General Public License for more details.
 * 10) You should have received a copy of the GNU General Public License along
 * 11) with this program; if not, write to the Free Software Foundation, Inc.,
 * 12) 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * 13) http://www.gnu.org/copyleft/gpl.html
 * 1) with this program; if not, write to the Free Software Foundation, Inc.,
 * 2) 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * 3) http://www.gnu.org/copyleft/gpl.html

?>

Similar Projects

 * http://www.mediawiki.org/wiki/AuthDrupal
 * DCCWikipedia Authentication - http://wiki.dccforall.com/DCCWikipedia_Authentication