/**
  * 进行用户验证
  * @param array $credentials
  * @param array $options
  * @return array
  */
 public function authenticate($credentials, $options = null)
 {
     $response = $this->provider->onAuthenticate($credentials, $options);
     //		if($response->status != ELEX_AUTHENTICATE_STATUS_SUCCESS){
     //			throw new Exception($response->error_message,$response->error_code);
     //		}
     return $response;
 }
 /**
  * Construct authentication manager
  *
  * @param AuthenticationProvider $auth_provider
  * @return Authentication
  */
 function __construct($provider, $initialize = true)
 {
     if (instance_of($provider, 'AuthenticationProvider')) {
         $this->provider = $provider;
         if ($initialize) {
             $this->provider->initialize();
         }
         // if
     }
     // if
 }
Example #3
0
 /**
  * Attempt to authenticate the user through a provider.
  *
  * @param AuthenticationProvider $authrequest The authetication request
  * @return Bool True on success
  */
 static function authenticate($authrequest)
 {
     // Resolve the authentication backend
     $auth_class = User::getAuthenticationBackend();
     // Assign the authentication backend to the request
     $authrequest->setAuthBackend($auth_class);
     if ($authrequest->isTokenValid()) {
         $authrequest->login();
         return true;
     }
     return false;
 }
 /**
  * @see AuthenticationProvider::setConfig()
  *
  * @param mixed $config
  */
 public function setConfig($config)
 {
     if (isset($config['dbo'])) {
         $this->dbo = $config['dbo'];
     }
     parent::setConfig($config);
 }
 /**
  * Log user out
  */
 function logUserOut()
 {
     DB::execute("DELETE FROM " . TABLE_PREFIX . 'user_sessions WHERE id = ?', $this->session_id);
     Cookies::unsetVariable($this->session_id_var_name);
     parent::logUserOut();
 }