Skip to content

Commit

Permalink
bug #683 add ChainUserProvider (Gemorroj)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x-dev branch.

Discussion
----------

add ChainUserProvider

Fixes #615
Fixes #754

Commits
-------

63b3941 add ChainUserProvider
  • Loading branch information
chalasr committed May 31, 2020
2 parents 1a110db + 63b3941 commit 8f539d9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Security/Guard/JWTTokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 8f539d9

Please sign in to comment.