diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index 02864f372542..2df09577bf0a 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -97,13 +97,17 @@ private function executeGuardAuthenticator($uniqueGuardKey, GuardAuthenticatorIn { $request = $event->getRequest(); try { - if (null !== $this->logger) { - $this->logger->debug('Calling getCredentials() on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); - } - // abort the execution of the authenticator if it doesn't support the request if ($guardAuthenticator instanceof AuthenticatorInterface) { + if (null !== $this->logger) { + $this->logger->debug('Checking support on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); + } + if (!$guardAuthenticator->supports($request)) { + if (null !== $this->logger) { + $this->logger->debug('Guard authenticator does not support the request.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); + } + return; } // as there was a support for given request, @@ -114,6 +118,10 @@ private function executeGuardAuthenticator($uniqueGuardKey, GuardAuthenticatorIn $credentialsCanBeNull = true; } + if (null !== $this->logger) { + $this->logger->debug('Calling getCredentials() on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); + } + // allow the authenticator to fetch authentication info from the request $credentials = $guardAuthenticator->getCredentials($request);