2009年3月22日星期日

Re: [fw-auth] Configuring Session in Zend_Auth

Is there a reason why you are setting the auth adapter values into a new session. Zend_Auth uses it's own namespace in Zend_Session. 

On Sun, Mar 22, 2009 at 6:49 PM, kadams <kadams@gmail.com> wrote:

Hello, I have some code like this and I'm trying to configure the Zend
Session created within Zend auth and so far, I've had no luck doing it:

                               $db =
Zend_Db::factory($configuration->database);        //Connection to the
database
                               $authAdapter = new Zend_Auth_Adapter_DbTable($db);
                               $authAdapter->setTableName('users');
                               $authAdapter->setIdentityColumn('user_email');
                               $authAdapter->setCredentialColumn('user_password');          //Verify
table values with form values
                               $authAdapter->setIdentity($email);
                               $authAdapter->setCredential($password);
                               $auth = Zend_Auth::getInstance();
                               $result = $auth->authenticate($authAdapter);            //Authenticate
using the adapter
                               if ($result->isValid())
                               {
                                       // store the identity as an object where only the username and
                                       // real_name have been returned
                                       Zend_Session::setOptions($configuration->session->toArray());
                                       Zend_Session::start ();
                                       $storage = $auth->getStorage();
                                       //Store all user table data except password as session variables
                                       $storage->write($authAdapter->getResultRowObject(null, 'password'));
                                       $this->view->user = Zend_Auth::getInstance()->getIdentity();
                                       $this->view->title = 'Welcome';
                                       $this->_helper->layout->setLayout('dynamiclayout');
                                       $this->_helper->redirector('index');
                                       //$this->_helper->redirector->gotoUrl('/project/project/index');
                               }

In my config.ini file, I have:
session.remember_me_seconds=7200

If I create a session using Zend_Session, without Auth, this works fine.
Any ideas what I am doing wrong?

Thanks,
Kevin
--
View this message in context: http://www.nabble.com/Configuring-Session-in-Zend_Auth-tp22652278p22652278.html
Sent from the Zend Auth mailing list archive at Nabble.com.




--
Cory Wiles
kwylez@gmail.com
http://www.corywiles.com/
http://www.randomthoughtprocess.com/

没有评论: