8000 fixed bug · symfony/symfony@faa8e98 · GitHub
[go: up one dir, main page]

Skip to content

Commit faa8e98

Browse files
committed
fixed bug
1 parent e85cb7f commit faa8e98

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2222
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
2323
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
24-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2524

2625
/**
2726
* SimplePreAuthenticationListener implements simple proxying to an authenticator.
@@ -76,13 +75,15 @@ public function handle(GetResponseEvent $event)
7675
}
7776

7877
try {
79-
$this->securityContext->setToken(null);
8078
$token = $this->simpleAuthenticator->createToken($request, $this->providerKey);
8179

82-
if ($token instanceof TokenInterface) {
83-
$token = $this->authenticationManager->authenticate($token);
84-
$this->securityContext->setToken($token);
80+
// allow null to be returned to skip authentication
81+
if (null === $token) {
82+
return;
8583
}
84+
85+
$token = $this->authenticationManager->authenticate($token);
86+
$this->securityContext->setToken($token);
8687
} catch (AuthenticationException $e) {
8788
$this->securityContext->setToken(null);
8889

0 commit comments

Comments
 (0)
0