summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2014-09-23 16:12:58 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2014-09-24 07:52:20 +0200
commitd24ad02240ec3f37fe146671340373f7567ad6c9 (patch)
tree2b3bd79b5ec5e48a2cbd600e027e3bfb83bbde34 /Http
parentffd73a83c73bb07016d2ef4e84bbd76f92121573 (diff)
downloadsymfony-security-d24ad02240ec3f37fe146671340373f7567ad6c9.zip
symfony-security-d24ad02240ec3f37fe146671340373f7567ad6c9.tar.gz
symfony-security-d24ad02240ec3f37fe146671340373f7567ad6c9.tar.bz2
fixed bug
Diffstat (limited to 'Http')
-rw-r--r--Http/Firewall/SimplePreAuthenticationListener.php11
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);