Skip to content

[Security] Reword impersonnating event description #19448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
11 changes: 8 additions & 3 deletions security/impersonating_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,14 @@ not this is allowed. If your voter isn't called, see :ref:`declaring-the-voter-a
Events
------

The firewall dispatches the ``security.switch_user`` event right after the impersonation
is completed. The :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent` is
passed to the listener, and you can use this to get the user that you are now impersonating.
Just before the impersonation is fully completed, the ``security.switch_user`` event is
dispatched.
The :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent` is
passed to the :doc:`listener or subscriber </event_dispatcher>`, and you can use
this to get the user that you are now impersonating.

This event is also dispatched just before impersonation is fully exited. You can
use it to get the original impersonator user.

The :ref:`locale-sticky-session` section does not update the locale when you
impersonate a user. If you *do* want to be sure to update the locale when you
Expand Down