Description
Symfony version(s) affected: 4.4.0
Description
I am developing a site using Symfony 4 and I noticed that remember me functionality is not working (the cookie is not set at all). I followed this tutorial:
https://symfony.com/doc/4.4/security/remember_me.html
Please see this post for all my configuration settings:
Essentially the remember me is not triggered at all:
// success!
$response = $this->guardHandler->handleAuthenticationSuccess($token, $request, $guardAuthenticator, $this->providerKey);
if ($response instanceof Response) {
if (null !== $this->logger) {
$this->logger->debug('Guard authenticator set success response.', ['response' => $response, 'authenticator' => \get_class($guardAuthenticator)]);
}
$event->setResponse($response); // <-- this is where the esecution STOPs
} else {
if (null !== $this->logger) {
$this->logger->debug('Guard authenticator set no success response: request continues.', ['authenticator' => \get_class($guardAuthenticator)]);
}
}
// --> This line is NEVER CALLED
// attempt to trigger the remember me functionality
$this->triggerRememberMe($guardAuthenticator, $request, $token, $response);
// <-- This line is NEVER CALLED
Debugging into setResponse
I saw that it's throwing a LazyResponseException
and so the next line is never reached.
How to reproduce
Follow the remember me tutorial and set up a GuardAuthenticationListener
.
Possible Solution
Maybe the triggerRememberMe
should be called earlier?
Additional context
Please review the following StackOverflow post where you can find all the relevant classes and configurations:
Thanks.