summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Http/Firewall/AbstractPreAuthenticatedListener.php10
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()));
}
}
}