Package nl.vpro.io.prepr.rs
Class SignatureValidatorInterceptor
- java.lang.Object
-
- nl.vpro.io.prepr.rs.SignatureValidatorInterceptor
-
- All Implemented Interfaces:
javax.ws.rs.container.ContainerRequestFilter
@Provider public class SignatureValidatorInterceptor extends Object implements javax.ws.rs.container.ContainerRequestFilter
This can be used to verify webhook calls made by prepr to your server See https://developers.mediaconnect.io/docs/webhooks It supposes an url of the form../
It needs to know the webhook id, which must be registered via {#put(String channel, UUID)}- Since:
- 0.1
- Author:
- Michiel Meeuwissen
-
-
Constructor Summary
Constructors Constructor Description SignatureValidatorInterceptor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PreprWebhookAnswer
createAnswer(String channel, String message)
void
filter(@NonNull javax.ws.rs.container.ContainerRequestContext requestContext)
static Optional<UUID>
getWebhookIdForChannel(String channel)
static boolean
put(@NonNull String channel, @NonNull UUID webhookId)
static void
readyForRequests()
protected void
validate(@NonNull String signature, @org.checkerframework.checker.nullness.qual.NonNull byte[] payload, @NonNull String channel)
-
-
-
Method Detail
-
readyForRequests
public static void readyForRequests()
-
filter
public void filter(@NonNull javax.ws.rs.container.ContainerRequestContext requestContext) throws IOException
- Specified by:
filter
in interfacejavax.ws.rs.container.ContainerRequestFilter
- Throws:
IOException
-
validate
protected void validate(@NonNull String signature, @org.checkerframework.checker.nullness.qual.NonNull byte[] payload, @NonNull String channel) throws NoSuchAlgorithmException, InvalidKeyException
-
createAnswer
public static PreprWebhookAnswer createAnswer(String channel, String message)
-
-