Beispiel #1
0
        public Task <DownstreamAuthorizeResponse> GetDownstreamIdTokenResponseAsync(string id)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
            var result = _memoryCache.Get <DownstreamAuthorizeResponse>(key);

            return(Task.FromResult(result));
        }
Beispiel #2
0
        public Task <ValidatedAuthorizeRequest> GetOriginalIdTokenRequestAsync(string id)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);
            var result = _memoryCache.Get <ValidatedAuthorizeRequest>(key);

            return(Task.FromResult(result));
        }
        public async Task <ValidatedAuthorizeRequest> GetOriginalIdTokenRequestAsync(string id)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);
            var result = await _cache.GetAsync(key);

            return(_binarySerializer.Deserialize <ValidatedAuthorizeRequest>(result));
        }
        public async Task <DownstreamAuthorizeResponse> GetDownstreamIdTokenResponseAsync(string id)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
            var result = await _cache.GetAsync(key);

            return(_binarySerializer.Deserialize <DownstreamAuthorizeResponse>(result));
        }
        public async Task DeleteStoredCacheAsync(string id)
        {
            var keyOriginal   = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);
            var keyDownstream = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
            await _cache.RemoveAsync(keyOriginal);

            await _cache.RemoveAsync(keyDownstream);
        }
Beispiel #6
0
        public Task DeleteStoredCacheAsync(string id)
        {
            var keyOriginal   = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);
            var keyDownstream = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);

            _memoryCache.Remove(keyOriginal);
            _memoryCache.Remove(keyDownstream);
            return(Task.CompletedTask);
        }
Beispiel #7
0
        public Task StoreOriginalAuthorizeRequestAsync(string id, ValidatedAuthorizeRequest request)
        {
            var key = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);

            _memoryCache.Set(
                key,
                request,
                TimeSpan.FromMinutes(_options.ExpirationMinutes));
            return(Task.CompletedTask);
        }
Beispiel #8
0
        public Task StoreDownstreamIdTokenResponseAsync(string id, DownstreamAuthorizeResponse response)
        {
            var key = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);

            _memoryCache.Set(
                key,
                response,
                TimeSpan.FromMinutes(_options.ExpirationMinutes));
            return(Task.CompletedTask);
        }
 public async Task StoreDownstreamIdTokenResponseAsync(string id, DownstreamAuthorizeResponse response)
 {
     var key  = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
     var data = _binarySerializer.Serialize(response);
     DistributedCacheEntryOptions options = new DistributedCacheEntryOptions
     {
         AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(_options.ExpirationMinutes)
     };
     await _cache.SetAsync(key, data, options);
 }
        public async Task StoreOriginalAuthorizeRequestAsync(string id, ValidatedAuthorizeRequest request)
        {
            var key = OIDCPipleLineStoreUtils.GenerateOriginalIdTokenRequestKey(id);

            var data = _binarySerializer.Serialize(request);
            DistributedCacheEntryOptions options = new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(_options.ExpirationMinutes)
            };
            await _cache.SetAsync(key, data, options);
        }
Beispiel #11
0
        public Task StoreDownstreamCustomDataAsync(string id, Dictionary <string, object> custom)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
            var result = _memoryCache.Get <DownstreamAuthorizeResponse>(key);

            if (result == null)
            {
                throw new Exception("Does not exist");
            }
            result.Custom = custom;
            return(StoreDownstreamIdTokenResponseAsync(id, result));
        }
        public async Task StoreDownstreamCustomDataAsync(string id, Dictionary <string, object> custom)
        {
            var key    = OIDCPipleLineStoreUtils.GenerateDownstreamIdTokenResponseKey(id);
            var result = await _cache.GetAsync(key);

            var value = _binarySerializer.Deserialize <DownstreamAuthorizeResponse>(result);

            if (value == null)
            {
                throw new Exception("Does not exist");
            }
            value.Custom = custom;
            await StoreDownstreamIdTokenResponseAsync(id, value);
        }