summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
authorChristian Flothmann <christian.flothmann@xabbuh.de>2015-11-05 23:29:27 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2015-11-23 11:04:06 +0100
commitcc98e8c84c84b9ffda2544762c41bfee8e192b72 (patch)
treef5292f769d3faa65ba6f55d51e6f23b196602eb4 /Http
parent1dabcc78193413d90a6a1eeaaf50764b67ac61af (diff)
downloadsymfony-security-cc98e8c84c84b9ffda2544762c41bfee8e192b72.zip
symfony-security-cc98e8c84c84b9ffda2544762c41bfee8e192b72.tar.gz
symfony-security-cc98e8c84c84b9ffda2544762c41bfee8e192b72.tar.bz2
migrate session after remember me authentication
Diffstat (limited to 'Http')
-rw-r--r--Http/Firewall/RememberMeListener.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/Http/Firewall/RememberMeListener.php b/Http/Firewall/RememberMeListener.php
index 942e537..52a231c 100644
--- a/Http/Firewall/RememberMeListener.php
+++ b/Http/Firewall/RememberMeListener.php
@@ -20,6 +20,7 @@ use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\SecurityEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
/**
* RememberMeListener implements authentication capabilities via a cookie.
@@ -33,6 +34,7 @@ class RememberMeListener implements ListenerInterface
private $authenticationManager;
private $logger;
private $dispatcher;
+ private $sessionStrategy;
/**
* Constructor.
@@ -50,6 +52,7 @@ class RememberMeListener implements ListenerInterface
$this->authenticationManager = $authenticationManager;
$this->logger = $logger;
$this->dispatcher = $dispatcher;
+ $this->sessionStrategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE);
}
/**
@@ -70,6 +73,11 @@ class RememberMeListener implements ListenerInterface
try {
$token = $this->authenticationManager->authenticate($token);
+
+ if ($request->hasSession() && $request->getSession()->isStarted()) {
+ $this->sessionStrategy->onAuthentication($request, $token);
+ }
+
$this->securityContext->setToken($token);
if (null !== $this->dispatcher) {