vendor/lexik/jwt-authentication-bundle/Security/Authentication/Token/JWTUserToken.php line 62

Open in your IDE?
  1. <?php
  2. namespace Lexik\Bundle\JWTAuthenticationBundle\Security\Authentication\Token;
  3. use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
  6. /**
  7.  * JWTUserToken.
  8.  *
  9.  * @author Nicolas Cabot <n.cabot@lexik.fr>
  10.  */
  11. class JWTUserToken extends AbstractToken implements GuardTokenInterface
  12. {
  13.     /**
  14.      * @var string
  15.      */
  16.     protected $rawToken;
  17.     /**
  18.      * @var string
  19.      */
  20.     protected $providerKey;
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function __construct(array $roles = [], UserInterface $user null$rawToken null$firewallName null)
  25.     {
  26.         parent::__construct($roles);
  27.         if ($user) {
  28.             $this->setUser($user);
  29.         }
  30.         $this->setRawToken($rawToken);
  31.         $this->setAuthenticated(true);
  32.         $this->providerKey $firewallName;
  33.     }
  34.     /**
  35.      * @param string $rawToken
  36.      */
  37.     public function setRawToken($rawToken)
  38.     {
  39.         $this->rawToken $rawToken;
  40.     }
  41.     /**
  42.      * {@inheritdoc}
  43.      */
  44.     public function getCredentials()
  45.     {
  46.         return $this->rawToken;
  47.     }
  48.     /**
  49.      * @deprecated since 2.10, use getFirewallName() instead
  50.      */
  51.     public function getProviderKey()
  52.     {
  53.         @trigger_error(sprintf('The "%s" method is deprecated since version 2.10 and will be removed in 3.0. Use "%s::getFirewallName()" instead.'__METHOD__self::class), E_USER_DEPRECATED);
  54.         return $this->getFirewallName();
  55.     }
  56.     /**
  57.      * @return string
  58.      */
  59.     public function getFirewallName()
  60.     {
  61.         return $this->providerKey;
  62.     }
  63. }