[Security] Add an option to disable the hasPreviousSession() check in AbstractAuthenticationListener

This commit is contained in:
Adrien BRAULT 2012-07-09 01:05:31 +02:00
parent b34bdd4639
commit 0562463cb7
2 changed files with 3 additions and 1 deletions

View File

@ -36,6 +36,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
'use_referer' => false,
'failure_path' => null,
'failure_forward' => false,
'require_previous_session' => true,
);
public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)

View File

@ -98,6 +98,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
'use_referer' => false,
'failure_path' => null,
'failure_forward' => false,
'require_previous_session' => true,
), $options);
$this->logger = $logger;
$this->dispatcher = $dispatcher;
@ -132,7 +133,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
}
try {
if (!$request->hasPreviousSession()) {
if ($this->options['require_previous_session'] && !$request->hasPreviousSession()) {
throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.');
}