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()); }
/** * 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; }