Class OAuth2Authenticator

java.lang.Object
com.worldline.acquiring.sdk.java.authentication.OAuth2Authenticator
All Implemented Interfaces:
Authenticator

public class OAuth2Authenticator extends Object implements Authenticator
OAuth2 Authenticator implementation.
  • Constructor Details

    • OAuth2Authenticator

      public OAuth2Authenticator(CommunicatorConfiguration communicatorConfiguration)
      Constructs a new OAuth2Authenticator instance using the provided CommunicatorConfiguration.
      Parameters:
      communicatorConfiguration - The configuration object containing the OAuth2 client id, client secret and token URI, connect timeout, and socket timeout. None of these can be null or empty, and the timeout values must be positive.
      Throws:
      IllegalArgumentException - If the OAuth2 client id, client secret or token URI from the communicator configuration is null or empty, or if the connect timeout or socket timeout is non-positive.
  • Method Details

    • getAuthorization

      public String getAuthorization(String httpMethod, URI resourceUri, List<RequestHeader> requestHeaders)
      Description copied from interface: Authenticator
      Returns a value that can be used for the "Authorization" header.
      Specified by:
      getAuthorization in interface Authenticator
      Parameters:
      httpMethod - The HTTP method.
      resourceUri - The URI of the resource.
      requestHeaders - A list of RequestHeaders. This list may not be modified and may not contain headers with the same name.