java.lang.Object
co.ankatech.keymanagement.client.auth.invoker.auth.HttpBearerAuth
All Implemented Interfaces:
Authentication

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class HttpBearerAuth extends Object implements Authentication
  • Constructor Details

    • HttpBearerAuth

      public HttpBearerAuth(String scheme)
  • Method Details

    • getBearerToken

      public String getBearerToken()
      Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
      Returns:
      The bearer token
    • setBearerToken

      public void setBearerToken(String bearerToken)
      Sets the token, which together with the scheme, will be sent as the value of the Authorization header.

      The token is stored in an internal AtomicReference so clearBearerToken() can later release it. The supplier reads from the reference, NOT from a captured local variable.

      Parameters:
      bearerToken - The bearer token to send in the Authorization header
    • clearBearerToken

      public void clearBearerToken()
      Clears the stored bearer token by setting the internal reference to null. After this call, getBearerToken() returns null and outgoing requests receive no Authorization header.

      Call it to release the token once it is no longer in use.

    • setBearerToken

      public void setBearerToken(Supplier<String> tokenSupplier)
      Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
      Parameters:
      tokenSupplier - The supplier of bearer tokens to send in the Authorization header
    • applyToParams

      public void applyToParams(List<Pair> queryParams, Map<String,String> headerParams, Map<String,String> cookieParams, String payload, String method, URI uri) throws ApiException
      Description copied from interface: Authentication
      Apply authentication settings to header and query params.
      Specified by:
      applyToParams in interface Authentication
      Parameters:
      queryParams - List of query parameters
      headerParams - Map of header parameters
      cookieParams - Map of cookie parameters
      payload - HTTP request body
      method - HTTP method
      uri - URI
      Throws:
      ApiException - if failed to update the parameters