public override void OnAuthorization(HttpActionContext actionContext) { base.OnAuthorization(actionContext); var authenticated = FilterUtils.Validate(actionContext.Request); if (!authenticated) { actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); var authenticated = FilterUtils.Validate(filterContext.RequestContext.HttpContext.Request); if (authenticated) { return; } filterContext.HttpContext.Response.StatusCode = 401; filterContext.HttpContext.Response.End(); }