-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 User & Groups to Userinfo #850
Merged
JoelSpeed
merged 2 commits into
oauth2-proxy:master
from
grnhse:is-834-userinfo-expansion
Nov 27, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For our ORG Groups are part of userInfo Endpoint .. Could you pls handle the Groups claim from UserInfo endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
session.Groups
is populated from thegroups
claim in the IDToken in the OIDC Provider (other Providers can populate asession.Groups
how they see fit as well e.g. calling a a provider Userinfo endpoint inEnrichSessionState
to get more data for the session).Using the
session
to populate theuserinfo
endpoint is the most provider agnostic way to get data uniformly across all providers.What were you thinking is potentially missing that you needed with this implementation? I think if you are looking for anything extra dynamic from an IdP
userinfo
endpoint that logic belongs in the Provider implemented inEnrichSessionState
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adapted this function to get the grops claims, Correct me If I am missing anything.
`
// userID cand Groups claim was not present or was empty in the ID Token
if claims.UserID == "" || len(claims.Groups) == 0 {
// BearerToken case, allow empty UserID
// ProfileURL checks below won't work since we don't have an access token
if token == nil {
claims.UserID = claims.Subject
}
}
`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I follow! In the
profileURL
where there is fallbackemail
fetching logic if it isn't in aclaim
, your IdP provides access to the groups as well?That would be a very good addition to the OIDC Provider groups support; I like it.
It is out of scope from this PR -- can you make this into its own PR so we can discuss this issue specifically and work out the best implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NickMeves Sure ..Thank you so much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked it up on mine (OneLogin), it includes it too 😄
So yours doesn't include the
groups
claim in the IDToken (which I guess makes since you mentioned they give you errors if you ask for thegroups
scope). But they have that data available on theprofileURL
?Which OIDC IdP is this? I'm curious about that split and how many other users might be affected by that behavior with their OIDC IdP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you are feeling adventurous -- I made this Issue for a refactor I noticed this needs after looking at your sample code above: #883