Class OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
java.lang.Object
org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
- Enclosing class:
- OAuth2AuthorizedClientProviderBuilder
public final class OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
extends Object
A builder for the
client_credentials
grant.-
Method Summary
Modifier and TypeMethodDescriptionaccessTokenResponseClient
(OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> accessTokenResponseClient) Sets the client used when requesting an access token credential at the Token Endpoint.build()
Builds an instance ofClientCredentialsOAuth2AuthorizedClientProvider
.Sets theClock
used inInstant.now(Clock)
when checking the access token expiry.Sets the maximum acceptable clock skew, which is used when checking the access token expiry.
-
Method Details
-
accessTokenResponseClient
public OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder accessTokenResponseClient(OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> accessTokenResponseClient) Sets the client used when requesting an access token credential at the Token Endpoint.- Parameters:
accessTokenResponseClient
- the client used when requesting an access token credential at the Token Endpoint- Returns:
- the
OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
-
clockSkew
public OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder clockSkew(Duration clockSkew) Sets the maximum acceptable clock skew, which is used when checking the access token expiry. An access token is considered expired ifOAuth2Token#getExpiresAt() - clockSkew
is before the current timeclock#instant()
.- Parameters:
clockSkew
- the maximum acceptable clock skew- Returns:
- the
OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
- See Also:
-
clock
Sets theClock
used inInstant.now(Clock)
when checking the access token expiry.- Parameters:
clock
- the clock- Returns:
- the
OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
-
build
Builds an instance ofClientCredentialsOAuth2AuthorizedClientProvider
.- Returns:
- the
ClientCredentialsOAuth2AuthorizedClientProvider
-