Example #1
0
        public async Task RemoveAllAsync(string subjectId, string _, string type)
        {
            var clientIds = await _clientStoreExtra.GetAllClientIdsAsync();

            foreach (var clientId in clientIds)
            {
                _inMemoryPersistedGrantStore.RemoveAllAsync(subjectId, clientId, type);
            }
        }
        public async Task RemoveAllAsync(string subjectId, string _, string type)
        {
            var clientIds = await _clientStoreExtra.GetAllClientIdsAsync();

            foreach (var clientId in clientIds)
            {
                await _persistedGrantStoreImplementation.RemoveAllAsync(subjectId, clientId, type);
            }
        }
        public async Task <IViewComponentResult> InvokeAsync(string id)
        {
            string clientId = id;

            if (string.IsNullOrWhiteSpace(clientId))
            {
                var clients = await _clientStore.GetAllClientIdsAsync();

                clientId = clients.FirstOrDefault();
            }
            var client = await _clientStore.FindClientByIdAsync(clientId);

            return(View(client as ClientExtra));
        }
        public async Task <IViewComponentResult> InvokeAsync(string id)
        {
            string clientId = id;

            if (string.IsNullOrWhiteSpace(clientId))
            {
                var clients = await _clientStore.GetAllClientIdsAsync();

                clientId = clients.FirstOrDefault();
            }
            var client = await _clientStore.FindClientByIdAsync(clientId);

            var clientRequestIdentity = new ClientRequestIdentity()
            {
                ClientId = clientId
            };

            var rateLimitClientsRule = _processor.GetRateLimitClientsRule(clientRequestIdentity);
            List <RateLimitRuleRecord> rateLimitRuleRecords = new List <RateLimitRuleRecord>();

            if (rateLimitClientsRule != null)
            {
                foreach (var rateLimitRule in rateLimitClientsRule.Settings.RateLimitRules)
                {
                    var rateLimitCounter = _processor.GetStoredRateLimitCounter(clientRequestIdentity, rateLimitRule);
                    rateLimitRuleRecords.Add(new RateLimitRuleRecord()
                    {
                        RateLimitCounter = rateLimitCounter,
                        RateLimitRule    = rateLimitRule
                    });
                }
            }

            var usageRecords = await _clientUsageStore.GetClientUsageRecordsAsync(clientId, null, (null, null));

            var model = new ClientViewComponentModel
            {
                ClientExtra          = client as ClientExtra,
                RateLimitRuleRecords = rateLimitRuleRecords,
                UsageRecords         = usageRecords == null?null:usageRecords.ToList()
            };

            return(View(model));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var clients = await _clientStore.GetAllClientIdsAsync();

            return(View(clients));
        }
 public Task <List <string> > GetAllClientIdsAsync()
 {
     return(_inner.GetAllClientIdsAsync());
 }