diff options
author | Xavier HAUSHERR <xavier.hausherr@ebuzzing.com> | 2013-08-22 15:12:32 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2013-08-26 16:47:55 +0200 |
commit | 1470a1a7f44c24eaa288a6dd7d43f4a51d8045dd (patch) | |
tree | e0f462e17d9cc821dec84829b6ba0e11b83322c8 /Http | |
parent | 3fb54e7c4c453f87182858dfd603947802269c98 (diff) | |
download | symfony-security-1470a1a7f44c24eaa288a6dd7d43f4a51d8045dd.zip symfony-security-1470a1a7f44c24eaa288a6dd7d43f4a51d8045dd.tar.gz symfony-security-1470a1a7f44c24eaa288a6dd7d43f4a51d8045dd.tar.bz2 |
clearToken exception is thrown at wrong place.v2.2.6
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Firewall/AbstractPreAuthenticatedListener.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Http/Firewall/AbstractPreAuthenticatedListener.php b/Http/Firewall/AbstractPreAuthenticatedListener.php index e248c6d..fdc2e8c 100644 --- a/Http/Firewall/AbstractPreAuthenticatedListener.php +++ b/Http/Firewall/AbstractPreAuthenticatedListener.php @@ -63,7 +63,7 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface try { list($user, $credentials) = $this->getPreAuthenticatedData($request); } catch (BadCredentialsException $exception) { - $this->clearToken(); + $this->clearToken($exception); return; } @@ -91,21 +91,23 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface $this->dispatcher->dispatch(SecurityEvents::INTERACTIVE_LOGIN, $loginEvent); } } catch (AuthenticationException $failed) { - $this->clearToken(); + $this->clearToken($failed); } } /** * Clears a PreAuthenticatedToken for this provider (if present) + * + * @param AuthenticationException $exception */ - protected function clearToken() + private function clearToken(AuthenticationException $exception) { $token = $this->securityContext->getToken(); if ($token instanceof PreAuthenticatedToken && $this->providerKey === $token->getProviderKey()) { $this->securityContext->setToken(null); if (null !== $this->logger) { - $this->logger->info(sprintf("Cleared security context due to exception: %s", $failed->getMessage())); + $this->logger->info(sprintf("Cleared security context due to exception: %s", $exception->getMessage())); } } } |