Exemplo n.º 1
0
        public override async Task Invoke(IOwinContext context)
        {
            var command = context.GetCommand();

            await DynamicIssue(command);

            postProcessor?.Execute(context.Environment);

            await Task.FromResult(0);
        }
Exemplo n.º 2
0
            public override async Task Invoke(IOwinContext context)
            {
                var commandName = context.GetCommand().GetType().Name;

                if (commandName == "CapturedCommand")
                {
                    context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
                }
                else
                {
                    await Next.Invoke(context);
                }
            }
Exemplo n.º 3
0
        public override async Task Invoke(IOwinContext context)
        {
            var command     = context.GetCommand();
            var commandType = command.GetType();

            try
            {
                Expression <Action <object> > expression = x => Issue(x);
                var methodCallExpression = (MethodCallExpression)expression.Body;
                var methodInfo           = methodCallExpression.Method.GetGenericMethodDefinition().MakeGenericMethod(commandType);

                await Task.Run(() => methodInfo.Invoke(this, new[] { command }));
            }
            catch (TargetInvocationException ex)
            {
                ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
            }
        }
Exemplo n.º 4
0
        public override async Task Invoke(IOwinContext context)
        {
            var identity = (ClaimsIdentity)context.Authentication.User.Identity;
            if (identity.IsAuthenticated)
            {
                var commandType = context.GetCommand().GetType();
                var authorizationContext = new CommandAuthorizationContext(identity, commandType);
                ProcessAuthorizationAttributes(authorizationContext);

                if (authorizationContext.IsAuthorized)
                {
                    await Next.Invoke(context);
                }
                else
                {
                    context.Response.StatusCode = 401;
                }
            }
            else
            {
                context.Response.StatusCode = 401;
            }
        }
Exemplo n.º 5
0
        public override async Task Invoke(IOwinContext context)
        {
            var identity = (ClaimsIdentity)context.Authentication.User.Identity;

            if (identity.IsAuthenticated)
            {
                var commandType          = context.GetCommand().GetType();
                var authorizationContext = new CommandAuthorizationContext(identity, commandType);
                ProcessAuthorizationAttributes(authorizationContext);

                if (authorizationContext.IsAuthorized)
                {
                    await Next.Invoke(context);
                }
                else
                {
                    context.Response.StatusCode = 401;
                }
            }
            else
            {
                context.Response.StatusCode = 401;
            }
        }
Exemplo n.º 6
0
        public override async Task Invoke(IOwinContext context)
        {
            var command = context.GetCommand();

            await DynamicExecutePipeline(command);
        }