/** * Performs an authentication attempt * * @throws Zend_Auth_Adapter_Exception If authentication cannot be performed * @return Zend_Auth_Result */ public function authenticate() { // get existing or new session $session = $this->getSession(); // see if the session object has been implemented as a resource yet, // if not it is becase the user hasn't logged in yet. To log in, a // session resource must be created by using a post request to it require_once 'models/Handler/Session.php'; $sessionHandler = new Default_Model_Handler_Session($session); if (null === $sessionHandler->get(array('id' => 1))) { // no session resource yet, create one as an anonymous/default user $sessionHandler->post(array()); // this gets them in into the system, at which point if the user // is in fact themselves posting to the session resource with their // credentials, this created session will be forgotten and they // will continue on as their proper identity } require_once 'Zend/Auth/Result.php'; return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $session->identity); }