Class OAuth2ProtectedResourceMetadata.Builder
java.lang.Object
org.springframework.security.oauth2.server.resource.OAuth2ProtectedResourceMetadata.Builder
- Enclosing class:
- OAuth2ProtectedResourceMetadata
Helps configure an
OAuth2ProtectedResourceMetadata.-
Method Summary
Modifier and TypeMethodDescriptionauthorizationServer(String authorizationServer) Add the issuer identifier for an authorization server, OPTIONAL.authorizationServers(Consumer<List<String>> authorizationServersConsumer) AConsumerof the issuer identifier values for the authorization servers, allowing the ability to add, replace, or remove, OPTIONAL.bearerMethod(String bearerMethod) Add a supported method for sending an OAuth 2.0 bearer token to the protected resource, OPTIONAL.bearerMethods(Consumer<List<String>> bearerMethodsConsumer) AConsumerof the supported methods for sending an OAuth 2.0 bearer token to the protected resource, allowing the ability to add, replace, or remove, OPTIONAL.build()Validate the claims and build theOAuth2ProtectedResourceMetadata.Sets the claim.Provides access to everyclaim(String, Object)declared so far allowing the ability to add, replace, or remove.Sets the resource identifier for the protected resource, REQUIRED.resourceName(String resourceName) Sets the name of the protected resource intended for display to the end user, RECOMMENDED.Add ascopesupported in authorization requests to the protected resource, RECOMMENDED.AConsumerof thescopevalues supported in authorization requests to the protected resource, allowing the ability to add, replace, or remove, RECOMMENDED.tlsClientCertificateBoundAccessTokens(boolean tlsClientCertificateBoundAccessTokens) Set totrueto indicate protected resource support for mutual-TLS client certificate-bound access tokens, OPTIONAL.
-
Method Details
-
resource
Sets the resource identifier for the protected resource, REQUIRED.- Parameters:
resource- the resource identifierURLfor the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
authorizationServer
Add the issuer identifier for an authorization server, OPTIONAL.- Parameters:
authorizationServer- the issuer identifierURLfor an authorization server- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
authorizationServers
public OAuth2ProtectedResourceMetadata.Builder authorizationServers(Consumer<List<String>> authorizationServersConsumer) AConsumerof the issuer identifier values for the authorization servers, allowing the ability to add, replace, or remove, OPTIONAL.- Parameters:
authorizationServersConsumer- aConsumerof the issuer identifier values for the authorization servers- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
scope
Add ascopesupported in authorization requests to the protected resource, RECOMMENDED.- Parameters:
scope- ascopesupported in authorization requests to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
scopes
AConsumerof thescopevalues supported in authorization requests to the protected resource, allowing the ability to add, replace, or remove, RECOMMENDED.- Parameters:
scopesConsumer- aConsumerof thescopevalues supported in authorization requests to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
bearerMethod
Add a supported method for sending an OAuth 2.0 bearer token to the protected resource, OPTIONAL. Defined values are "header", "body" and "query".- Parameters:
bearerMethod- a supported method for sending an OAuth 2.0 bearer token to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
bearerMethods
public OAuth2ProtectedResourceMetadata.Builder bearerMethods(Consumer<List<String>> bearerMethodsConsumer) AConsumerof the supported methods for sending an OAuth 2.0 bearer token to the protected resource, allowing the ability to add, replace, or remove, OPTIONAL.- Parameters:
bearerMethodsConsumer- aConsumerof the supported methods for sending an OAuth 2.0 bearer token to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
resourceName
Sets the name of the protected resource intended for display to the end user, RECOMMENDED.- Parameters:
resourceName- the name of the protected resource intended for display to the end user- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
tlsClientCertificateBoundAccessTokens
public OAuth2ProtectedResourceMetadata.Builder tlsClientCertificateBoundAccessTokens(boolean tlsClientCertificateBoundAccessTokens) Set totrueto indicate protected resource support for mutual-TLS client certificate-bound access tokens, OPTIONAL.- Parameters:
tlsClientCertificateBoundAccessTokens-trueto indicate protected resource support for mutual-TLS client certificate-bound access tokens- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
claim
Sets the claim.- Parameters:
name- the claim namevalue- the claim value- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configuration
-
claims
Provides access to everyclaim(String, Object)declared so far allowing the ability to add, replace, or remove.- Parameters:
claimsConsumer- aConsumerof the claims- Returns:
- the
OAuth2ProtectedResourceMetadata.Builderfor further configurations
-
build
Validate the claims and build theOAuth2ProtectedResourceMetadata.- Returns:
- the
OAuth2ProtectedResourceMetadata
-