/** * Authenticates against the supplied adapter * * @param Zend\Authentication\Adapter $adapter * @return Zend\Authentication\Result */ public function authenticate(Adapter $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; }