Skip to content

Commit f893d75

Browse files
committed
fixed bug
1 parent e85cb7f commit f893d75

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ public function handle(GetResponseEvent $event)
7676
}
7777

7878
try {
79-
$this->securityContext->setToken(null);
8079
$token = $this->simpleAuthenticator->createToken($request, $this->providerKey);
8180

82-
if ($token instanceof TokenInterface) {
83-
$token = $this->authenticationManager->authenticate($token);
84-
$this->securityContext->setToken($token);
81+
// allow null to be returned to skip authentication
82+
if (null === $token) {
83+
return;
8584
}
85+
86+
$token = $this->authenticationManager->authenticate($token);
87+
$this->securityContext->setToken($token);
8688
} catch (AuthenticationException $e) {
8789
$this->securityContext->setToken(null);
8890

0 commit comments

Comments
 (0)