public override async Task Invoke(IOwinContext context) { var command = context.GetCommand(); await DynamicIssue(command); postProcessor?.Execute(context.Environment); await Task.FromResult(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); } }
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(); } }
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; } }
public override async Task Invoke(IOwinContext context) { var command = context.GetCommand(); await DynamicExecutePipeline(command); }