public async Task Invoke(IDictionary <string, object> env) { var context = new OwinContext(env); // Setting Identity => roles go in string[] context.Request.User = new GenericPrincipal(new GenericIdentity("someUser"), new string[] { }); HttpModuleHelper.Print("Middleware", context.Request.User); await this._next(env); // call next thing in the pipeline passing envirenment }
private void context_BeginRequest(object sender, EventArgs e) { HttpModuleHelper.Print("HttpModule: ", HttpContext.Current.User); }
public async Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken) { HttpModuleHelper.Print("Authentication Filter", context.ActionContext.RequestContext.Principal); }
protected override bool IsAuthorized(HttpActionContext actionContext) { HttpModuleHelper.Print("TestAuthorizationFilter", actionContext.RequestContext.Principal); return(base.IsAuthorized(actionContext)); }