Class DefaultAdyenHMACValidator
java.lang.Object
com.broadleafcommerce.adyen.service.webhook.validation.DefaultAdyenHMACValidator
- All Implemented Interfaces:
AdyenHMACValidator
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAdyenHMACValidator
(AdyenConfigurationProperties configurationProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
calculateHMAC
(NotificationRequestItem notificationRequestItem, String key) protected String
calculateHMAC
(String data, String key) protected AdyenConfigurationProperties
protected String
getDataToSign
(NotificationRequestItem notificationRequestItem) protected String
getHMACKey
(NotificationRequestItem notificationRequestItem) boolean
validateHMAC
(@NonNull NotificationRequestItem notificationRequestItem) Validates signature of notificationRequestItem, it takes the signature from notificationRequestItem hmac key to validate is taken fromAdyenConfigurationProperties.getHmacKey(String, String)
-
Field Details
-
HMAC_SHA256_ALGORITHM
- See Also:
-
DATA_SEPARATOR
- See Also:
-
-
Constructor Details
-
DefaultAdyenHMACValidator
-
-
Method Details
-
validateHMAC
public boolean validateHMAC(@NonNull @NonNull NotificationRequestItem notificationRequestItem) throws SignatureException Description copied from interface:AdyenHMACValidator
Validates signature of notificationRequestItem, it takes the signature from notificationRequestItem hmac key to validate is taken fromAdyenConfigurationProperties.getHmacKey(String, String)
- Specified by:
validateHMAC
in interfaceAdyenHMACValidator
- Parameters:
notificationRequestItem
- - item that needs a signature validation- Returns:
- a boolean indicating if signature valid or not
- Throws:
SignatureException
- - throws exception in case bad key
-
getHMACKey
-
calculateHMAC
protected String calculateHMAC(NotificationRequestItem notificationRequestItem, String key) throws com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException, SignatureException - Throws:
com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException
SignatureException
-
calculateHMAC
protected String calculateHMAC(String data, String key) throws com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException, SignatureException - Throws:
com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException
SignatureException
-
getDataToSign
protected String getDataToSign(NotificationRequestItem notificationRequestItem) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getConfigurationProperties
-