public RequestRecaptchaMiddleware(
     RequestDelegate next,
     RecaptchaService recaptchaService,
     IOptions <RequestRecaptchaOptions> options)
 {
     _next             = next ?? throw new ArgumentNullException(nameof(next));
     _recaptchaService = recaptchaService;
     _options          = options.Value;
 }
예제 #2
0
        public static IApplicationBuilder UseRequestRecaptcha(this IApplicationBuilder builder, RequestRecaptchaOptions options)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(builder.UseMiddleware <RequestRecaptchaMiddleware>(Options.Create(options)));
        }