8000 [Security] Do not make PasswordUpgraderInterface a generic by wouterj · Pull Request #51283 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Do not make PasswordUpgraderInterface a generic #51283

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

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
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
[Security] Do not make PasswordUpgraderInterface a generic
  • Loading branch information
wouterj committed Aug 5, 2023
commit d473b909e8a77a2bb03c94a4f6564f2e020f09e7
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function upgradePassword(PasswordAuthenticatedUserInterface $user, string
}

$repository = $this->getRepository();
if ($repository instanceof PasswordUpgraderInterface) {
if ($user instanceof PasswordAuthenticatedUserInterface && $repository instanceof PasswordUpgraderInterface) {
$repository->upgradePassword($user, $newHashedPassword);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @template TUser of PasswordAuthenticatedUserInterface
*/
interface PasswordUpgraderInterface
{
Expand All @@ -24,8 +22,6 @@ interface PasswordUpgraderInterface
* This method should persist the new password in the user storage and update the $user object accordingly.
* Because you don't want your users not being able to log in, this method should be opportunistic:
* it's fine if it does nothing or if it fails without throwing any exception.
*
* @param TUser $user
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void;
}
0