Class OAuth2AuthorizationManagers
AuthorizationManagers.- Since:
- 6.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> AuthorizationManager<T> hasAllScopes(String... scopes) Create anAuthorizationManagerthat requires anAuthenticationto have all authoritiesSCOPE_scope1,SCOPE_scope2, ...static <T> AuthorizationManager<T> hasAnyScope(String... scopes) Create anAuthorizationManagerthat requires anAuthenticationto have at least one authority amongSCOPE_scope1,SCOPE_scope2, ...static <T> AuthorizationManager<T>
-
Method Details
-
hasScope
Create anAuthorizationManagerthat requires anAuthenticationto have aSCOPE_scopeauthority.For example, if you call
hasScope("read"), then this will require that each authentication have aGrantedAuthoritywhose value isSCOPE_read.This would equivalent to calling
AuthorityAuthorizationManager#hasAuthority("SCOPE_read").- Type Parameters:
T- the secure object- Parameters:
scope- the scope value to require- Returns:
- an
AuthorizationManagerthat requires a"SCOPE_scope"authority
-
hasAnyScope
Create anAuthorizationManagerthat requires anAuthenticationto have at least one authority amongSCOPE_scope1,SCOPE_scope2, ...SCOPE_scopeN.For example, if you call
hasAnyScope("read", "write"), then this will require that each authentication have at least aGrantedAuthoritywhose value is eitherSCOPE_readorSCOPE_write.This would equivalent to calling
AuthorityAuthorizationManager#hasAnyAuthority("SCOPE_read", "SCOPE_write").- Type Parameters:
T- the secure object- Parameters:
scopes- the scope values to allow- Returns:
- an
AuthorizationManagerthat requires at least one authority among"SCOPE_scope1",SCOPE_scope2, ...SCOPE_scopeN.
-
hasAllScopes
Create anAuthorizationManagerthat requires anAuthenticationto have all authoritiesSCOPE_scope1,SCOPE_scope2, ...SCOPE_scopeN.For example, if you call
hasAllScopes("read", "write"), then eachAuthenticationmust have allGrantedAuthorityvalues ofSCOPE_readandSCOPE_write.This would be equivalent to calling
AllAuthoritiesAuthorizationManager#hasAllAuthorities("SCOPE_read", "SCOPE_write").- Parameters:
scopes- the scope values to require- Returns:
- an
AuthorizationManagerthat requires all authoritiesSCOPE_scope1,SCOPE_scope2, ...SCOPE_scopeN. - Since:
- 7.1
-