Class DefaultOAuth2AuthorizationManagerFactory<T>
- Type Parameters:
T- the type of object that the authorization check is being done on
- All Implemented Interfaces:
OAuth2AuthorizationManagerFactory<T>
AuthorizationManager instances.- Since:
- 7.1
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultOAuth2AuthorizationManagerFactory(AuthorizationManagerFactory<T> authorizationManagerFactory) -
Method Summary
Modifier and TypeMethodDescriptionhasAllScopes(String... scopes) Create anAuthorizationManagerthat requires anAuthenticationto have all authoritiesSCOPE_scope1,SCOPE_scope2, ...hasAnyScope(String... scopes) Create anAuthorizationManagerthat requires anAuthenticationto have at least one authority amongSCOPE_scope1,SCOPE_scope2, ...voidsetScopePrefix(String scopePrefix) Sets the prefix used to create an authority name from a scope name.
-
Constructor Details
-
DefaultOAuth2AuthorizationManagerFactory
public DefaultOAuth2AuthorizationManagerFactory() -
DefaultOAuth2AuthorizationManagerFactory
public DefaultOAuth2AuthorizationManagerFactory(AuthorizationManagerFactory<T> authorizationManagerFactory)
-
-
Method Details
-
setScopePrefix
Sets the prefix used to create an authority name from a scope name. Can be an empty string.- Parameters:
scopePrefix- the scope prefix to use
-
hasScope
Description copied from interface:OAuth2AuthorizationManagerFactoryCreate 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").- Specified by:
hasScopein interfaceOAuth2AuthorizationManagerFactory<T>- Parameters:
scope- the scope value to require- Returns:
- an
AuthorizationManagerthat requires a"SCOPE_scope"authority
-
hasAnyScope
Description copied from interface:OAuth2AuthorizationManagerFactoryCreate 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").- Specified by:
hasAnyScopein interfaceOAuth2AuthorizationManagerFactory<T>- Parameters:
scopes- the scope values to allow- Returns:
- an
AuthorizationManagerthat requires at least one authority among"SCOPE_scope1",SCOPE_scope2, ...SCOPE_scopeN.
-
hasAllScopes
Description copied from interface:OAuth2AuthorizationManagerFactoryCreate 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").- Specified by:
hasAllScopesin interfaceOAuth2AuthorizationManagerFactory<T>- Parameters:
scopes- the scope values to require- Returns:
- an
AuthorizationManagerthat requires all authoritiesSCOPE_scope1,SCOPE_scope2, ...SCOPE_scopeN.
-