diff options
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Firewall/SimplePreAuthenticationListener.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Http/Firewall/SimplePreAuthenticationListener.php b/Http/Firewall/SimplePreAuthenticationListener.php index 47996b2..a6f4f77 100644 --- a/Http/Firewall/SimplePreAuthenticationListener.php +++ b/Http/Firewall/SimplePreAuthenticationListener.php @@ -21,7 +21,6 @@ use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** * SimplePreAuthenticationListener implements simple proxying to an authenticator. @@ -76,13 +75,15 @@ class SimplePreAuthenticationListener implements ListenerInterface } try { - $this->securityContext->setToken(null); $token = $this->simpleAuthenticator->createToken($request, $this->providerKey); - if ($token instanceof TokenInterface) { - $token = $this->authenticationManager->authenticate($token); - $this->securityContext->setToken($token); + // allow null to be returned to skip authentication + if (null === $token) { + return; } + + $token = $this->authenticationManager->authenticate($token); + $this->securityContext->setToken($token); } catch (AuthenticationException $e) { $this->securityContext->setToken(null); |