コード例 #1
0
 public AuthorizeManagement(AuthorizeOptions options)
 {
     cache     = options.CacheAgent;
     encryptor = options.Encryptor;
     if (options.CacheExpiry != null && options.CacheExpiry.Value > 0)
     {
         expiryTime = new TimeSpan(0, options.CacheExpiry.Value, 0);
     }
     else
     {
         expiryTime = new TimeSpan(0, 30, 0);
     }
     testMode = options.TestMode;
 }
コード例 #2
0
        internal AuthorizeOptions Build()
        {
            ICacheAgent cacheAgent;

            if (cacheType == 1)
            {
                cacheAgent = new RedisCacheAgent(redisConfig);
            }
            else
            {
                cacheAgent = new MemoryCacheAgent();
            }
            IEncryptor encryptor = new Encryptor(tokenKey);
            var        options   = new AuthorizeOptions()
            {
                CacheAgent  = cacheAgent,
                Encryptor   = encryptor,
                CacheExpiry = cacheExpiry,
                TestMode    = testMode
            };

            return(options);
        }