Exemplo n.º 1
0
 public object Clone()
 {
     CertCacheItem item = new CertCacheItem()
     {
         Token = this.Token.Clone() as AuthToken,
         apis = this.apis.CloneList() as List<api>
     };
     return item;
 }
Exemplo n.º 2
0
        public void DeleteToken(string token)
        {
            CertCacheItem item = GetCacheToken(token);

            if (item != null)
            {
                tempmanagecache.Remove(item);
                SetCertCahe();
            }
        }
Exemplo n.º 3
0
        public object Clone()
        {
            CertCacheItem item = new CertCacheItem()
            {
                Token = this.Token.Clone() as AuthToken,
                apis  = this.apis.CloneList() as List <api>
            };

            return(item);
        }
Exemplo n.º 4
0
        public bool SetCacheApis(string token, List <api> apis)
        {
            CertCacheItem item = GetCacheToken(token);

            if (item == null)
            {
                return(false);
            }
            item.apis = apis;
            SetCertCahe();
            return(true);
        }
Exemplo n.º 5
0
        public CertCacheItem GetCacheToken(string token)
        {
            CertCacheItem t_tokenitem = null;

            try
            {
                t_tokenitem = tempmanagecache.FirstOrDefault(x => x.Token.token == token);
                if (t_tokenitem == null)
                {
                    return(null);
                }
            }
            catch
            {
            }
            return(t_tokenitem);
        }
Exemplo n.º 6
0
        public void AddOrUpdateToken(AuthToken Token)
        {
            CertCacheItem t_tokenitem = null;

            Token.lastauth = DateTime.Now;//上次请求certcennt的时间。
            t_tokenitem    = tempmanagecache.FirstOrDefault(x => x.Token.token == Token.token);
            if (t_tokenitem == null)
            {
                tempmanagecache.Add(new CertCacheItem()
                {
                    Token = Token
                });
            }
            else
            {
                t_tokenitem.Token = Token;
            }
            SetCertCahe();
        }