-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Don't use oidc scopes_supported for scope as default in ClientRegistrations #8790
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
Closed
Closed
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 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
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
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
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.
Instead of removing this method, let's apply this logic:
if
metadata.getScopes()
containsopenid
thendefault to
openid
,profile
,email
else
default to
openid
This will ensure backwards compatibility when
CommonOAuth2Provider.GOOGLE
andCommonOAuth2Provider.OKTA
is used.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.
But for
CommonOAuth2Provider
the scopes are defined, and this is also tested inCommonOAuth2ProviderTests
so these stick withopenid
,profile
,email
. You are probaply mislead by the bad test-data naming inClientRegistrationsBeanDefinitionParserTests
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.
@jgrandja Did you get a chance to look at that remark?
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.
@martin-v Apologies, my last comment was not that clear.
Let's assume the user has configured this:
Google discovery endpoint returns
openid, profile, email
in thescopes_supported
parameter, which initializes theClientRegistration
with the 3 scopes.The changes in this PR would initialize the
ClientRegistration
with just theopenid
scope, which changes the runtime behaviour as the UserInfo endpoint would not be called byOidcUserService
as it doesn't contain at least one of the accessible scopes.The logic proposed in previous comment would preserve this behaviour. Furthermore, if the
openid
scope is returned inscopes_supported
then we know the provider supports OpenID Connect and the UserInfo endpoint so it makes sense to also default toprofile, email
to enable the UserInfo endpoint call.Makes sense?
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.
profile
,email
are optional scopes in openid-connect, see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaimsOne option is if the
profile
,email
is listed inscopes_supported
then we add these, but this still can cause the problem from #8514 (If it is listed in 'scopes_supported', this does not mean that it is supported for that particular client)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.
@jgrandja sry, didn't see it.
If we leave it empty we still have the problem mentioned in #8514 (comment) but we can't fix both issues.
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.
And I can do the change, if you still prefer the empty solution.
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.
@martin-v Regarding...
I realize that
openid
is a required scope for OIDC. However, as I mentioned in my previous commentPlease go ahead with the change on NOT assigning any defaults to
ClientRegistration.scope()
. This change will NOT be backported and will only go into the 5.4 release.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.
@martin-v 5.4.0 is being released Sep 2 and I need to get this change in. Are you able to update, as per my last comment, this week?
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.
Sorry, didn't notice your response. I will update the PR in a few minutes.