/// <summary>
        /// The default captcha image provider
        /// </summary>
        public CaptchaImageProvider(IRandomNumberProvider randomNumberProvider)
        {
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));

            _randomNumberProvider = randomNumberProvider;

            SetColors();
        }
Пример #2
0
        /// <summary>
        /// The default captcha image provider
        /// </summary>
        public CaptchaImageProvider(
            IRandomNumberProvider randomNumberProvider,
            IOptions <DNTCaptchaOptions> options)
        {
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));

            _randomNumberProvider = randomNumberProvider;
            _options = options.Value;
        }
        /// <summary>
        /// DNTCaptcha TagHelper
        /// </summary>
        public DNTCaptchaTagHelper(
            ICaptchaProtectionProvider captchaProtectionProvider,
            IRandomNumberProvider randomNumberProvider,
            IHumanReadableIntegerProvider humanReadableIntegerProvider,
            ICaptchaStorageProvider captchaStorageProvider)
        {
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));
            humanReadableIntegerProvider.CheckArgumentNull(nameof(humanReadableIntegerProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));

            _captchaProtectionProvider    = captchaProtectionProvider;
            _randomNumberProvider         = randomNumberProvider;
            _humanReadableIntegerProvider = humanReadableIntegerProvider;
            _captchaStorageProvider       = captchaStorageProvider;
        }
        /// <summary>
        /// DNTCaptcha TagHelper
        /// </summary>
        public DNTCaptchaApiController(
            ICaptchaProtectionProvider captchaProtectionProvider,
            IRandomNumberProvider randomNumberProvider,
            Func <DisplayMode, ICaptchaTextProvider> captchaTextProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            ISerializationProvider serializationProvider)
        {
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));
            captchaTextProvider.CheckArgumentNull(nameof(captchaTextProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            serializationProvider.CheckArgumentNull(nameof(serializationProvider));

            _captchaProtectionProvider = captchaProtectionProvider;
            _randomNumberProvider      = randomNumberProvider;
            _captchaTextProvider       = captchaTextProvider;
            _captchaStorageProvider    = captchaStorageProvider;
            _serializationProvider     = serializationProvider;
        }
        /// <summary>
        /// DNTCaptcha TagHelper
        /// </summary>
        public DNTCaptchaTagHelper(
            ICaptchaProtectionProvider captchaProtectionProvider,
            IRandomNumberProvider randomNumberProvider,
            Func <DisplayMode, ICaptchaTextProvider> captchaTextProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            IAntiforgery antiforgery,
            ISerializationProvider serializationProvider
            )
        {
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));
            captchaTextProvider.CheckArgumentNull(nameof(captchaTextProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            antiforgery.CheckArgumentNull(nameof(antiforgery));
            serializationProvider.CheckArgumentNull(nameof(serializationProvider));

            _captchaProtectionProvider = captchaProtectionProvider;
            _randomNumberProvider      = randomNumberProvider;
            _captchaTextProvider       = captchaTextProvider;
            _captchaStorageProvider    = captchaStorageProvider;
            _antiforgery           = antiforgery;
            _serializationProvider = serializationProvider;
        }
Пример #6
0
        /// <summary>
        /// DNTCaptcha Api
        /// </summary>
        public DNTCaptchaApiProvider(
            ICaptchaCryptoProvider captchaProtectionProvider,
            IRandomNumberProvider randomNumberProvider,
            Func <DisplayMode, ICaptchaTextProvider> captchaTextProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            ISerializationProvider serializationProvider,
            IHttpContextAccessor httpContextAccessor,
            IUrlHelper urlHelper)
        {
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            randomNumberProvider.CheckArgumentNull(nameof(randomNumberProvider));
            captchaTextProvider.CheckArgumentNull(nameof(captchaTextProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            serializationProvider.CheckArgumentNull(nameof(serializationProvider));

            _captchaProtectionProvider = captchaProtectionProvider;
            _randomNumberProvider      = randomNumberProvider;
            _captchaTextProvider       = captchaTextProvider;
            _captchaStorageProvider    = captchaStorageProvider;
            _serializationProvider     = serializationProvider;
            _httpContextAccessor       = httpContextAccessor;
            _urlHelper = urlHelper;
        }