vendor/symfony/security-guard/Token/PreAuthenticationGuardToken.php line 16

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\Guard\Token;
  11. use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
  12. trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PreAuthenticationGuardToken::class);
  13. /**
  14. * The token used by the guard auth system before authentication.
  15. *
  16. * The GuardAuthenticationListener creates this, which is then consumed
  17. * immediately by the GuardAuthenticationProvider. If authentication is
  18. * successful, a different authenticated token is returned
  19. *
  20. * @author Ryan Weaver <[email protected]>
  21. *
  22. * @deprecated since Symfony 5.3, use the new authenticator system instead
  23. */
  24. class PreAuthenticationGuardToken extends AbstractToken implements GuardTokenInterface
  25. {
  26. private $credentials;
  27. private $guardProviderKey;
  28. /**
  29. * @param mixed $credentials
  30. * @param string $guardProviderKey Unique key that bind this token to a specific AuthenticatorInterface
  31. */
  32. public function __construct($credentials, string $guardProviderKey)
  33. {
  34. $this->credentials = $credentials;
  35. $this->guardProviderKey = $guardProviderKey;
  36. parent::__construct([]);
  37. // @deprecated since Symfony 5.4
  38. parent::setAuthenticated(false);
  39. }
  40. public function getGuardProviderKey()
  41. {
  42. return $this->guardProviderKey;
  43. }
  44. /**
  45. * Returns the user credentials, which might be an array of anything you
  46. * wanted to put in there (e.g. username, password, favoriteColor).
  47. *
  48. * @return mixed
  49. */
  50. public function getCredentials()
  51. {
  52. return $this->credentials;
  53. }
  54. /**
  55. * @deprecated since Symfony 5.4
  56. */
  57. public function setAuthenticated(bool $authenticated)
  58. {
  59. throw new \LogicException('The PreAuthenticationGuardToken is *never* authenticated.');
  60. }
  61. }