UserPasswordEncoderInterface.php 1020 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Core\Encoder;
  11. use Symfony\Component\Security\Core\User\UserInterface;
  12. /**
  13. * UserPasswordEncoderInterface is the interface for the password encoder service.
  14. *
  15. * @author Ariel Ferrandini <arielferrandini@gmail.com>
  16. */
  17. interface UserPasswordEncoderInterface
  18. {
  19. /**
  20. * Encodes the plain password.
  21. *
  22. * @return string The encoded password
  23. */
  24. public function encodePassword(UserInterface $user, string $plainPassword);
  25. /**
  26. * @return bool true if the password is valid, false otherwise
  27. */
  28. public function isPasswordValid(UserInterface $user, string $raw);
  29. /**
  30. * Checks if an encoded password would benefit from rehashing.
  31. */
  32. public function needsRehash(UserInterface $user): bool;
  33. }