Class WebhookSecurityUtils
java.lang.Object
edu.ucsb.cs156.frontiers.utilities.WebhookSecurityUtils
Utility class for webhook security validation
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
validateGitHubSignature
(String payload, String signature, String secret) Validates GitHub webhook signature using HMAC-SHA256
-
Method Details
-
validateGitHubSignature
public static boolean validateGitHubSignature(String payload, String signature, String secret) throws NoSuchAlgorithmException, InvalidKeyException Validates GitHub webhook signature using HMAC-SHA256- Parameters:
payload
- the raw payload body as stringsignature
- the GitHub signature header (e.g., "sha256=abc123...")secret
- the webhook secret- Returns:
- true if signature is valid, false otherwise
- Throws:
NoSuchAlgorithmException
InvalidKeyException
-