Revision [19390]

This is an old revision of LDAPauthentication made by DomBonj on 2008-01-28 00:15:40.

 

LDAPauthentication

See also:
works with:
  • Wikka 1.1.6.3
NOT included in any Wikka version
Last edited by DomBonj:
Modified links pointing to docs server
Mon, 28 Jan 2008 00:15 UTC [diff]

This is the development page for the LDAPauthentication extension.

Installation


Code

1. In actions/usersettings.php, go to line 82 and replace the following code block:

if (!defined('TEMP_PASSWORD_LABEL')) define('TEMP_PASSWORD_LABEL', "Password reminder:");

//initialize variables
$params = '';

with the following code block:

if (!defined('TEMP_PASSWORD_LABEL')) define('TEMP_PASSWORD_LABEL', "Password reminder:");

function LDAP_wikiname_to_login ($name)
{
    return strtolower($name);
}

function LDAP_auth ($LDAPserver, $LDAPreq, $login, $pwd)
{
    $success = false;
    if ($ldapconn = ldap_connect($LDAPserver))
    {
        // put here any LDAP option you may want to set
        //ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
        if ($result = ldap_bind($ldapconn, sprintf($LDAPreq, LDAP_wikiname_to_login($login)), $pwd))
        {
            $success = true;
        }
        ldap_close($ldapconn);
    }
    return $success;
}

//initialize variables
$params = '';


2. Go to line 389 and replace the following code block:

                case (strlen($_POST['password']) == 0):
                    $error = ERROR_EMPTY_PASSWORD;
                    $password_highlight = INPUT_ERROR_STYLE;
                    break;
                case (md5($_POST['password']) != $existingUser['password']):

with the following code block:

                case (strlen($_POST['password']) == 0):
                    $error = ERROR_EMPTY_PASSWORD;
                    $password_highlight = INPUT_ERROR_STYLE;
                    break;
                case (isset($this->config['user_identification']) && ($this->config['user_identification']=='ldap') && LDAP_auth($this->config['ldap_server'], $this->config['ldap_name'], $_POST['name'], $_POST['password'])):
                    // authenticated by the LDAP directory
                    $this->SetUser($existingUser);
                    $this->Redirect($url, '');
                    break;
                case (md5($_POST['password']) != $existingUser['password']):


3. Add the following lines (with the appropriate values for lines 2 and 3) to wikka.config.php:

    'user_identification' => 'ldap',
    'ldap_server' => 'myldapserver',
    'ldap_name' => '%s',



CategoryUserContributions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki