diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2011-11-10 10:55:16 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2011-11-10 10:55:16 +0100 |
commit | 0a472f1c59677e77140d937eebb7523cdbe0a90e (patch) | |
tree | 4badeef5154ee414ff81fc58659587f534ea32f9 /Http | |
parent | 551766c060854b3b0bbd3428a9ae25712f4d2781 (diff) | |
parent | 6b549aafe281d641b4677e74ca5fcce1bf35b183 (diff) | |
download | symfony-security-0a472f1c59677e77140d937eebb7523cdbe0a90e.zip symfony-security-0a472f1c59677e77140d937eebb7523cdbe0a90e.tar.gz symfony-security-0a472f1c59677e77140d937eebb7523cdbe0a90e.tar.bz2 |
Merge branch '2.0'
* 2.0:
Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589).
Remove only the security token instead of the session cookie.
Clear session cookie if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Firewall/ExceptionListener.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Http/Firewall/ExceptionListener.php b/Http/Firewall/ExceptionListener.php index a36baf3..1535b9b 100644 --- a/Http/Firewall/ExceptionListener.php +++ b/Http/Firewall/ExceptionListener.php @@ -15,7 +15,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface; use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Component\Security\Core\Exception\AccountStatusException; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException; @@ -158,6 +160,12 @@ class ExceptionListener $this->setTargetPath($request); + if ($authException instanceof AccountStatusException && ($token = $this->context->getToken()) instanceof UsernamePasswordToken) { + // remove the security token to prevent infinite redirect loops + $this->context->setToken(null); + $request->getSession()->remove('_security_' . $token->getProviderKey()); + } + return $this->authenticationEntryPoint->start($request, $authException); } |