-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Consider a lenient scope validation strategy in OAuth2ClientCredentialsAuthenticationProvider #884
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
Comments
Section 3.2.2.1 Access Token Scope states the following:
Based on this, we'll consider a more lenient validation strategy. |
We should consider adding The "authentication validator" feature exists in |
I want to take this issue, @jgrandja I have a question. When a token request includes scopes that part of them aren't permitted and a custom lenient scope validation is used, |
Thanks for your interest @appchemist. As soon as this issue is scheduled for a milestone, I'll reach out to you. We'll be planning the features for the |
I'd like to upvote this request, we have a use case similar to this one with prefix scopes that we'd like to support and it would be relatively simple with a more lenient or configurable scope validation strategy. At the moment we're having to create quite an unpleasant workaround. I think a configurable strategy would be preferable |
@adamleantech Please upvote the main issue comment. |
This is now resolved via gh-1377. The default scope validation can now be customized using |
Expected Behavior
When a token request includes scopes that part of them aren't permitted, return the new token with only the permitted scopes
Current Behavior
When a token request includes scopes that part of them aren't permitted, it raises an internal exception, and the request answer is 400:
{ "error": "invalid_scope" }
Context
It's not a rare scenario that permissions of clients are changed and the clients themselves are not always updated immediately (or at all). It makes sense to generate the token with the scopes it allowed instead of failing the request.
The relevant code is in the OAuth2ClientCredentialsAuthenticationProvider.java
for (String requestedScope : clientCredentialsAuthentication.getScopes()) { if (!registeredClient.getScopes().contains(requestedScope)) { throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_SCOPE); } }
The text was updated successfully, but these errors were encountered: