/// <summary> /// Initializes a new instance of <see cref="FWRecaptchaValidationFilterAttribute"/>. /// </summary> /// <param name="configuration">The configuration object.</param> /// <param name="memoryCache">The memory cache object.</param> public FWRecaptchaValidationFilterAttribute(IConfiguration configuration, IMemoryCache memoryCache) { _memoryCache = memoryCache; var options = new FWRecaptchaOptions(); configuration.Bind("Recaptcha", options); if (options.SiteKey == null) { throw new FWSettingsException("Recaptcha:SiteKey"); } _options = options; }
/// <summary> /// Initializes a new instance of the <see cref="FWRecaptchaTagHelper"/> class. /// </summary> /// <param name="configuration">The app configuration object.</param> /// <param name="memoryCache">The memory cache object.</param> /// <param name="urlHelperFactory">The url helper factory.</param> /// <param name="actionAccessor">The action accessor.</param> public FWRecaptchaTagHelper(IConfiguration configuration, IMemoryCache memoryCache, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionAccessor) : base(urlHelperFactory, actionAccessor) { _memoryCache = memoryCache; var options = new FWRecaptchaOptions(); configuration.Bind("Recaptcha", options); if (options.SiteKey == null) { throw new FWSettingsException("Recaptcha:SiteKey"); } _options = options; }