I've got some issues with Symfony security, on the login method.
I create authentication by 3rd party system (I stored info about token from an external system associated with the user in my database), on success, I just select user data from database and authenticate by
return $guardHandler->authenticateUserAndHandleSuccess(
$user,
$request,
$formAuthenticator,
'main'
);
But, I want to set remember_me
by default on this method of authorization.
I set in security.yml
main:
anonymous: true
lazy: true
provider: app_user_provider
switch_user: true
remember_me:
secret: '%kernel.secret%'
lifetime: 2592000
always_remember_me: true
But it works only with a normal login form, not when I use authenticateUserAndHandleSuccess
method.
How can I set remember_me
cookie by default in this case?
From the code source it's documented :
/**
* Does this method support remember me cookies?
*
* Remember me cookie will be set if *all* of the following are met:
* A) This method returns true
* B) The remember_me key under your firewall is configured
* C) The "remember me" functionality is activated. This is usually
* done by having a _remember_me checkbox in your form, but
* can be configured by the "always_remember_me" and "remember_me_parameter"
* parameters under the "remember_me" firewall key
* D) The onAuthenticationSuccess method returns a Response object
*
* @return bool
*/
public function supportsRememberMe();
Are all of thoses requirements met ?