Interface OAuth2AuthorizationManagerFactory<T>

Type Parameters:
T - the type of object that the authorization check is being done on
All Known Implementing Classes:
DefaultOAuth2AuthorizationManagerFactory

public interface OAuth2AuthorizationManagerFactory<T>
A factory for creating different kinds of AuthorizationManager instances.
Since:
7.1
  • Method Details

    • hasScope

      default AuthorizationManager<T> hasScope(String scope)
      Create an AuthorizationManager that requires an Authentication to have a SCOPE_scope authority.

      For example, if you call hasScope("read"), then this will require that each authentication have a GrantedAuthority whose value is SCOPE_read.

      This would equivalent to calling AuthorityAuthorizationManager#hasAuthority("SCOPE_read").

      Parameters:
      scope - the scope value to require
      Returns:
      an AuthorizationManager that requires a "SCOPE_scope" authority
    • hasAnyScope

      default AuthorizationManager<T> hasAnyScope(String... scopes)
      Create an AuthorizationManager that requires an Authentication to have at least one authority among SCOPE_scope1, SCOPE_scope2, ... SCOPE_scopeN.

      For example, if you call hasAnyScope("read", "write"), then this will require that each authentication have at least a GrantedAuthority whose value is either SCOPE_read or SCOPE_write.

      This would equivalent to calling AuthorityAuthorizationManager#hasAnyAuthority("SCOPE_read", "SCOPE_write").

      Parameters:
      scopes - the scope values to allow
      Returns:
      an AuthorizationManager that requires at least one authority among "SCOPE_scope1", SCOPE_scope2, ... SCOPE_scopeN.
    • hasAllScopes

      default AuthorizationManager<T> hasAllScopes(String... scopes)
      Create an AuthorizationManager that requires an Authentication to have all authorities SCOPE_scope1, SCOPE_scope2, ... SCOPE_scopeN.

      For example, if you call hasAllScopes("read", "write"), then each Authentication must have all GrantedAuthority values of SCOPE_read and SCOPE_write.

      This would be equivalent to calling AllAuthoritiesAuthorizationManager#hasAllAuthorities("SCOPE_read", "SCOPE_write").

      Parameters:
      scopes - the scope values to require
      Returns:
      an AuthorizationManager that requires all authorities SCOPE_scope1, SCOPE_scope2, ... SCOPE_scopeN.