feat: Allow calling of the UserInfo endpoint to be configurable#172
Open
petewalker wants to merge 1 commit intoomniauth:masterfrom
Open
feat: Allow calling of the UserInfo endpoint to be configurable#172petewalker wants to merge 1 commit intoomniauth:masterfrom
petewalker wants to merge 1 commit intoomniauth:masterfrom
Conversation
Allows the calling of the userinfo endpoint to be configurable, resolving omniauth#145
Author
|
@stanhu @bufferoverflow - Would it be possible to get some feedback on this? |
bufferoverflow
requested changes
Jan 29, 2024
Comment on lines
260
to
270
| if access_token.id_token | ||
| decoded = decode_id_token(access_token.id_token).raw_attributes | ||
| merge_with = JSON::JWS.new({}) | ||
| merge_with = access_token.userinfo!.raw_attributes if options.call_userinfo_endpoint | ||
|
|
||
| @user_info = ::OpenIDConnect::ResponseObject::UserInfo.new access_token.userinfo!.raw_attributes.merge(decoded) | ||
| else | ||
| @user_info = ::OpenIDConnect::ResponseObject::UserInfo.new merge_with.merge(decoded) | ||
| elsif options.call_userinfo_endpoint | ||
| @user_info = access_token.userinfo! | ||
| else | ||
| @user_info = ::OpenIDConnect::ResponseObject::UserInfo.new | ||
| end |
Member
There was a problem hiding this comment.
I suggest to keep the default case as is and put this extra handling into elsif !options.call_userinfo_endpoint and a test case would be great.
stanhu
reviewed
Jun 27, 2024
|
|
||
| if access_token.id_token | ||
| decoded = decode_id_token(access_token.id_token).raw_attributes | ||
| merge_with = JSON::JWS.new({}) |
Contributor
There was a problem hiding this comment.
As far as I can tell, ::OpenIDConnect::ResponseObject::UserInfo.new works on a regular Hash; what's the deal with using JSON::JWS?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows the calling of the UserInfo endpoint to be configurable.
As mentioned in #148, ADFS does not support the
emailorprofileclaims, and calling the UserInfo endpoint is pointless, as it only returns the subject.As the UserInfo endpoint is not required, this PR adds a new config item -
call_userinfo_endpoint(defaulttrue), which allows the skipping of this endpoint.Resolves #145