Esempio n. 1
0
 public function setParam(Zend_Auth_Adapter_Interface $adapter)
 {
     $results = $adapter->getResultRowObject();
     $this->login = $results->login;
     $this->pass = $results->pass;
     $this->role = $results->role;
 }
Esempio 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;
 }
Esempio 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;
 }
Esempio n. 4
0
 public function reauthenticate(Zend_Auth_Adapter_Interface $adapter, $id)
 {
     $result = $adapter->reauthenticate($id);
     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;
 }
Esempio n. 5
0
 /**
  * Authenticates against the supplied adapter
  *
  * @param  string $username
  * @param  string $password
  * @return Zend_Auth_Result
  */
 public function authenticate($username, $password)
 {
     // Get a reference to the singleton instance of Zend_Auth
     $this->_auth = Zend_Auth::getInstance();
     // Set the storage interface
     $this->_auth->setStorage(new Glo_Auth_Storage_Session('Glo_Auth'));
     // Set the identity on the adapter
     $this->_adapter->setIdentity($username);
     // Set the credential on the adapter
     $this->_adapter->setCredential($password);
     // Attempt authentication, saving the result
     $result = $this->_auth->authenticate($this->_adapter);
     if (!$result->isValid()) {
         // Authentication failed
         throw new Glo_Auth_Exception_Failed(array_shift($result->getMessages()));
     } else {
         $data = $this->_adapter->getResultRowObject(array('user_uuid'));
         $storage = $this->_auth->getStorage();
         $storage->write($data);
     }
     return $result;
 }
Esempio n. 6
0
 /**
  * Informa Dados Pertinentes ao Usuário
  * @param Zend_Auth_Adapter_Interface $adapter Adaptador da Conexão
  * @return array Dados Informados
  */
 protected function _getData(Zend_Auth_Adapter_Interface $adapter)
 {
     /* @var $adapter Zend_Auth_Adapter_DbTable */
     $data = $adapter->getResultRowObject(null, array('credencial'));
     return $data;
 }