Class OAuth2ResourceOwnerPasswordCredentialsGrant
java.lang.Object
com.linecorp.armeria.client.auth.oauth2.OAuth2ResourceOwnerPasswordCredentialsGrant
- All Implemented Interfaces:
OAuth2AuthorizationGrant
@UnstableApi public final class OAuth2ResourceOwnerPasswordCredentialsGrant extends Object
An implementation of OAuth 2.0 Resource Owner Password Credentials Grant flow to obtain Access Token,
as per [RFC6749], Section 4.3.
Implements Access Token loading, storing, obtaining and refreshing.
-
Method Summary
Modifier and Type Method Description static OAuth2ResourceOwnerPasswordCredentialsGrantBuilder
builder(WebClient accessTokenEndpoint, String accessTokenEndpointPath)
Creates a new builder forOAuth2ResourceOwnerPasswordCredentialsGrant
.CompletionStage<GrantedOAuth2AccessToken>
getAccessToken()
Produces valid OAuth 2.0 Access Token.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.auth.oauth2.OAuth2AuthorizationGrant
withAuthorization
-
Method Details
-
builder
public static OAuth2ResourceOwnerPasswordCredentialsGrantBuilder builder(WebClient accessTokenEndpoint, String accessTokenEndpointPath)Creates a new builder forOAuth2ResourceOwnerPasswordCredentialsGrant
.- Parameters:
accessTokenEndpoint
- AWebClient
to facilitate an Access Token request. Must correspond to the Access Token endpoint of the OAuth 2 system.accessTokenEndpointPath
- A URI path that corresponds to the Access Token endpoint of the
-
getAccessToken
Produces valid OAuth 2.0 Access Token. Returns cached access token if previously obtained from the token end-point. Optionally loads access token from longer term storage provided by registeredSupplier
. If access token has not previously obtained, obtains is from the OAuth 2.0 token end-point using dedicated single-threadExecutorService
which makes sure all token obtain and refresh requests executed serially. Validates access token and refreshes it if necessary.- Specified by:
getAccessToken
in interfaceOAuth2AuthorizationGrant
-