/// <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; }
/// <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); }
/// <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; }
public DefaultCaptchaImageGenerator(IOptions <CaptchaOptions> options) { this.options = options.Value; random = new Random(); }
public DefaultCaptchaStore(IOptions <CaptchaOptions> options) { this.options = options.Value; cache = new Dictionary <BinaryBlob, GeneratedCaptcha>(); }