Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ChainUserProvider #683

Merged
merged 1 commit into from
May 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Comment on lines +290 to +291

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CvekCoding good catch. Would you mind sending a PR or shall I do it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do this today.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chalasr when this fix can be released?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #766

return $provider->loadUserByUsernameAndPayload($identity, $payload);
}
}
}

return $userProvider->loadUserByUsername($identity);
}
}