示例#1
0
 public void Setup <T>(CaptchaOptions options)
     where T : ICaptchaFactory, new()
 {
     m_factories[options.Path] = () => new T()
     {
         Options = options
     };
 }
示例#2
0
        public void Setup(CaptchaOptions options, Type type)
        {
            if (!typeof(ICaptchaValidator).IsAssignableFrom(type))
            {
                throw new ArgumentException("The type parameter must be assignable from ICaptchaValidator interface", "type");
            }

            m_factories[options.Path] = () =>
            {
                var factory = (ICaptchaFactory)Activator.CreateInstance(type);
                factory.Options = options;
                return(factory);
            };
        }
示例#3
0
 public BitmapCaptchaFactory(CaptchaOptions options, Func <ICache> challengeCacheFactory)
     : base(options, challengeCacheFactory)
 {
     m_contentProvider = new BitmapContent(options,
                                           new JpegImageCodecInfo(options),
                                           new IGraphicsDrawing[]
     {
         new BackgroundDrawing(options),
         new WarpTextDrawing(options),
         new EllipseDrawing(options),
         new CurveDrawing(options)
     });
     m_errorProvider = new EmptyErrorProvider();
 }
 protected AbstractCaptchaFactory(CaptchaOptions options, Func <ICache> challengeCacheFactory)
 {
     Options = options;
     m_challengeCacheFactory = challengeCacheFactory;
     m_turingNumberProvider  = new DefaultTuringNumberProvider(options);
     m_varyByCustomProvider  = new DefaultVaryByCustomProvider(options);
     m_challengeCodeProvider = new DefaultChallengeCodeProvider(options.ChallengeQueryKey, new[]
     {
         GetAntiForgeryTokenName(HttpRuntime.AppDomainAppVirtualPath),
         GetAntiForgeryTokenName(null),
         AuthCookieName()
     });
     m_instrumentationProvider = new CaptchaInstrumentationProvider(options);
 }
示例#5
0
 public BitmapCaptchaFactory(CaptchaOptions options)
     : this(options, () => new InnerWebCache())
 {
 }
 protected AbstractCaptchaFactory(CaptchaOptions options)
     : this(options, () => new InnerWebCache())
 {
 }