private function doAuthTestByPasswordHash($expectCode, $login = self::TEST_LOGIN, $pass = self::TEST_PASS) { $auth = SynchronizedAuth::makeConfigured(); $auth->setLogin($login); $auth->setPasswordHash(md5($pass)); $result = $auth->authenticate(); $this->assertEquals($expectCode, $result->getCode()); }
/** * Returns a WebServerAuth instance configured with INI config. * * @return WebServerAuth */ public static function makeConfigured() { $result = new WebServerAuth(); $result->setLdapUsers(LdapUsers::makeConfigured()); $result->setUsersManagerAPI(UsersManagerAPI::getInstance()); $result->setUsersModel(new UserModel()); $result->setUserSynchronizer(UserSynchronizer::makeConfigured()); $synchronizeUsersAfterSuccessfulLogin = Config::getShouldSynchronizeUsersAfterLogin(); $result->setSynchronizeUsersAfterSuccessfulLogin($synchronizeUsersAfterSuccessfulLogin); if (Config::getUseLdapForAuthentication()) { $fallbackAuth = LdapAuth::makeConfigured(); } else { $fallbackAuth = SynchronizedAuth::makeConfigured(); } $result->setFallbackAuth($fallbackAuth); return $result; }
/** * Returns the authentication implementation to use in LoginLdap based on certain * INI configuration values. * * @return Base */ public static function factory() { if (Config::shouldUseWebServerAuthentication()) { return WebServerAuth::makeConfigured(); } else { if (Config::getUseLdapForAuthentication()) { return LdapAuth::makeConfigured(); } else { return SynchronizedAuth::makeConfigured(); } } }