Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -# Copyright (C) 2004 Ryan Lane <rlane32@gmail.com> |
| 3 | +# Copyright (C) 2004 Ryan Lane <http://www.mediawiki.org/wiki/User:Ryan_lane> |
4 | 4 | # |
5 | 5 | # This program is free software; you can redistribute it and/or modify |
6 | 6 | # it under the terms of the GNU General Public License as published by |
— | — | @@ -891,6 +891,20 @@ |
892 | 892 | } |
893 | 893 | |
894 | 894 | /** |
| 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 | + /** |
895 | 909 | * Gets the searchstring for a user based upon settings for the domain. |
896 | 910 | * Returns a full DN for a user. |
897 | 911 | * |
— | — | @@ -1415,6 +1429,7 @@ |
1416 | 1430 | */ |
1417 | 1431 | function useSmartcardAuth() { |
1418 | 1432 | global $wgLDAPUseSmartcardAuth, $wgLDAPSmartcardDomain; |
| 1433 | + |
1419 | 1434 | return $wgLDAPUseSmartcardAuth && $_SESSION['wsDomain'] == $wgLDAPSmartcardDomain; |
1420 | 1435 | } |
1421 | 1436 | } |
— | — | @@ -1424,9 +1439,9 @@ |
1425 | 1440 | */ |
1426 | 1441 | $wgExtensionCredits['other'][] = array( |
1427 | 1442 | 'name' => 'LDAP Authentication Plugin', |
1428 | | - 'version' => '1.1d', |
| 1443 | + 'version' => '1.1e', |
1429 | 1444 | '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', |
1431 | 1446 | 'url' => 'http://meta.wikimedia.org/wiki/LDAP_Authentication' |
1432 | 1447 | ); |
1433 | 1448 | |
— | — | @@ -1443,8 +1458,6 @@ |
1444 | 1459 | global $wgHooks; |
1445 | 1460 | global $wgAuth; |
1446 | 1461 | global $wgLDAPAutoAuthMethod; |
1447 | | - global $wgLDAPUseSmartcardAuth; |
1448 | | - global $wgLDAPSmartcardDomain; |
1449 | 1462 | |
1450 | 1463 | $wgAuth = new LdapAuthenticationPlugin(); |
1451 | 1464 | |
— | — | @@ -1461,8 +1474,6 @@ |
1462 | 1475 | $wgAuth->printDebug("wgLDAPSSLUsername is not null, adding hooks.",1); |
1463 | 1476 | $wgHooks['AutoAuthenticate'][] = 'SSLAuth'; /* Hook for magical authN */ |
1464 | 1477 | $wgHooks['PersonalUrls'][] = 'NoLogout'; /* Disallow logout link */ |
1465 | | - $wgLDAPUseSmartcardAuth = true; |
1466 | | - $wgAuth->setDomain($wgLDAPSmartcardDomain); |
1467 | 1478 | } |
1468 | 1479 | break; |
1469 | 1480 | default: |
— | — | @@ -1496,6 +1507,10 @@ |
1497 | 1508 | return; |
1498 | 1509 | } |
1499 | 1510 | |
| 1511 | + //Let regular authentication plugins configure themselves for auto |
| 1512 | + //authentication chaining |
| 1513 | + $wgAuth->autoAuthSetup(); |
| 1514 | + |
1500 | 1515 | //The user hasn't already been authenticated, let's check them |
1501 | 1516 | $wgAuth->printDebug("User is not logged in, we need to authenticate",1); |
1502 | 1517 | $authenticated = $wgAuth->authenticate($wgLDAPSSLUsername); |