summaryrefslogtreecommitdiffstats
path: root/Http/Firewall
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2015-10-17 17:40:24 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2015-10-17 17:40:24 +0200
commit6c610f0c107159232316eb90a3fa6dd5fc42cd50 (patch)
tree7abc50799a15976828cf0f8aeeb20bdb6a0ab657 /Http/Firewall
parenteadd002f7d6ef64268e2fbeb23f4c8d05eaf668f (diff)
parentf4a3959fc209d020abcf5c4d774ee309589bd047 (diff)
downloadsymfony-security-6c610f0c107159232316eb90a3fa6dd5fc42cd50.zip
symfony-security-6c610f0c107159232316eb90a3fa6dd5fc42cd50.tar.gz
symfony-security-6c610f0c107159232316eb90a3fa6dd5fc42cd50.tar.bz2
Merge branch '2.7' into 2.8
* 2.7: [TwigBundle] Fix Twig cache is not properly warmed [Security] Use SessionAuthenticationStrategy on RememberMe login
Diffstat (limited to 'Http/Firewall')
-rw-r--r--Http/Firewall/RememberMeListener.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/Http/Firewall/RememberMeListener.php b/Http/Firewall/RememberMeListener.php
index f5ec8c7..ccadf94 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\SessionAuthenticationStrategyInterface;
/**
* RememberMeListener implements authentication capabilities via a cookie.
@@ -34,18 +35,20 @@ class RememberMeListener implements ListenerInterface
private $logger;
private $dispatcher;
private $catchExceptions = true;
+ private $sessionStrategy;
/**
* Constructor.
*
- * @param TokenStorageInterface $tokenStorage
- * @param RememberMeServicesInterface $rememberMeServices
- * @param AuthenticationManagerInterface $authenticationManager
- * @param LoggerInterface $logger
- * @param EventDispatcherInterface $dispatcher
- * @param bool $catchExceptions
+ * @param TokenStorageInterface $tokenStorage
+ * @param RememberMeServicesInterface $rememberMeServices
+ * @param AuthenticationManagerInterface $authenticationManager
+ * @param LoggerInterface $logger
+ * @param EventDispatcherInterface $dispatcher
+ * @param bool $catchExceptions
+ * @param SessionAuthenticationStrategyInterface $sessionStrategy
*/
- public function __construct(TokenStorageInterface $tokenStorage, RememberMeServicesInterface $rememberMeServices, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, $catchExceptions = true)
+ public function __construct(TokenStorageInterface $tokenStorage, RememberMeServicesInterface $rememberMeServices, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, $catchExceptions = true, SessionAuthenticationStrategyInterface $sessionStrategy = null)
{
$this->tokenStorage = $tokenStorage;
$this->rememberMeServices = $rememberMeServices;
@@ -53,6 +56,7 @@ class RememberMeListener implements ListenerInterface
$this->logger = $logger;
$this->dispatcher = $dispatcher;
$this->catchExceptions = $catchExceptions;
+ $this->sessionStrategy = $sessionStrategy;
}
/**
@@ -73,6 +77,9 @@ class RememberMeListener implements ListenerInterface
try {
$token = $this->authenticationManager->authenticate($token);
+ if (null !== $this->sessionStrategy && $request->hasSession() && $request->getSession()->isStarted()) {
+ $this->sessionStrategy->onAuthentication($request, $token);
+ }
$this->tokenStorage->setToken($token);
if (null !== $this->dispatcher) {