public function testAuthenticationWithOldServerConfig()
 {
     $ldapAuth = LdapAuth::makeConfigured();
     $ldapAuth->setLogin(self::TEST_LOGIN);
     $ldapAuth->setPassword(self::TEST_PASS);
     $authResult = $ldapAuth->authenticate();
     $this->assertEquals(1, $authResult->getCode());
 }
 private function doAuthTest($expectCode = 1)
 {
     $ldapAuth = LdapAuth::makeConfigured();
     $ldapAuth->setLogin(self::TEST_LOGIN);
     $ldapAuth->setPassword(self::TEST_PASS);
     $authResult = $ldapAuth->authenticate();
     $this->assertEquals($expectCode, $authResult->getCode());
 }
Example #3
0
 /**
  * Returns a WebServerAuth instance configured with INI config.
  *
  * @return LdapAuth
  */
 public static function makeConfigured()
 {
     $result = new LdapAuth();
     $result->setLdapUsers(LdapUsers::makeConfigured());
     $result->setUsersManagerAPI(UsersManagerAPI::getInstance());
     $result->setUsersModel(new UserModel());
     $result->setUserSynchronizer(UserSynchronizer::makeConfigured());
     Log::debug("LdapAuth::%s: creating with configured components", __FUNCTION__);
     return $result;
 }
 /**
  * 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 a WebServerAuth instance configured with INI config.
  *
  * @return LdapAuth
  */
 public static function makeConfigured()
 {
     $result = new LdapAuth();
     $result->setLdapUsers(LdapUsers::makeConfigured());
     $result->setUsersManagerAPI(UsersManagerAPI::getInstance());
     $result->setUsersModel(new UserModel());
     $result->setUserSynchronizer(UserSynchronizer::makeConfigured());
     return $result;
 }
Example #6
0
 /**
  * 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();
         }
     }
 }
 private function authenticateViaLdap($login = self::TEST_LOGIN, $pass = self::TEST_PASS)
 {
     $ldapAuth = LdapAuth::makeConfigured();
     $ldapAuth->setLogin($login);
     $ldapAuth->setPassword($pass);
     $authResult = $ldapAuth->authenticate();
     $this->assertEquals(1, $authResult->getCode());
     return $authResult;
 }