-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancementA general enhancement
Milestone
Description
AuthorizationManager
makes the following possible in the DSL:
http
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(hasRole("USER"))
)
It would be nice to be able to do the same with scopes, like so:
http
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(hasScope("resource:read"))
)
This could be done in a static factory class like OAuth2AuthorizationManagers
in oauth2-core
. It could have hasScope
and hasAnyScope
. They might be implemented by delegating to AuthorityAuthorizationManager
like this:
public static <T> AuthorityAuthorizationManager<T> hasScope(String scope) {
return AuthorityAuthorizationManager.hasAuthority("SCOPE_" + scope);
}
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancementA general enhancement