/** * Authenticates the given OpenId identity. * Defined by Zend_Auth_Adapter_Interface. * * @throws Zend_Auth_Adapter_Exception If answering the authentication query is impossible * @return Zend_Auth_Result */ public function authenticate() { $id = $this->_id; if (!empty($id)) { $consumer = new Ak33m_OpenId_Consumer($this->_storage); $consumer->setHttpClient($this->_httpClient); /* login() is never returns on success */ if (!$this->_check_immediate) { if (!$consumer->login($id, $this->_returnTo, $this->_root, $this->_extensions, $this->_response)) { return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, $id, array("Authentication failed", $consumer->getError())); } } else { if (!$consumer->check($id, $this->_returnTo, $this->_root, $this->_extensions, $this->_response)) { return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, $id, array("Authentication failed", $consumer->getError())); } } } else { $params = isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST : $_GET; $consumer = new Ak33m_OpenId_Consumer($this->_storage); $consumer->setHttpClient($this->_httpClient); if ($consumer->verify($params, $id, $this->_extensions)) { return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $id, array("Authentication successful")); } else { return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, $id, array("Authentication failed", $consumer->getError())); } } }