So you're saying an admin goes to the login page, enters a user's username (ex. "johndoe") and the "god mode" password (ex. "g0dm0d3"), your application should log him in as that user?
In that case, I would check the password field first -- if it matches the god mode password, you can inject the identity into Zend_Auth's storage: $auth = Zend_Auth::getInstance(); $storage = $auth->getStorage(); $storage->write($user); I'm not sure how you are currently storing the user info in Zend_Auth during a normal login, but it shouldn't be difficult to recreate that data. In my experience I've found it's best to store just the unique user ID. This makes it really easy to do what you want: $storage->write(123); // example Zend_Auth doesn't care what you store in there, as long as your application knows how to handle that value when it's pulled out with Zend_Auth#getIdentity(). -- Hector On Wed, Jun 23, 2010 at 10:21 AM, robert mena <[email protected]> wrote: > Hi, > > I am using Zend_Auth to authenticate my users in an application. I was > requested to provide a 'god' mode where the admin will enter the username > and a special password and login as that user. > > No matter how I dislike the idea I have to implement it. So In my view if > the password is the special one I'd have to 'inject' the credentials to the > zend_auth so in further requests (in the controllers that require the login > user) everything will continue without a problem. > > Question: > - How can I do it? > > Regards. >
