=====LDAPauthentication===== >>==See also:== - Documentation: LDAPauthenticationInfo ==works with:== - Wikka 1.1.6.3 & 1.1.6.4 & 1.1.6.5 >>//NOT included in any Wikka version//{{lastedit show="3"}} This is the development page for the LDAPauthentication extension. ===Installation=== - Add the two code blocks below to ##actions/usersettings.php## - Add the three lines below to ##wikka.config.php## - Make sure PHP is compiled with [[http://php.net/manual/en/ref.ldap.php | LDAP support]] === Code === 1. In ##actions/usersettings.php##, go to line 82 [version 1.1.6.3 only] or 100 [versions 1.1.6.4 & 1.1.6.5 only] and replace the following code block: %%(php) if (!defined('TEMP_PASSWORD_LABEL')) define('TEMP_PASSWORD_LABEL', "Password reminder:"); //initialize variables $params = ''; %% with the following code block: %%(php) 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 [version 1.1.6.3 only] or 417 [versions 1.1.6.4 & 1.1.6.5 only] and replace the following code block: %%(php) 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: %%(php) 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 the second and third lines) to ##wikka.config.php##: %%(php) 'user_identification' => 'ldap', 'ldap_server' => 'myldapserver', 'ldap_name' => '%s', %% ---- CategoryUserContributions