Class OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
java.lang.Object
com.linecorp.armeria.client.auth.oauth2.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
@UnstableApi public final class OAuth2ResourceOwnerPasswordCredentialsGrantBuilder extends Object
Builds
OAuth2ClientCredentialsGrant
.-
Method Summary
Modifier and Type Method Description OAuth2ResourceOwnerPasswordCredentialsGrant
build()
Builds a new instance ofOAuth2ResourceOwnerPasswordCredentialsGrant
using configured parameters.protected com.linecorp.armeria.internal.client.auth.oauth2.AbstractAccessTokenRequest
buildObtainRequest(WebClient accessTokenEndpoint, String accessTokenEndpointPath, ClientAuthorization clientAuthorization)
OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
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.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
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.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
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.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
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.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
executor(Executor executor)
An optionalExecutor
that facilitates asynchronous access token obtain and refresh operations.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
refreshBefore(Duration refreshBefore)
A period when the token should be refreshed proactively prior to its expiry.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
tokenPersistencyConsumer(Consumer<? super GrantedOAuth2AccessToken> tokenConsumer)
AConsumer
to store Access Token to, to be able restore the previous session.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
tokenPersistencySupplier(Supplier<? extends GrantedOAuth2AccessToken> tokenSupplier)
ASupplier
to load Access Token from, to be able to restore the previous session.OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
userCredentials(Supplier<? extends Map.Entry<String,String>> userCredentials)
A supplier of user credentials: "username" and "password" used to grant the Access Token.
-
Method Details
-
userCredentials
public OAuth2ResourceOwnerPasswordCredentialsGrantBuilder userCredentials(Supplier<? extends Map.Entry<String,String>> userCredentials)A supplier of user credentials: "username" and "password" used to grant the Access Token. REQUIRED. -
buildObtainRequest
protected com.linecorp.armeria.internal.client.auth.oauth2.AbstractAccessTokenRequest buildObtainRequest(WebClient accessTokenEndpoint, String accessTokenEndpointPath, @Nullable ClientAuthorization clientAuthorization) -
build
Builds a new instance ofOAuth2ResourceOwnerPasswordCredentialsGrant
using configured parameters. -
clientAuthorization
public final OAuth2ResourceOwnerPasswordCredentialsGrantBuilder 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 OAuth2ResourceOwnerPasswordCredentialsGrantBuilder 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 OAuth2ResourceOwnerPasswordCredentialsGrantBuilder 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 OAuth2ResourceOwnerPasswordCredentialsGrantBuilder 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
public final OAuth2ResourceOwnerPasswordCredentialsGrantBuilder refreshBefore(Duration refreshBefore)A period when the token should be refreshed proactively prior to its expiry. -
tokenPersistencySupplier
public final OAuth2ResourceOwnerPasswordCredentialsGrantBuilder tokenPersistencySupplier(Supplier<? extends GrantedOAuth2AccessToken> tokenSupplier)ASupplier
to load Access Token from, to be able to restore the previous session. OPTIONAL. -
tokenPersistencyConsumer
public final OAuth2ResourceOwnerPasswordCredentialsGrantBuilder 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.
-