2009年4月22日星期三

Re: [fw-auth] Two sessions in one server

Thanks! Its works.
Although I cant instantiate Zend_Auth, its a singleton.

On each project i write this code:

Project 1:
$p = new Zend_Auth_Storage_Session('PROJECT1');
$aut = Zend_Auth::getInstance();
$aut->setStorage($p);
$result = $aut->authenticate($autAdapter);
 
Project 2:
$p = new Zend_Auth_Storage_Session('PROJECT2');
$aut = Zend_Auth::getInstance();
$aut->setStorage($p);
$result = $aut->authenticate($autAdapter);

Then in my IndexController I check what session is, it can be done in many ways:
For now i used:

  if(isset( $_SESSION['PROJECT1'] ) {
                echo "loggedIn";
                };


Thanks,
Guille.

From: Hector Virgen <djvirgen@gmail.com>
To: Tom Graham <tom.graham@jadu.co.uk>
Cc: fw-auth@lists.zend.com
Sent: Wednesday, April 22, 2009 12:23:34 PM
Subject: Re: [fw-auth] Two sessions in one server

If you want to make sure there are no other session conflicts between the two projects, you should take a look at the Zend_Session configuration options:


You can give each project a unique session name so there will be no conflicts, even without modifying Zend_Auth.

-Hector


On Wed, Apr 22, 2009 at 7:25 AM, Tom Graham <tom.graham@jadu.co.uk> wrote:
Try having different session namespaces for the two projects, for example:

// In the first project
$auth = new Zend_Auth();
$auth->setStorage(new Zend_Auth_Storage_Session('project1'));

// In the second project
$auth = new Zend_Auth();
$auth->setStorage(new Zend_Auth_Storage_Session('project2'));

Hope that helps,

Tom


On 22 Apr 2009, at 15:09, Guillermo Caserotto wrote:


Hi folks, i have one server and its configured with zend for using two o more projects at the same time. Also have an index page for each project with their IndexControllers. I did a LoginController on the two projects using Zend_Auth but i can't getting to work with two projects. For example, I enter login a password in project one, its authenticated, when i go to the second project its show me directly the menu page, its like im logged in. 

How can i do?


Thanks!








没有评论: