Skip to content

Commit 1d09493

Browse files
Mathieujaviereguiluz
Mathieu
authored andcommitted
[Security] Prevent unneeded implementation of PasswordHasherAwareInterface when migrating passwords
1 parent db74d6d commit 1d09493

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

security/passwords.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Further in this article, you can find a
134134
.. configuration-block::
135135

136136
.. code-block:: yaml
137-
137+
138138
# config/packages/test/security.yaml
139139
security:
140140
# ...
@@ -544,8 +544,10 @@ migration by returning ``true`` in the ``needsRehash()`` method::
544544
}
545545
}
546546

547-
Named Password Hashers
548-
----------------------
547+
.. _named-password-hashers:
548+
549+
Dynamic Password Hashers
550+
------------------------
549551

550552
Usually, the same password hasher is used for all users by configuring it
551553
to apply to all instances of a specific class. Another option is to use a
@@ -646,6 +648,12 @@ the name of the hasher to use::
646648
}
647649
}
648650

651+
.. caution::
652+
653+
When :ref:`migrating passwords <security-password-migration>`, you don't need to implement ``PasswordHasherAwareInterface``
654+
to return the legacy hasher name:
655+
Symfony will detect it from your ``migrate_from`` configuration.
656+
649657
If you created your own password hasher implementing the
650658
:class:`Symfony\\Component\\PasswordHasher\\PasswordHasherInterface`,
651659
you must register a service for it in order to use it as a named hasher:

0 commit comments

Comments
 (0)