Adding logging on this step and switching the order - not for any huge reason

This commit is contained in:
Ryan Weaver 2015-09-20 19:43:59 -04:00
parent 31f9caef00
commit c9d9430913

View File

@ -165,10 +165,6 @@ class GuardAuthenticationListener implements ListenerInterface
*/ */
private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null) private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null)
{ {
if (!$guardAuthenticator->supportsRememberMe()) {
return;
}
if (null === $this->rememberMeServices) { if (null === $this->rememberMeServices) {
if (null !== $this->logger) { if (null !== $this->logger) {
$this->logger->info('Remember me skipped: it is not configured for the firewall.', array('authenticator' => get_class($guardAuthenticator))); $this->logger->info('Remember me skipped: it is not configured for the firewall.', array('authenticator' => get_class($guardAuthenticator)));
@ -177,6 +173,14 @@ class GuardAuthenticationListener implements ListenerInterface
return; return;
} }
if (!$guardAuthenticator->supportsRememberMe()) {
if (null !== $this->logger) {
$this->logger->info('Remember me skipped: your authenticator does not support it.', array('authenticator' => get_class($guardAuthenticator)));
}
return;
}
if (!$response instanceof Response) { if (!$response instanceof Response) {
throw new \LogicException(sprintf( throw new \LogicException(sprintf(
'%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', '%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.',