Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php zend framework 2:设置会话身份验证超时_Php_Authentication_Zend Framework_Zend Framework2 - Fatal编程技术网

Php zend framework 2:设置会话身份验证超时

Php zend framework 2:设置会话身份验证超时,php,authentication,zend-framework,zend-framework2,Php,Authentication,Zend Framework,Zend Framework2,我的身份验证会话没有过期,这是我的身份验证代码: $adapter = $this->getServiceLocator()->get('doctrine.authenticationadapter.orm_default'); $adapter->setOptions(array( 'objectManager' => $this->getEntityManager(), 'identityClass' => 'Application\Ent

我的身份验证会话没有过期,这是我的身份验证代码:

$adapter = $this->getServiceLocator()->get('doctrine.authenticationadapter.orm_default');
$adapter->setOptions(array(
    'objectManager' => $this->getEntityManager(),
    'identityClass' => 'Application\Entity\User',
    'identityProperty' => 'email',
    'credentialProperty' => 'password'));

$adapter->setIdentityValue($mail);
$adapter->setCredentialValue($password);
$authService = new AuthenticationService();
$result = $authService->authenticate($adapter);

if ($result->isValid()) 
{
    $identity = $result->getIdentity();
    $authService->getStorage()->write($identity);
    echo "valide"; 
}
else
    echo "invalide";
谢谢。

你应该看看

对于身份提供者。
然后在配置中:配置角色\u提供者。

以下是我解决问题的方法:

if ($result->isValid()) 
{
     $session = new Container('Zend_Auth');
     $session->setExpirationSeconds(1800);
    $identity = $result->getIdentity();
    $authService->getStorage()->write($identity);
    echo "valide"; 
}
else
    echo "invalide";
我获取对象会话
Zend_Auth
,然后编辑过期时间的值。
希望有帮助

所有的代码都是你自己写的吗?如果没有,您正在使用哪些外部模块?您的配置中是否有任何会话配置(
/config/autoload/*
),但在任何模块配置中也有?在
module.php
中是否有额外的配置?@ThomasDutrion否我没有其他关于会话配置或身份验证配置的信息。那么它可能来自您的底层php配置。