/**
 * Sets up the auto-authentication piece of the LDAP plugin.
 *
 * @access public
 */
function AutoAuthSetup()
{
    global $wgHooks;
    global $wgAuth;
    $wgAuth = new LdapAuthenticationPlugin();
    $wgAuth->printDebug("Entering AutoAuthSetup.", NONSENSITIVE);
    if (!$wgAuth->getConf('AutoAuthUsername')) {
        $wgAuth->printDebug("wgLDAPAutoAuthUsername is not null, adding hooks.", NONSENSITIVE);
        $wgHooks['UserLoadAfterLoadFromSession'][] = 'LdapAutoAuthentication::Authenticate';
        $wgHooks['PersonalUrls'][] = 'LdapAutoAuthentication::NoLogout';
        /* Disallow logout link */
    }
}
Пример #2
0
/**
 * Sets up the SSL authentication piece of the LDAP plugin.
 *
 * @access public
 */
function AutoAuthSetup()
{
    global $LDAPSSLUsername;
    global $Hooks;
    global $Auth;
    global $LDAPAutoAuthMethod;
    $Auth = new LdapAuthenticationPlugin();
    $Auth->printDebug("Entering AutoAuthSetup.", 1);
    //We may add quite a few different auto authenticate methods in the
    //future, let's make it easy to support.
    switch ($LDAPAutoAuthMethod) {
        case "smartcard":
            $Auth->printDebug("Allowing smartcard authentication.", 1);
            $Auth->printDebug("wgLDAPSSLUsername = {$LDAPSSLUsername}", 2);
            if ($LDAPSSLUsername != null) {
                $Auth->printDebug("wgLDAPSSLUsername is not null, adding hooks.", 1);
                $Hooks['AutoAuthenticate'][] = 'SSLAuth';
                /* Hook for magical authN */
                $Hooks['PersonalUrls'][] = 'NoLogout';
                /* Disallow logout link */
            }
            break;
        default:
            $Auth->printDebug("Not using any AutoAuthentication methods .", 1);
    }
}
Пример #3
0
/**
 * Sets up the auto-authentication piece of the LDAP plugin.
 *
 * @access public
 */
function AutoAuthSetup()
{
    global $wgHooks;
    global $wgAuth;
    $wgAuth = new LdapAuthenticationPlugin();
    $wgAuth->printDebug("Entering AutoAuthSetup.", NONSENSITIVE);
    # We need both authentication username and domain (bug 34787)
    if ($wgAuth->getConf("AutoAuthUsername") !== "" && $wgAuth->getConf("AutoAuthDomain") !== "") {
        $wgAuth->printDebug("wgLDAPAutoAuthUsername and wgLDAPAutoAuthDomain is not null, adding hooks.", NONSENSITIVE);
        $wgHooks['UserLoadAfterLoadFromSession'][] = 'LdapAutoAuthentication::Authenticate';
        $wgHooks['PersonalUrls'][] = 'LdapAutoAuthentication::NoLogout';
        /* Disallow logout link */
    }
}
/**
 * Sets up the SSL authentication piece of the LDAP plugin.
 *
 * @access public
 */
function AutoAuthSetup()
{
    global $wgLDAPAutoAuthUsername;
    global $wgLDAPSSLUsername;
    global $wgLDAPAutoAuthDomain;
    global $wgLDAPSmartcardDomain;
    global $wgHooks;
    global $wgAuth;
    global $wgVersion;
    $wgAuth = new LdapAuthenticationPlugin();
    $wgAuth->printDebug("Entering AutoAuthSetup.", NONSENSITIVE);
    //Set configuration options for backwards compatibility
    if (isset($wgLDAPSSLUsername)) {
        $wgAuth->printDebug('Setting $wgLDAPAutoAuthUsername to $wgLDAPSSLUsername; please change your configuration to fix this deprecated configuration variable.', NONSENSITIVE);
        $wgLDAPAutoAuthUsername = $wgLDAPSSLUsername;
    }
    if (isset($wgLDAPSmartcardDomain)) {
        $wgAuth->printDebug('Setting $wgLDAPAutoAuthDomain to $wgLDAPSmartcardDomain; please change your configuration to fix this deprecated configuration variable.', NONSENSITIVE);
        $wgLDAPAutoAuthDomain = $wgLDAPSmartcardDomain;
    }
    if ($wgLDAPAutoAuthUsername != null) {
        $wgAuth->printDebug("wgLDAPAutoAuthUsername is not null, adding hooks.", NONSENSITIVE);
        if (version_compare($wgVersion, '1.14.0', '<')) {
            $wgHooks['UserLoadFromSession'][] = 'LdapAutoAuthentication::Authenticate';
        } else {
            $wgHooks['UserLoadAfterLoadFromSession'][] = 'LdapAutoAuthentication::Authenticate';
        }
        $wgHooks['PersonalUrls'][] = 'LdapAutoAuthentication::NoLogout';
        /* Disallow logout link */
    }
}