lundi 28 avril 2014

Zend Framework 2 Remember Me without Custom Code


Vote count:

0




I do authentication using Zend Framework 2. The code follows documentation Introduction to Zend\Authentication



use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Adapter\Digest as AuthAdapter;
...
$authService = new AuthenticationService();
$authAdapter = new AuthAdapter($passwordFile, $realm, $username, $password);
$result = $authService->authenticate($authAdapter);



By default, Zend\Authentication provides persistent storage of the identity from a successful authentication attempt using the PHP session.



I want to configure persistent storage to keep data for 1 week (if user checks the 'remember me' check box). I don't want to develop custom storage class.


How the 'remember me' feature might be implemented using existing Zend Framework 2 code?


I think extending session live time is not a perfect solution. We should keep some information about user in a cookie. Is it possible to configure Zend Framework to retrieve information from saved cookie and use it for authentication?


P.S. I do know how to write custom storage class but I want to throw away any additional custom code. The less code we have the less we should support.



asked 35 secs ago






Aucun commentaire:

Enregistrer un commentaire