示例#1
0
        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);
 }
示例#3
0
 public async Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken)
 {
     HttpModuleHelper.Print("Authentication Filter", context.ActionContext.RequestContext.Principal);
 }
示例#4
0
        protected override bool IsAuthorized(HttpActionContext actionContext)
        {
            HttpModuleHelper.Print("TestAuthorizationFilter", actionContext.RequestContext.Principal);

            return(base.IsAuthorized(actionContext));
        }