Class V1HmacAuthenticator
java.lang.Object
com.onlinepayments.authentication.V1HmacAuthenticator
- All Implemented Interfaces:
Authenticator
V1HMAC
Authenticator implementation.-
Constructor Summary
ConstructorsConstructorDescriptionV1HmacAuthenticator(CommunicatorConfiguration communicatorConfiguration) Constructs a new V1HmacAuthenticator instance using the provided CommunicatorConfiguration.V1HmacAuthenticator(String apiKeyId, String secretApiKey) V1HmacAuthenticator(String apiKeyId, String secretApiKey, AuthorizationType authorizationType) -
Method Summary
Modifier and TypeMethodDescriptiongetAuthorization(String httpMethod, URI resourceUri, List<RequestHeader> httpHeaders) Returns a value that can be used for the "Authorization" header.
-
Constructor Details
-
V1HmacAuthenticator
Constructs a new V1HmacAuthenticator instance using the provided CommunicatorConfiguration.- Parameters:
communicatorConfiguration- The configuration object containing the API key, and API key secret, connect timeout, and socket timeout. None of these can benullor empty, and the timeout values must be positive.- Throws:
IllegalArgumentException- If the API key, and API key secret from the communicator configuration isnullor empty, or if the connect timeout or socket timeout is non-positive.
-
V1HmacAuthenticator
- Parameters:
apiKeyId- An identifier for the secret API key. This identifier is visible in the HTTP request and is also used to identify the correct account.secretApiKey- A shared secret. AnapiKeyIdandsecretApiKeyalways go hand-in-hand, the difference is thatsecretApiKeyis never visible in the HTTP request. This secret is used as input for the HMAC algorithm.
-
V1HmacAuthenticator
public V1HmacAuthenticator(String apiKeyId, String secretApiKey, AuthorizationType authorizationType) - Parameters:
apiKeyId- An identifier for the secret API key. This identifier is visible in the HTTP request and is also used to identify the correct account.secretApiKey- A shared secret. AnapiKeyIdandsecretApiKeyalways go hand-in-hand, the difference is thatsecretApiKeyis never visible in the HTTP request. This secret is used as input for the HMAC algorithm.authorizationType- Based on this value both the Online Payments platform and the merchant know which security implementation is used. A version number is used for backward compatibility in the future.
-
-
Method Details
-
getAuthorization
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.httpHeaders- A list ofRequestHeaders. This list may not be modified and may not contain headers with the same name.
-