File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1710,6 +1710,7 @@ You can log in a user programmatically using the ``login()`` method of the
17101710
17111711 use App\Security\Authenticator\ExampleAuthenticator;
17121712 use Symfony\Bundle\SecurityBundle\Security;
1713+ use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
17131714
17141715 class SecurityController
17151716 {
@@ -1727,9 +1728,12 @@ You can log in a user programmatically using the ``login()`` method of the
17271728 // ...or the service id of custom authenticators
17281729 $security->login($user, ExampleAuthenticator::class);
17291730
1730- // you can also log in on a different firewall
1731+ // you can also log in on a different firewall...
17311732 $security->login($user, 'form_login', 'other_firewall');
17321733
1734+ // ...and add badges
1735+ $security->login($user, 'form_login', 'other_firewall', [(new RememberMeBadge())->enable()]);
1736+
17331737 // use the redirection logic applied to regular login
17341738 $redirectResponse = $security->login($user);
17351739 return $redirectResponse;
@@ -1743,6 +1747,10 @@ You can log in a user programmatically using the ``login()`` method of the
17431747
17441748 The feature to use a custom redirection logic was introduced in Symfony 6.3.
17451749
1750+ .. versionadded :: 6.4
1751+
1752+ The feature to add badges was introduced in Symfony 6.4.
1753+
17461754.. _security-logging-out :
17471755
17481756Logging Out
You can’t perform that action at this time.
0 commit comments