Is there a way to force authentication with Zend_Auth?

I am working with Zend_Auth and saving cookie / session. I cannot figure out how to force authentication with this class.

Is there a way to make Zend_Auth believe that it is authenticated as a user?

+2
source share
1 answer
Zend_Auth::getInstance()->getStorage()->write($identity); 

Where $identity will contain the same type of structure / data that is generated when a user logs in through a standard mechanism. For example, given this example code in the login action:

 $adapter = $this->getAuthAdapter($form->getValues()); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($adapter); if ($result->isValid()) { // (...) } 

$result->getIdentity() will return the identifier, if valid.

+5
source

Source: https://habr.com/ru/post/1310095/


All Articles