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 Details

    • builder

      public static OAuth2ResourceOwnerPasswordCredentialsGrantBuilder builder​(WebClient accessTokenEndpoint, String accessTokenEndpointPath)
      Parameters:
      accessTokenEndpoint - A WebClient 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

      public final CompletionStage<GrantedOAuth2AccessToken> 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 registered Supplier. If access token has not previously obtained, obtains is from the OAuth 2.0 token end-point using dedicated single-thread ExecutorService which makes sure all token obtain and refresh requests executed serially. Validates access token and refreshes it if necessary.
      Specified by:
      getAccessToken in interface OAuth2AuthorizationGrant