8000 Merge branch '2.0' · proofek/symfony@0025673 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0025673

Browse files
committed
Merge branch '2.0'
* 2.0: Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes symfony#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 symfony#1798).
2 parents 5882a98 + 3c584f5 commit 0025673

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ol class="traces">
1+
<ol class="traces logs">
22
{% for log in logs %}
33
<li{% if log.priorityName in ['EMERG', 'ERR', 'CRIT', 'ALERT', 'ERROR', 'CRITICAL'] %} class="error"{% endif %}>
44
{{ log.message }}

src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
1616
use Symfony\Component\Security\Core\SecurityContextInterface;
1717
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
18+
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1819
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
20+
use Symfony\Component\Security\Core\Exception\AccountStatusException;
1921
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2022
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2123
use Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException;
@@ -158,6 +160,12 @@ private function startAuthentication(Request $request, AuthenticationException $
158160

159161
$this->setTargetPath($request);
160162

163+
if ($authException instanceof AccountStatusException && ($token = $this->context->getToken()) instanceof UsernamePasswordToken) {
164+
// remove the security token to prevent infinite redirect loops
165+
$this->context->setToken(null);
166+
$request->getSession()->remove('_security_' . $token->getProviderKey());
167+
}
168+
161169
return $this->authenticationEntryPoint->start($request, $authException);
162170
}
163171

0 commit comments

Comments
 (0)
2941
0