Class OAuth2ClientCredentialsGrant

java.lang.Object
com.linecorp.armeria.client.auth.oauth2.OAuth2ClientCredentialsGrant
All Implemented Interfaces:
OAuth2AuthorizationGrant

@UnstableApi
public final class OAuth2ClientCredentialsGrant
extends Object
An implementation of OAuth 2.0 Client Credentials Grant flow to obtain Access Token, as per [RFC6749], Section 4.4. Implements Access Token loading, storing, obtaining and refreshing.
  • Method Details

    • builder

      public static OAuth2ClientCredentialsGrantBuilder builder​(WebClient accessTokenEndpoint, String accessTokenEndpointPath)
      Creates a new builder for OAuth2ClientCredentialsGrant.
      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