Class WebhookVerifier
java.lang.Object
com.kingsrook.qqq.backend.core.utils.webhooks.WebhookVerifier
Verifies a signed webhook request (Standard Webhooks format, see
WebhookSigner).
Checks, in order: the three headers are present, the timestamp is within
the tolerance of now (default five minutes, either direction, which stops
replays of old requests), and at least one v1 signature matches one
of the receiver's secrets. Comparison is constant time. Unknown signature
versions are ignored, so a future scheme can be added alongside v1.
Receivers should also remember recent webhook-ids and ignore a
repeat: the same id is sent again on every retry of the same event.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWebhookVerifier(List<WebhookSecret> secrets) Verifier with the default tolerance and the system clock.WebhookVerifier(List<WebhookSecret> secrets, Duration tolerance, Clock clock) Verifier. -
Method Summary
-
Field Details
-
DEFAULT_TOLERANCE
-
-
Constructor Details
-
WebhookVerifier
Verifier with the default tolerance and the system clock. -
WebhookVerifier
Verifier.
-
-
Method Details
-
verify
Verify a request. Header names are matched case-insensitively.- Throws:
WebhookVerificationException- with a reason safe to log
-