示例#1
0
 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));
 }
示例#2
0
 public SimplePasscodeMiddleware(SimplePasscodeOptions options,
                                 RequestDelegate next, ILogger <SimplePasscodeMiddleware> logger)
 {
     this.options = options;
     this.next    = next;
     this.logger  = logger;
 }