$this->hasherFactory =
$hasherFactory;
} public function hashPassword(PasswordAuthenticatedUserInterface
$user, #[\SensitiveParameter] string $plainPassword): string
{ $salt = null;
if ($user instanceof LegacyPasswordAuthenticatedUserInterface
) { $salt =
$user->
getSalt();
} $hasher =
$this->hasherFactory->
getPasswordHasher($user);
return $hasher->
hash($plainPassword,
$salt);
} public function isPasswordValid(PasswordAuthenticatedUserInterface
$user, #[\SensitiveParameter] string $plainPassword): bool
{ $salt = null;
if ($user instanceof LegacyPasswordAuthenticatedUserInterface
) { $salt =
$user->
getSalt();
}