示例#1
0
        /// <summary>
        /// DNTCaptcha Image Controller
        /// </summary>
        public DNTCaptchaImageController(
            ICaptchaImageProvider captchaImageProvider,
            ICaptchaProtectionProvider captchaProtectionProvider,
            ITempDataProvider tempDataProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            ILogger <DNTCaptchaImageController> logger)
        {
            captchaImageProvider.CheckArgumentNull(nameof(captchaImageProvider));
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            tempDataProvider.CheckArgumentNull(nameof(tempDataProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(logger));

            _captchaImageProvider      = captchaImageProvider;
            _captchaProtectionProvider = captchaProtectionProvider;
            _tempDataProvider          = tempDataProvider;
            _captchaStorageProvider    = captchaStorageProvider;
            _logger = logger;
        }
示例#2
0
        public DNTCaptchaMiddleware(
            RequestDelegate next,
            ICaptchaImageProvider captchaImageProvider,
            ICaptchaProtectionProvider captchaProtectionProvider,
            ITempDataProvider tempDataProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            ILogger <DNTCaptchaImageController> logger)
        {
            this._next = next;

            captchaImageProvider.CheckArgumentNull(nameof(captchaImageProvider));
            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            tempDataProvider.CheckArgumentNull(nameof(tempDataProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            captchaStorageProvider.CheckArgumentNull(nameof(logger));

            _captchaImageProvider      = captchaImageProvider;
            _captchaProtectionProvider = captchaProtectionProvider;
            _tempDataProvider          = tempDataProvider;
            _captchaStorageProvider    = captchaStorageProvider;
            _logger = logger;
        }
        /// <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>
        ///
        /// </summary>
        public DNTCaptchaValidatorService(
            ILogger <DNTCaptchaValidatorService> logger,
            ICaptchaProtectionProvider captchaProtectionProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            IHumanReadableIntegerProvider humanReadableIntegerProvider
            )
        {
            logger.CheckArgumentNull(nameof(logger));
            _logger = logger;

            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            _captchaProtectionProvider = captchaProtectionProvider;

            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            _captchaStorageProvider = captchaStorageProvider;

            humanReadableIntegerProvider.CheckArgumentNull(nameof(humanReadableIntegerProvider));
            _humanReadableIntegerProvider = humanReadableIntegerProvider;
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        public DNTCaptchaValidatorService(
            ILogger <DNTCaptchaValidatorService> logger,
            ICaptchaProtectionProvider captchaProtectionProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            Func <DisplayMode, ICaptchaTextProvider> captchaTextProvider
            )
        {
            logger.CheckArgumentNull(nameof(logger));
            _logger = logger;

            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            _captchaProtectionProvider = captchaProtectionProvider;

            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            _captchaStorageProvider = captchaStorageProvider;

            captchaTextProvider.CheckArgumentNull(nameof(captchaTextProvider));
            _captchaTextProvider = captchaTextProvider;
        }
        /// <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;
        }
示例#8
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;
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        public DNTCaptchaValidatorService(
            IHttpContextAccessor contextAccessor,
            ILogger <DNTCaptchaValidatorService> logger,
            ICaptchaCryptoProvider captchaProtectionProvider,
            ICaptchaStorageProvider captchaStorageProvider,
            Func <DisplayMode, ICaptchaTextProvider> captchaTextProvider
            )
        {
            logger.CheckArgumentNull(nameof(logger));
            _logger = logger;

            captchaProtectionProvider.CheckArgumentNull(nameof(captchaProtectionProvider));
            _captchaProtectionProvider = captchaProtectionProvider;

            captchaStorageProvider.CheckArgumentNull(nameof(captchaStorageProvider));
            _captchaStorageProvider = captchaStorageProvider;

            captchaTextProvider.CheckArgumentNull(nameof(captchaTextProvider));
            _captchaTextProvider = captchaTextProvider;

            contextAccessor.CheckArgumentNull(nameof(contextAccessor));
            _contextAccessor = contextAccessor;
        }