我使用Zend Framework 2进行身份验证。代码遵循文档 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);
默认情况下,
Zend\Authentication
使用PHP会话从成功的身份验证尝试中提供身份的持久存储。
我想配置持久存储以保持数据一周(如果用户选中“记住我”复选框)。我不想开发自定义存储类。
如何使用现有的Zend Framework 2代码实现“记住我”功能?
我认为延长会话实时时间并不是一个完美的解决方案。我们应该在cookie中保留一些关于用户的信息。是否可以配置Zend Framework从已保存的cookie中检索信息并将其用于身份验证?
P.S。我知道如何编写自定义存储类,但我想丢掉任何其他自定义代码。我们拥有的代码越少,我们应该支持的越少。