r20479 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20478‎ | r20479 | r20480 >
Date:03:43, 15 March 2007
Author:laner
Status:old
Tags:
Comment:
Creating a new public method that auto authentication plugins can call to allow regular authentication plugins to do extra setup.
Moving the code to set the auto auth domain name inside the regular auth plugin.
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -1,5 +1,5 @@
22 <?php
3 -# Copyright (C) 2004 Ryan Lane <rlane32@gmail.com>
 3+# Copyright (C) 2004 Ryan Lane <http://www.mediawiki.org/wiki/User:Ryan_lane>
44 #
55 # This program is free software; you can redistribute it and/or modify
66 # it under the terms of the GNU General Public License as published by
@@ -891,6 +891,20 @@
892892 }
893893
894894 /**
 895+ * Configures the authentication plugin for use with auto-authentication
 896+ * plugins.
 897+ *
 898+ * @access public
 899+ */
 900+ function autoAuthSetup() {
 901+ global $wgLDAPUseSmartcardAuth;
 902+ global $wgLDAPSmartcardDomain;
 903+
 904+ $wgLDAPUseSmartcardAuth = true;
 905+ $this->setDomain($wgLDAPSmartcardDomain);
 906+ }
 907+
 908+ /**
895909 * Gets the searchstring for a user based upon settings for the domain.
896910 * Returns a full DN for a user.
897911 *
@@ -1415,6 +1429,7 @@
14161430 */
14171431 function useSmartcardAuth() {
14181432 global $wgLDAPUseSmartcardAuth, $wgLDAPSmartcardDomain;
 1433+
14191434 return $wgLDAPUseSmartcardAuth && $_SESSION['wsDomain'] == $wgLDAPSmartcardDomain;
14201435 }
14211436 }
@@ -1424,9 +1439,9 @@
14251440 */
14261441 $wgExtensionCredits['other'][] = array(
14271442 'name' => 'LDAP Authentication Plugin',
1428 - 'version' => '1.1d',
 1443+ 'version' => '1.1e',
14291444 'author' => 'Ryan Lane',
1430 - 'description' => 'LDAP Authentication plugin with support for numerous LDAP authentication methods',
 1445+ 'description' => 'LDAP Authentication plugin with support for multiple LDAP authentication methods',
14311446 'url' => 'http://meta.wikimedia.org/wiki/LDAP_Authentication'
14321447 );
14331448
@@ -1443,8 +1458,6 @@
14441459 global $wgHooks;
14451460 global $wgAuth;
14461461 global $wgLDAPAutoAuthMethod;
1447 - global $wgLDAPUseSmartcardAuth;
1448 - global $wgLDAPSmartcardDomain;
14491462
14501463 $wgAuth = new LdapAuthenticationPlugin();
14511464
@@ -1461,8 +1474,6 @@
14621475 $wgAuth->printDebug("wgLDAPSSLUsername is not null, adding hooks.",1);
14631476 $wgHooks['AutoAuthenticate'][] = 'SSLAuth'; /* Hook for magical authN */
14641477 $wgHooks['PersonalUrls'][] = 'NoLogout'; /* Disallow logout link */
1465 - $wgLDAPUseSmartcardAuth = true;
1466 - $wgAuth->setDomain($wgLDAPSmartcardDomain);
14671478 }
14681479 break;
14691480 default:
@@ -1496,6 +1507,10 @@
14971508 return;
14981509 }
14991510
 1511+ //Let regular authentication plugins configure themselves for auto
 1512+ //authentication chaining
 1513+ $wgAuth->autoAuthSetup();
 1514+
15001515 //The user hasn't already been authenticated, let's check them
15011516 $wgAuth->printDebug("User is not logged in, we need to authenticate",1);
15021517 $authenticated = $wgAuth->authenticate($wgLDAPSSLUsername);