vendor/symfony/security-core/Encoder/PasswordEncoderInterface.php line 17

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <[email protected]>
  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\PasswordHasher\PasswordHasherInterface;
  12. use Symfony\Component\Security\Core\Exception\BadCredentialsException;
  13. trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', PasswordEncoderInterface::class, PasswordHasherInterface::class);
  14. /**
  15. * PasswordEncoderInterface is the interface for all encoders.
  16. *
  17. * @author Fabien Potencier <[email protected]>
  18. *
  19. * @deprecated since Symfony 5.3, use {@link PasswordHasherInterface} instead
  20. */
  21. interface PasswordEncoderInterface
  22. {
  23. /**
  24. * Encodes the raw password.
  25. *
  26. * @return string
  27. *
  28. * @throws BadCredentialsException If the raw password is invalid, e.g. excessively long
  29. * @throws \InvalidArgumentException If the salt is invalid
  30. */
  31. public function encodePassword(string $raw, ?string $salt);
  32. /**
  33. * Checks a raw password against an encoded password.
  34. *
  35. * @param string $encoded An encoded password
  36. * @param string $raw A raw password
  37. * @param string|null $salt The salt
  38. *
  39. * @return bool
  40. *
  41. * @throws \InvalidArgumentException If the salt is invalid
  42. */
  43. public function isPasswordValid(string $encoded, string $raw, ?string $salt);
  44. /**
  45. * Checks if an encoded password would benefit from rehashing.
  46. */
  47. public function needsRehash(string $encoded): bool;
  48. }