public static void UsePasscode(this IApplicationBuilder app, SimplePasscodeOptions options) { app.UseWhen( (ctx) => ctx.Request.Cookies[options.CookieName] != options.Passcode && options.Filter?.Invoke(ctx) != false, app => app.UseMiddleware <SimplePasscodeMiddleware>(options)); }
public SimplePasscodeMiddleware(SimplePasscodeOptions options, RequestDelegate next, ILogger <SimplePasscodeMiddleware> logger) { this.options = options; this.next = next; this.logger = logger; }