Esempio n. 1
0
        public string CreateToken(string tokenType, IEnumerable <string> purpose, string identity)
        {
            var value = Guid.NewGuid().ToShortString();

            var token = new CachedToken
            {
                TokenType = tokenType,
                Identity  = identity,
                Purposes  = purpose == null ? null : purpose.ToList()
            };
            var cacheKey = _configuration.CachePrefix + value;

            _cache.Put(cacheKey, token, _configuration.Lifetime, _cacheCategory);

            return(value);
        }
Esempio n. 2
0
        public string CreateToken(string tokenType, string purpose, string identity)
        {
            var value = Guid.NewGuid().ToShortString();

            var token = new CachedToken
            {
                TokenType = tokenType,
                Identity  = identity,
                Purposes  = string.IsNullOrEmpty(purpose) ? null : new List <string> {
                    purpose
                }
            };
            var cacheKey = _configuration.CachePrefix + value;

            _cache.Put(cacheKey, token, _configuration.Lifetime, _cacheCategory);

            return(value);
        }