Class OAuth2Authenticator
java.lang.Object
com.worldline.acquiring.sdk.java.authentication.OAuth2Authenticator
- All Implemented Interfaces:
Authenticator
OAuth2
Authenticator implementation.-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2Authenticator(CommunicatorConfiguration communicatorConfiguration) Constructs a new OAuth2Authenticator instance using the provided CommunicatorConfiguration. -
Method Summary
Modifier and TypeMethodDescriptiongetAuthorization(String httpMethod, URI resourceUri, List<RequestHeader> requestHeaders) Returns a value that can be used for the "Authorization" header.
-
Constructor Details
-
OAuth2Authenticator
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 benullor empty, and the timeout values must be positive.- Throws:
IllegalArgumentException- If the OAuth2 client id, client secret or token URI from the communicator configuration isnullor 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:AuthenticatorReturns a value that can be used for the "Authorization" header.- Specified by:
getAuthorizationin interfaceAuthenticator- Parameters:
httpMethod- The HTTP method.resourceUri- TheURIof the resource.requestHeaders- A list ofRequestHeaders. This list may not be modified and may not contain headers with the same name.
-