Interface AuthTokenProvider

public interface AuthTokenProvider
Use to obtain an Authorization bearer token that is expected to be used.

   class MyAuthTokenProvider implements AuthTokenProducer {

     public AuthToken obtainToken(HttpClientRequest tokenRequest) {

       MyTokenResponse tokenResponse = tokenRequest
         .header("content-type", "application/json")

       String token = tokenResponse.getToken();
       long expiresSecs = tokenResponse.getExpiresInSecs();

       Instant validUntil =;

       return AuthToken.of(token, validUntil);

  • Method Summary

    Modifier and Type
    Obtain a new Authorization token.
  • Method Details

    • obtainToken

      AuthToken obtainToken(HttpClientRequest tokenRequest)
      Obtain a new Authorization token.
      tokenRequest - A new request to obtain an Authorisation token