Ejemplo n.º 1
0
        public async Task Invoke(HttpContext httpContext, IWebHookHandlerRegistry webHookHandlerRegistry,
                                 IWebHookEventFactory webHookEventFactory, WebHookEventValidator validator)
        {
            var webHookEvent = await webHookEventFactory.Create(httpContext);

            var result = await validator.ValidateAsync(webHookEvent);

            if (!result.IsValid)
            {
                httpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                return;
            }

            await webHookHandlerRegistry.Handle(webHookEvent);
        }
Ejemplo n.º 2
0
 public HooksController(IWebHookHandlerRegistry webHookHandlerRegistry)
 {
     _webHookHandlerRegistry = webHookHandlerRegistry;
 }