Skip to content

Commit be0ad54

Browse files
committed
minor #17641 [Security] Prevent unneeded implementation of PasswordHasherAwareInterface when migrating passwords (MatTheCat)
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [Security] Prevent unneeded implementation of `PasswordHasherAwareInterface` when migrating passwords Trying to avoid issues like symfony/symfony#48348 or symfony/symfony#48825 Commits ------- 1d09493 [Security] Prevent unneeded implementation of `PasswordHasherAwareInterface` when migrating passwords
2 parents 666ee59 + 1d09493 commit be0ad54

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
@@ -123,7 +123,7 @@ Further in this article, you can find a
123123
.. configuration-block::
124124

125125
.. code-block:: yaml
126-
126+
127127
# config/packages/test/security.yaml
128128
security:
129129
# ...
@@ -533,8 +533,10 @@ migration by returning ``true`` in the ``needsRehash()`` method::
533533
}
534534
}
535535

536-
Named Password Hashers
537-
----------------------
536+
.. _named-password-hashers:
537+
538+
Dynamic Password Hashers
539+
------------------------
538540

539541
Usually, the same password hasher is used for all users by configuring it
540542
to apply to all instances of a specific class. Another option is to use a
@@ -635,6 +637,12 @@ the name of the hasher to use::
635637
}
636638
}
637639

640+
.. caution::
641+
642+
When :ref:`migrating passwords <security-password-migration>`, you don't need to implement ``PasswordHasherAwareInterface``
643+
to return the legacy hasher name:
644+
Symfony will detect it from your ``migrate_from`` configuration.
645+
638646
If you created your own password hasher implementing the
639647
:class:`Symfony\\Component\\PasswordHasher\\PasswordHasherInterface`,
640648
you must register a service for it in order to use it as a named hasher:

0 commit comments

Comments
 (0)