public override async Task Invoke(IOwinContext context)
        {
            IRequest          owinRequest      = new OwinRequest(context.Request.Query, await context.Request.ReadFormAsync());
            IResponseRenderer responseRenderer = new OwinResponseRenderer(context);

            _runningApplication.Handle(owinRequest, responseRenderer);
        }
示例#2
0
        public override async Task Invoke(IOwinContext context)
        {
            IRequest          owinRequest      = new OwinRequest(context.Request.Query, await context.Request.ReadFormAsync());
            IResponseRenderer responseRenderer = new OwinResponseRenderer(context);

            if (_options.UseAuthentication && (context.Authentication.User == null || context.Authentication.User.Identities == null || !context.Authentication.User.Identity.IsAuthenticated))
            {
                responseRenderer.Render(new NotAuthorizedResponse());
            }
            else
            {
                _runningApplication.Handle(owinRequest, responseRenderer);
            }
        }
        public override async Task Invoke(IOwinContext context)
        {
            IRequest          owinRequest      = new OwinRequest(context.Request.Query, await context.Request.ReadFormAsync());
            IResponseRenderer responseRenderer = new OwinResponseRenderer(context);

            if (options.EnableAuthentication)
            {
                if (context.Authentication.User.Identity.IsAuthenticated)
                {
                    _runningApplication.Handle(owinRequest, responseRenderer);
                }
                else
                {
                    await context.Response.WriteAsync("You can't access CrystalQuartz.");
                }
            }
            else
            {
                _runningApplication.Handle(owinRequest, responseRenderer);
            }
        }