Class OAuth2ClientCredentialsGrantBuilder
java.lang.Object
com.linecorp.armeria.client.auth.oauth2.OAuth2ClientCredentialsGrantBuilder
@UnstableApi public final class OAuth2ClientCredentialsGrantBuilder extends Object
Builds
OAuth2ClientCredentialsGrant
.-
Method Summary
Modifier and Type Method Description OAuth2ClientCredentialsGrant
build()
Builds a new instance ofOAuth2ClientCredentialsGrant
using configured parameters.protected com.linecorp.armeria.internal.client.auth.oauth2.AbstractAccessTokenRequest
buildObtainRequest(WebClient accessTokenEndpoint, String accessTokenEndpointPath, ClientAuthorization clientAuthorization)
OAuth2ClientCredentialsGrantBuilder
clientAuthorization(Supplier<String> clientAuthorization, String authorizationType)
Provides client authorization for the OAuth 2.0 requests based on encoded authorization token and authorization type, as per [RFC6749], Section 2.3.OAuth2ClientCredentialsGrantBuilder
clientBasicAuthorization(Supplier<String> clientAuthorization)
Provides client authorization for the OAuth 2.0 requests based on encoded authorization token andBasic
authorization type, as per [RFC6749], Section 2.3.OAuth2ClientCredentialsGrantBuilder
clientCredentials(Supplier<? extends Map.Entry<String,String>> clientCredentials)
Provides client authorization for the OAuth 2.0 requests based on client credentials andBasic
authorization type, as per [RFC6749], Section 2.3.OAuth2ClientCredentialsGrantBuilder
clientCredentials(Supplier<? extends Map.Entry<String,String>> clientCredentials, String authorizationType)
Provides client authorization for the OAuth 2.0 requests based on client credentials and authorization type, as per [RFC6749], Section 2.3.OAuth2ClientCredentialsGrantBuilder
executor(Executor executor)
An optionalExecutor
that facilitates asynchronous access token obtain and refresh operations.OAuth2ClientCredentialsGrantBuilder
refreshBefore(Duration refreshBefore)
A period when the token should be refreshed proactively prior to its expiry.OAuth2ClientCredentialsGrantBuilder
tokenPersistencyConsumer(Consumer<? super GrantedOAuth2AccessToken> tokenConsumer)
AConsumer
to store Access Token to, to be able restore the previous session.OAuth2ClientCredentialsGrantBuilder
tokenPersistencySupplier(Supplier<? extends GrantedOAuth2AccessToken> tokenSupplier)
ASupplier
to load Access Token from, to be able to restore the previous session.
-
Method Details
-
buildObtainRequest
protected com.linecorp.armeria.internal.client.auth.oauth2.AbstractAccessTokenRequest buildObtainRequest(WebClient accessTokenEndpoint, String accessTokenEndpointPath, @Nullable ClientAuthorization clientAuthorization) -
build
Builds a new instance ofOAuth2ClientCredentialsGrant
using configured parameters. -
clientAuthorization
public final OAuth2ClientCredentialsGrantBuilder clientAuthorization(Supplier<String> clientAuthorization, String authorizationType)Provides client authorization for the OAuth 2.0 requests based on encoded authorization token and authorization type, as per [RFC6749], Section 2.3.- Parameters:
clientAuthorization
- A supplier of encoded client authorization token.authorizationType
- One of the registered HTTP authentication schemes as per HTTP Authentication Scheme Registry.- Throws:
IllegalStateException
- if clientAuthorization already set
-
clientBasicAuthorization
public final OAuth2ClientCredentialsGrantBuilder clientBasicAuthorization(Supplier<String> clientAuthorization)Provides client authorization for the OAuth 2.0 requests based on encoded authorization token andBasic
authorization type, as per [RFC6749], Section 2.3.- Parameters:
clientAuthorization
- A supplier of encoded client authorization token.- Throws:
IllegalStateException
- if clientAuthorization already set
-
clientCredentials
public final OAuth2ClientCredentialsGrantBuilder clientCredentials(Supplier<? extends Map.Entry<String,String>> clientCredentials, String authorizationType)Provides client authorization for the OAuth 2.0 requests based on client credentials and authorization type, as per [RFC6749], Section 2.3.- Parameters:
clientCredentials
- A supplier of client credentials.authorizationType
- One of the registered HTTP authentication schemes as per HTTP Authentication Scheme Registry.- Throws:
IllegalStateException
- if clientCredentials already set
-
clientCredentials
public final OAuth2ClientCredentialsGrantBuilder clientCredentials(Supplier<? extends Map.Entry<String,String>> clientCredentials)Provides client authorization for the OAuth 2.0 requests based on client credentials andBasic
authorization type, as per [RFC6749], Section 2.3.- Parameters:
clientCredentials
- A supplier of client credentials.- Throws:
IllegalStateException
- if clientCredentials already set
-
refreshBefore
A period when the token should be refreshed proactively prior to its expiry. -
tokenPersistencySupplier
public final OAuth2ClientCredentialsGrantBuilder tokenPersistencySupplier(Supplier<? extends GrantedOAuth2AccessToken> tokenSupplier)ASupplier
to load Access Token from, to be able to restore the previous session. OPTIONAL. -
tokenPersistencyConsumer
public final OAuth2ClientCredentialsGrantBuilder tokenPersistencyConsumer(Consumer<? super GrantedOAuth2AccessToken> tokenConsumer)AConsumer
to store Access Token to, to be able restore the previous session. OPTIONAL. -
executor
An optionalExecutor
that facilitates asynchronous access token obtain and refresh operations.
-