Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand All @@ -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
Expand Down