File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -356,10 +356,11 @@ command will generate a nice skeleton to get you started::
356
356
357
357
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
358
358
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
359
+ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
359
360
use Symfony\Component\Security\Core\User\UserInterface;
360
361
use Symfony\Component\Security\Core\User\UserProviderInterface;
361
362
362
- class UserProvider implements UserProviderInterface
363
+ class UserProvider implements UserProviderInterface, PasswordUpgraderInterface
363
364
{
364
365
/**
365
366
* Symfony calls this method if you use features like switch_user
@@ -412,6 +413,16 @@ command will generate a nice skeleton to get you started::
412
413
{
413
414
return User::class === $class || is_subclass_of($class, User::class);
414
415
}
416
+
417
+ /**
418
+ * Upgrades the encoded password of a user, typically for using a better hash algorithm.
419
+ */
420
+ public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
421
+ {
422
+ // TODO: when encoded passwords are in use, this method should:
423
+ // 1. persist the new password in the user storage
424
+ // 2. update the $user object with $user->setPassword($newEncodedPassword);
425
+ }
415
426
}
416
427
417
428
Most of the work is already done! Read the comments in the code and update the
You can’t perform that action at this time.
0 commit comments