예제 #1
0
        /// <summary>
        /// Specifies that reCAPTCHA token should be passed in http header.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static IRecaptchaBuilder AddTokenHeaderProvider(this IRecaptchaBuilder builder, IConfiguration configuration)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            builder.Services.Configure <RecaptchaTokenHeaderProvider.Options>(configuration);
            return(builder.AddTokenHeaderProviderInner());
        }
예제 #2
0
        /// <summary>
        /// Specifies that reCAPTCHA token should be passed in http header.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="setupOptions"></param>
        /// <returns></returns>
        public static IRecaptchaBuilder AddTokenHeaderProvider(this IRecaptchaBuilder builder,
                                                               Action <RecaptchaTokenHeaderProvider.Options> setupOptions = null)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (setupOptions is null)
            {
                setupOptions = _ => { };
            }

            builder.Services.Configure(setupOptions);
            return(builder.AddTokenHeaderProviderInner());
        }