/**
  * Authenticates against the supplied adapter
  *
  * @param  Zend_Auth_Adapter_Interface $adapter
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter, $authProviderKey, $protectCode = null)
 {
     $result = $adapter->authenticate();
     if ($result->isValid()) {
         $this->getStorage()->write(array($result->getIdentity(), $authProviderKey, $protectCode));
     }
     return $result;
 }
Exemplo n.º 2
0
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     $result = $adapter->authenticate();
     if ($result->isValid()) {
         $this->_identity = $adapter->getResultRowObject(null, 'password');
         $storage = $this->getStorage();
         $zadmin_auth = $storage->create();
         $storage->write($this->_identity);
         Zing_Cookies::createCookies(self::COOKIE_ADMIN_AUTH_KEY, $zadmin_auth, 0);
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Authenticates against the supplied adapter.
  *
  * @param Zend_Auth_Adapter_Interface $adapter The adapter to use
  * @return Zend_Auth_Result
  * @see http://framework.zend.com/manual/1.12/en/zend.auth.introduction.html#zend.auth.introduction.adapters Zend_Auth_Adapter_Interface
  * @see http://framework.zend.com/manual/1.12/en/zend.auth.introduction.html#zend.auth.introduction.results Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     // Authenticates against the supplied adapter.
     $result = $adapter->authenticate();
     /*
      * ZF-7546 - prevent multiple succesive calls from storing inconsistent
      * results.
      *
      * Ensure storage has clean state.
      */
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     if ($result->isValid()) {
         $this->getStorage()->write($adapter->getResultRowObject());
     }
     return $result;
 }
Exemplo n.º 4
0
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     $result = $adapter->authenticate();
     if ($result->isValid()) {
         require_once 'Zend/Session.php';
         Zend_Session::regenerateId();
         $user = $adapter->getResultRowObject();
         $this->getStorage()->write($user->name);
         $this->getStorage()->writeData($user);
         $this->getStorage()->writeExpires(time() + $this->_lifetime);
         $this->getStorage()->writeIpAddress($_SERVER['REMOTE_ADDR']);
         require_once 'Zend/Date.php';
         $date = new Zend_Date();
         $date->setTimezone('UTC');
         $now = $date->get(Zend_Date::ISO_8601);
         $data = array('lastLogin' => $now, 'lastRequest' => $now);
         $adapter->update($user->id, $data);
     }
     return $result;
 }
 /**
  * 
  * This function doesn't delete the identity information but adds the new 
  * identity to the storage. This function only works with adapters that 
  * create a Generic identity.
  * 
  * @param \Zend_Auth_Adapter_Interface $adapter
  * @throws Exception
  */
 public function authenticate(\Zend_Auth_Adapter_Interface $adapter)
 {
     $result = $adapter->authenticate();
     $identity = $result->getIdentity();
     if (NULL === $identity) {
         return $result;
     }
     if (get_class($identity) !== 'TBS\\Auth\\Identity\\Generic' && !is_subclass_of($identity, 'TBS\\Auth\\Identity\\Generic')) {
         throw new \Exception('Not a valid identity');
     }
     $currentIdentity = $this->getIdentity();
     if (false === $currentIdentity || get_class($currentIdentity) !== 'TBS\\Auth\\Identity\\Container') {
         $currentIdentity = new Auth\Identity\Container();
     }
     $currentIdentity->add($result->getIdentity());
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     if ($result->isValid()) {
         $this->getStorage()->write($currentIdentity);
     }
     return $result;
 }
Exemplo n.º 6
0
 /**
  * Authenticates against the supplied adapter
  *
  * @param  Zend_Auth_Adapter_Interface $adapter
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     $result = $adapter->authenticate();
     if ($result->isValid()) {
         $this->getStorage()->write($result->getIdentity());
     }
     return $result;
 }
Exemplo n.º 7
0
 /**
  * Authenticates against the supplied adapter
  *
  * @param  Zend_Auth_Adapter_Interface $adapter
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     $result = $adapter->authenticate();
     /**
      * ZF-7546 - prevent multiple succesive calls from storing inconsistent results
      * Ensure storage has clean state
      */
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     if ($result->isValid()) {
         $this->getStorage()->write($result->getIdentity());
     }
     return $result;
 }
Exemplo n.º 8
0
 public function authenticate(Zend_Auth_Adapter_Interface $adapter)
 {
     return $adapter->authenticate();
 }
Exemplo n.º 9
0
 /**
  * Authenticates against the supplied adapter
  *
  * @param  Zend_Auth_Adapter_Interface $adapter
  * @param  string $operator
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter, $operator = null)
 {
     $result = $adapter->authenticate();
     /**
      * ZF-7546 - prevent multiple succesive calls from storing inconsistent results
      * Ensure storage has clean state
      */
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     if ($result->isValid()) {
         $identity = $result->getIdentity();
         if (null !== $operator) {
             $identity['operator'] = $operator;
         }
         $this->getStorage()->write($identity);
         // 以操作者方式登陆时,不支持Cookie自动验证登陆(会丢失操作者参数)
         if (null !== $operator) {
             $identity[self::SESSION_AUTH] = null;
         }
         $this->_setCookies($identity);
     }
     return $result;
 }