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

[FEATURE] retrieving resource owner from JWT if no oidcEndpointUserInfo is set #127

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bastiand-12
Copy link

i have to deal with a keycloak provider which doesn't provide an "oidcEndpointUserInfo".
Therefor the resourceOwner Info is provided via the access Token in a so called JSON Web Token.
with this PR i have changed the getUserFromAccessToken() with a few LOCs to handle this.

return false;
}
} else {
$this->logger->debug('UserInfo Endpoint is not set, retrie resource owner form JSON Web Token');
Copy link
Owner

Choose a reason for hiding this comment

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

retrieVE resource owner fROm

} else {
$this->logger->debug('UserInfo Endpoint is not set, retrie resource owner form JSON Web Token');
$jwt = $accessToken->getToken();
$jwtDecoded = base64_decode(str_replace('_', '/', str_replace('-','+',explode('.', $jwt)[1])));
Copy link
Owner

Choose a reason for hiding this comment

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

missing blank spaces on that line between some arguments.

@bastiand-12
Copy link
Author

fixed?

@liayn
Copy link
Collaborator

liayn commented Mar 6, 2024

Does this provider conform to standards? Is it allowed to provide the user info via JWT by standards?

@bastiand-12
Copy link
Author

from [1]:
They can be requested to be returned either in the UserInfo Response, per Section 5.3.2, or in the ID Token, per Section 2.

[1] https://openid.net/specs/openid-connect-core-1_0.html#Claims

@liayn
Copy link
Collaborator

liayn commented Mar 15, 2024

Thanks @bastiand-12
Wasn't aware of that.

Also Microsoft is following this approach with their Entra Services.
The implementation for this is covered in a dedicated provider though (https://github.com/thenetworg/oauth2-azure).

Still I'd love to see this covered in the extension here as well.

@bastiand-12
Copy link
Author

yes, there are only a few loc's and in my case it works since Sep 2023 without any problems.
I would be happy if the piece of code was included.

@liayn liayn changed the title [Feature] retrieving resource owner form JSON Web Token if no oidcEndpointUserInfo is set [Feature] retrieving resource owner from JWT if no oidcEndpointUserInfo is set May 3, 2024
@liayn liayn changed the title [Feature] retrieving resource owner from JWT if no oidcEndpointUserInfo is set [FEATURE] retrieving resource owner from JWT if no oidcEndpointUserInfo is set May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants