// Extension method for IApplicationBuilder to make using the middleware simpler. public static IApplicationBuilder UseJohan(this IApplicationBuilder app, JohanMiddlewareOptions options) { return(app.UseMiddleware <JohanMiddleware>(Options.Create(options))); }
public JohanMiddleware(RequestDelegate next, IOptions <JohanMiddlewareOptions> options) { // Cache the objects we need later on. _next = next; _options = options.Value; }