diff --git a/security.rst b/security.rst index 54a0f56c9e6..dda562d4434 100644 --- a/security.rst +++ b/security.rst @@ -1710,6 +1710,7 @@ You can log in a user programmatically using the ``login()`` method of the use App\Security\Authenticator\ExampleAuthenticator; use Symfony\Bundle\SecurityBundle\Security; + use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; class SecurityController { @@ -1727,9 +1728,12 @@ You can log in a user programmatically using the ``login()`` method of the // ...or the service id of custom authenticators $security->login($user, ExampleAuthenticator::class); - // you can also log in on a different firewall + // you can also log in on a different firewall... $security->login($user, 'form_login', 'other_firewall'); + // ...and add badges + $security->login($user, 'form_login', 'other_firewall', [(new RememberMeBadge())->enable()]); + // use the redirection logic applied to regular login $redirectResponse = $security->login($user); return $redirectResponse; @@ -1743,6 +1747,10 @@ You can log in a user programmatically using the ``login()`` method of the The feature to use a custom redirection logic was introduced in Symfony 6.3. +.. versionadded:: 6.4 + + The feature to add badges was introduced in Symfony 6.4. + .. _security-logging-out: Logging Out