public override void OnAuthorization(HttpActionContext actionContext) { if (IsAuthenticated(actionContext)) { base.OnAuthorization(actionContext); } else { actionContext.Response = HttpResponseBuilder.CreateUnauthorizedResponse(actionContext.Request); } }
public HttpResponseMessage GetToken(string username, string password) { String userId = String.Empty; if (IsAuthenticated(username, password, out userId)) { String token = new AuthenticationHelper().GenerateJwtToken(username, userId); return(HttpResponseBuilder.CreateOKResponse(Request, token)); } return(HttpResponseBuilder.CreateUnauthorizedResponse(Request)); }