Skip to content

Document AUTHENTICATION_SUCCESS_SENSITIVE event #11334

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

Closed
wants to merge 3 commits into from
Closed
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
37 changes: 27 additions & 10 deletions components/security/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,17 @@ in) is correct, you can use::
Authentication Events
---------------------

The security component provides 4 related authentication events:

=============================== ================================================ ==============================================================================
Name Event Constant Argument Passed to the Listener
=============================== ================================================ ==============================================================================
security.authentication.success ``AuthenticationEvents::AUTHENTICATION_SUCCESS`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationEvent`
security.authentication.failure ``AuthenticationEvents::AUTHENTICATION_FAILURE`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent`
security.interactive_login ``SecurityEvents::INTERACTIVE_LOGIN`` :class:`Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent`
security.switch_user ``SecurityEvents::SWITCH_USER`` :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent`
=============================== ================================================ ==============================================================================
The security component provides the following authentication events:

========================================= ========================================================== ==============================================================================
Name Event Constant Argument Passed to the Listener
========================================= ========================================================== ==============================================================================
security.authentication.success_sensitive ``AuthenticationEvents::AUTHENTICATION_SUCCESS_SENSITIVE`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationSensitiveEvent`
security.authentication.success ``AuthenticationEvents::AUTHENTICATION_SUCCESS`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationSuccessEvent`
security.authentication.failure ``AuthenticationEvents::AUTHENTICATION_FAILURE`` :class:`Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent`
security.interactive_login ``SecurityEvents::INTERACTIVE_LOGIN`` :class:`Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent`
security.switch_user ``SecurityEvents::SWITCH_USER`` :class:`Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent`
========================================= ========================================================== ==============================================================================

Authentication Success and Failure Events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -298,6 +299,22 @@ a ``security.authentication.failure`` event is dispatched. You could listen on
the ``security.authentication.failure`` event, for example, in order to log
failed login attempts.

Authentication Sensitive Event
------------------------------

.. versionadded:: 4.3

The ``security.authentication.success_sensitive`` event was introduced in Symfony 4.3.

When a user is successfully authenticated, the security component will also
dispatch a ``security.authentication.success_sensitive`` event just before
erasing credentials and dispatching the regular success event. The event object
will contain the token used to authenticate, allowing you to act upon its
sensitive information.

A common use for this would be to check whether a user's password needs
rehashing to stay up to date with current encryption standards.

Security Events
~~~~~~~~~~~~~~~

Expand Down