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 @@ -355,10 +355,11 @@ command will generate a nice skeleton to get you started::
355
355
356
356
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
357
357
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
358
+ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
358
359
use Symfony\Component\Security\Core\User\UserInterface;
359
360
use Symfony\Component\Security\Core\User\UserProviderInterface;
360
361
361
- class UserProvider implements UserProviderInterface
362
+ class UserProvider implements UserProviderInterface, PasswordUpgraderInterface
362
363
{
363
364
/**
364
365
* Symfony calls this method if you use features like switch_user
@@ -411,6 +412,16 @@ command will generate a nice skeleton to get you started::
411
412
{
412
413
return User::class === $class;
413
414
}
415
+
416
+ /**
417
+ * Upgrades the encoded password of a user, typically for using a better hash algorithm.
418
+ */
419
+ public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
420
+ {
421
+ // TODO: when encoded passwords are in use, this method should:
422
+ // 1. persist the new password in the user storage
423
+ // 2. update the $user object with $user->setPassword($newEncodedPassword);
424
+ }
414
425
}
415
426
416
427
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