Ejemplo n.º 1
0
 public function testRefreshFail()
 {
     $this->authAdapter->setIdentity('demo')->setCredential(md5('demo'));
     $authResponse = $this->auth->authenticate();
     $this->assertTrue($authResponse->isValid(), $authResponse->getMessages());
     $this->assertTrue($this->auth->hasIdentity());
     $this->authAdapter->setSessionId('inValid');
     $this->assertInstanceOf('Zend_Auth_Result', $authResponse = $this->auth->refresh());
     $this->assertFalse($authResponse->isValid(), $authResponse->getMessages());
 }
Ejemplo n.º 2
0
 /**
  * Do a authentication approve with a defined adapter
  *
  * @param null|Zend_Auth_Adapter_Interface $adapter
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth_Adapter_Interface $adapter = null)
 {
     if ($adapter == null) {
         $adapter = $this->_baseAdapter;
     }
     $result = parent::authenticate($adapter);
     // If authentication with the current adapter was succeeded, read user data from default adapter (database)
     if ($result->isValid() && method_exists($this->getAdapter(0), 'getResultRowObject')) {
         $user = $this->getAdapter(0)->getResultRowObject();
         $this->getStorage()->write($user);
     } else {
         $this->getStorage()->clear();
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Returns an instance of Enlight_Components_Auth
  *
  * @static
  * @return Enlight_Components_Auth
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }