summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-05-05 19:24:00 +0200
committerJordi Boggiano <j.boggiano@seld.be>2013-05-08 15:02:51 +0200
commit61a938df990ae4325505c6b5b07be491c004aded (patch)
treeb8b268c0d996feaf326965563f7dfe4616dd93e1
parenta17191f515bb098f083cb02ac280ed96bd5e0b72 (diff)
downloadsymfony-security-61a938df990ae4325505c6b5b07be491c004aded.zip
symfony-security-61a938df990ae4325505c6b5b07be491c004aded.tar.gz
symfony-security-61a938df990ae4325505c6b5b07be491c004aded.tar.bz2
[Security] allowed simple pre-auth to be optional if another auth mechanism already authenticated the user
-rw-r--r--Http/Firewall/SimplePreAuthenticationListener.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/Http/Firewall/SimplePreAuthenticationListener.php b/Http/Firewall/SimplePreAuthenticationListener.php
index 80b35a5..2a6b4d5 100644
--- a/Http/Firewall/SimplePreAuthenticationListener.php
+++ b/Http/Firewall/SimplePreAuthenticationListener.php
@@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
+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;
@@ -71,6 +72,10 @@ class SimplePreAuthenticationListener implements ListenerInterface
$this->logger->info(sprintf('Attempting simple pre-authorization %s', $this->providerKey));
}
+ if (null !== $this->context->getToken() && !$this->context->getToken() instanceof AnonymousToken) {
+ return;
+ }
+
try {
$token = $this->simpleAuthenticator->createToken($request, $this->providerKey);
$token = $this->authenticationManager->authenticate($token);