public function test_SuperUsersCanLogin_IfWebServerAuthUsed_AndWebServerAuthSetupIncorreclty() { unset($_SERVER['REMOTE_USER']); $ldapAuth = WebServerAuth::makeConfigured(); $ldapAuth->setLogin(self::TEST_SUPERUSER_LOGIN); $ldapAuth->setPassword(self::TEST_SUPERUSER_PASS); $authResult = $ldapAuth->authenticate(); $this->assertEquals(AuthResult::SUCCESS_SUPERUSER_AUTH_CODE, $authResult->getCode()); $ldapAuth = WebServerAuth::makeConfigured(); $ldapAuth->setLogin(self::TEST_SUPERUSER_LOGIN); $ldapAuth->setTokenAuth(UsersManagerAPI::getInstance()->getTokenAuth(self::TEST_SUPERUSER_LOGIN, md5(self::TEST_SUPERUSER_PASS))); $authResult = $ldapAuth->authenticate(); $this->assertEquals(AuthResult::SUCCESS_SUPERUSER_AUTH_CODE, $authResult->getCode()); }
/** * 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(); } } }