Exemple #1
0
        /// <summary>
        /// Specifies that configuration should be passed in http header.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static IRecaptchaBuilder AddConfigurationHeaderProvider(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 <RecaptchaConfigurationHeaderProvider.Options>(configuration);
            return(builder.AddConfigurationHeaderProviderInner());
        }
Exemple #2
0
        /// <summary>
        /// Specifies that configuration should be passed in http header.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="setupOptions"></param>
        /// <returns></returns>
        public static IRecaptchaBuilder AddConfigurationHeaderProvider(this IRecaptchaBuilder builder,
                                                                       Action <RecaptchaConfigurationHeaderProvider.Options> setupOptions = null)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

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