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 StringcalculateHMAC(NotificationRequestItem notificationRequestItem, String key) protected StringcalculateHMAC(String data, String key) protected AdyenConfigurationPropertiesprotected StringgetDataToSign(NotificationRequestItem notificationRequestItem) protected StringgetHMACKey(NotificationRequestItem notificationRequestItem) booleanvalidateHMAC(@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:AdyenHMACValidatorValidates signature of notificationRequestItem, it takes the signature from notificationRequestItem hmac key to validate is taken fromAdyenConfigurationProperties.getHmacKey(String, String)- Specified by:
validateHMACin 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.InvalidWebhookRequestExceptionSignatureException
-
calculateHMAC
protected String calculateHMAC(String data, String key) throws com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException, SignatureException - Throws:
com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestExceptionSignatureException
-
getDataToSign
protected String getDataToSign(NotificationRequestItem notificationRequestItem) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getConfigurationProperties
-