From a3bedbf0e130b92c52fdc6eccf3c5e7c21297751 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sat, 18 Feb 2023 17:41:45 +0100 Subject: [PATCH] Adding needsRehash() Page: https://symfony.com/doc/5.4/security/passwords.html#custom-password-hasher Adding this to comply with `PasswordHasherInterface` * I didn't check if this is really required in v5.4 already (but for sure in 6.2) --- security/passwords.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/security/passwords.rst b/security/passwords.rst index 2a2f7acc336..cdb4d09102e 100644 --- a/security/passwords.rst +++ b/security/passwords.rst @@ -830,6 +830,12 @@ If you need to create your own, it needs to follow these rules: return $passwordIsValid; } + + public function needsRehash(string $hashedPassword): bool + { + // Check if a password hash would benefit from rehashing + return $needsRehash; + } } Now, define a password hasher using the ``id`` setting: