Security/Guard/JWTTokenAuthenticator.php
public function getUser($preAuthToken, UserProviderInterface $userProvider)
    {
        if (!$preAuthToken instanceof PreAuthenticationJWTUserToken) {
            throw new \InvalidArgumentException(
                sprintf('The first argument of the "%s()" method must be an instance of "%s".', __METHOD__, PreAuthenticationJWTUserToken::class)
            );
        }

        $payload = $preAuthToken->getPayload();
        $idClaim = $this->jwtManager->getUserIdClaim();


        if (!isset($payload[$idClaim])) {
            throw new InvalidPayloadException($idClaim);
        }

        $identity = $payload[$idClaim];

        try {
            $user = $this->loadUser($userProvider, $payload, $identity);
        } catch (UsernameNotFoundException $e) {
            throw new UserNotFoundException($idClaim, $identity);
        }

        $this->preAuthenticationTokenStorage->setToken($preAuthToken);

        return $user;
    }
public function getUser($preAuthToken, UserProviderInterface $userProvider)
    {
        if (!$preAuthToken instanceof PreAuthenticationJWTUserToken) {
            throw new \InvalidArgumentException(
                sprintf('The first argument of the "%s()" method must be an instance of "%s".', __METHOD__, PreAuthenticationJWTUserToken::class)
            );
        }

        $payload = $preAuthToken->getPayload();
        $idClaim = $this->jwtManager->getUserIdClaim();


        if (!isset($payload[$idClaim])) {
            throw new InvalidPayloadException($idClaim);
        }

        $identity = $payload[$idClaim];

        try {
            $user = $this->loadUser($userProvider, $payload, $identity);
        } catch (UsernameNotFoundException $e) {
            throw new UserNotFoundException($idClaim, $identity);
        }

        $this->preAuthenticationTokenStorage->setToken($preAuthToken);

        return $user;
    }
public function getUser ( $ preAuthToken , UserProviderInterface $ userProvider ) { if ( ! $ preAuthToken instanceof PreAuthenticationJWTUserToken ) { throw new \ InvalidArgumentException ( sprintf ( 'The first argument of the "%s()" method must be an instance of "%s".' , __METHOD__ , PreAuthenticationJWTUserToken :: class ) ) ; } $ payload = $ preAuthToken -> getPayload ( ) ; $ idClaim = $ this -> jwtManager -> getUserIdClaim ( ) ; if ( ! isset ( $ payload [ $ idClaim ] ) ) { throw new InvalidPayloadException ( $ idClaim ) ; } $ identity = $ payload [ $ idClaim ] ; try { $ user = $ this -> loadUser ( $ userProvider , $ payload , $ identity ) ; } catch ( UsernameNotFoundException $ e ) { throw new UserNotFoundException ( $ idClaim , $ identity ) ; } $ this -> preAuthenticationTokenStorage -> setToken ( $ preAuthToken ) ; return $ user ; }
Returns an user object loaded from a JWT token.

{@inheritdoc}

@param PreAuthenticationJWTUserToken Implementation of the (Security) TokenInterface

@throws \InvalidArgumentException If preAuthToken is not of the good type
@throws InvalidPayloadException   If the user identity field is not a key of the payload
@throws UserNotFoundException     If no user can be loaded from the given token
Returns an user object loaded from a JWT token .