diff --git a/Security/Guard/JWTTokenAuthenticator.php b/Security/Guard/JWTTokenAuthenticator.php index dd6895a5..3862b41d 100644 --- a/Security/Guard/JWTTokenAuthenticator.php +++ b/Security/Guard/JWTTokenAuthenticator.php @@ -27,6 +27,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Core\User\ChainUserProvider; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; @@ -285,6 +286,14 @@ protected function loadUser(UserProviderInterface $userProvider, array $payload, return $userProvider->loadUserByUsernameAndPayload($identity, $payload); } + if ($userProvider instanceof ChainUserProvider) { + foreach ($userProvider->getProviders() as $provider) { + if ($provider instanceof PayloadAwareUserProviderInterface) { + return $provider->loadUserByUsernameAndPayload($identity, $payload); + } + } + } + return $userProvider->loadUserByUsername($identity); } }