示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public DefaultCaptchaFeature(HttpContext context)
        {
            var snapshot = (IOptions <CaptchaOptions>)context.RequestServices.GetService(typeof(IOptions <CaptchaOptions>));

            this.context = context;
            options      = snapshot.Value;
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="options"></param>
        /// <param name="store"></param>
        /// <param name="loggerFactory"></param>
        public DefaultCaptcha(
            IOptions <CaptchaOptions> options,
            ICaptchaStore store,
            ILoggerFactory loggerFactory)
        {
            this.store   = store;
            this.options = options.Value;

            logger        = loggerFactory.CreateLogger(typeof(DefaultCaptcha));
            textGenerator = new CaptchaTextGenerator(this.options.AllowedChars, this.options.CaptchaLength);
        }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="next"></param>
 /// <param name="store"></param>
 /// <param name="generator"></param>
 /// <param name="options"></param>
 public DefaultCaptchaMiddleware(
     RequestDelegate next,
     ICaptchaStore store,
     ICaptchaImageGenerator generator,
     IOptions <CaptchaOptions> options)
 {
     this.next      = next;
     this.store     = store;
     this.generator = generator;
     this.options   = options.Value;
 }
示例#4
0
 public DefaultCaptchaImageGenerator(IOptions <CaptchaOptions> options)
 {
     this.options = options.Value;
     random       = new Random();
 }
示例#5
0
 public DefaultCaptchaStore(IOptions <CaptchaOptions> options)
 {
     this.options = options.Value;
     cache        = new Dictionary <BinaryBlob, GeneratedCaptcha>();
 }