bug #12002 [Security] [Firewall] Bug fixed in SimplePreAuthenticationListener when createToken() not return TokenInterface object (adenkejawen, fabpot)

This PR was merged into the 2.4 branch.

Discussion
----------

[Security] [Firewall] Bug fixed in SimplePreAuthenticationListener when createToken() not return TokenInterface object

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | #11490, #11414
| License       | MIT
| Doc PR        |

This is a follow-up for #11414 on the right branch.

Commits
-------

faa8e98 fixed bug
e85cb7f added the possibility to return null from SimplePreAuthenticationListener
This commit is contained in:
Fabien Potencier 2014-09-24 07:53:10 +02:00
commit 93333957e1

View File

@ -76,6 +76,12 @@ class SimplePreAuthenticationListener implements ListenerInterface
try {
$token = $this->simpleAuthenticator->createToken($request, $this->providerKey);
// allow null to be returned to skip authentication
if (null === $token) {
return;
}
$token = $this->authenticationManager->authenticate($token);
$this->securityContext->setToken($token);
} catch (AuthenticationException $e) {