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) AConsumer
of 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) AConsumer
of 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 ascope
supported in authorization requests to the protected resource, RECOMMENDED.AConsumer
of thescope
values supported in authorization requests to the protected resource, allowing the ability to add, replace, or remove, RECOMMENDED.tlsClientCertificateBoundAccessTokens
(boolean tlsClientCertificateBoundAccessTokens) Set totrue
to 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 identifierURL
for the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
authorizationServer
Add the issuer identifier for an authorization server, OPTIONAL.- Parameters:
authorizationServer
- the issuer identifierURL
for an authorization server- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
authorizationServers
public OAuth2ProtectedResourceMetadata.Builder authorizationServers(Consumer<List<String>> authorizationServersConsumer) AConsumer
of the issuer identifier values for the authorization servers, allowing the ability to add, replace, or remove, OPTIONAL.- Parameters:
authorizationServersConsumer
- aConsumer
of the issuer identifier values for the authorization servers- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
scope
Add ascope
supported in authorization requests to the protected resource, RECOMMENDED.- Parameters:
scope
- ascope
supported in authorization requests to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
scopes
AConsumer
of thescope
values supported in authorization requests to the protected resource, allowing the ability to add, replace, or remove, RECOMMENDED.- Parameters:
scopesConsumer
- aConsumer
of thescope
values supported in authorization requests to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for 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.Builder
for further configuration
-
bearerMethods
public OAuth2ProtectedResourceMetadata.Builder bearerMethods(Consumer<List<String>> bearerMethodsConsumer) AConsumer
of 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
- aConsumer
of the supported methods for sending an OAuth 2.0 bearer token to the protected resource- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for 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.Builder
for further configuration
-
tlsClientCertificateBoundAccessTokens
public OAuth2ProtectedResourceMetadata.Builder tlsClientCertificateBoundAccessTokens(boolean tlsClientCertificateBoundAccessTokens) Set totrue
to indicate protected resource support for mutual-TLS client certificate-bound access tokens, OPTIONAL.- Parameters:
tlsClientCertificateBoundAccessTokens
-true
to indicate protected resource support for mutual-TLS client certificate-bound access tokens- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
claim
Sets the claim.- Parameters:
name
- the claim namevalue
- the claim value- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configuration
-
claims
Provides access to everyclaim(String, Object)
declared so far allowing the ability to add, replace, or remove.- Parameters:
claimsConsumer
- aConsumer
of the claims- Returns:
- the
OAuth2ProtectedResourceMetadata.Builder
for further configurations
-
build
Validate the claims and build theOAuth2ProtectedResourceMetadata
.- Returns:
- the
OAuth2ProtectedResourceMetadata
-