Ejemplo n.º 1
0
        public async Task <int> GetClientSessionCountAsync(string realm, string clientId)
        {
            var result = await GetBaseUrl(realm)
                         .AppendPathSegment($"/admin/realms/{realm}/clients/{clientId}/session-count")
                         .GetJsonAsync()
                         .ConfigureAwait(false);

            return(Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)));
        }
Ejemplo n.º 2
0
        public async Task <int> GetUserGroupsCountAsync(string realm, string userId)
        {
            var result = await GetBaseUrl(realm)
                         .AppendPathSegment($"/admin/realms/{realm}/users/{userId}/groups/count")
                         .GetJsonAsync()
                         .ConfigureAwait(false);

            return(Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)));
        }
Ejemplo n.º 3
0
        public async Task <int> GetGroupsCountAsync(string realm, string search = null, bool?top = null)
        {
            var queryParams = new Dictionary <string, object>
            {
                [nameof(search)] = search,
                [nameof(top)]    = top
            };

            var result = await GetBaseUrl(realm)
                         .AppendPathSegment($"/admin/realms/{realm}/groups/count")
                         .SetQueryParams(queryParams)
                         .GetJsonAsync()
                         .ConfigureAwait(false);

            return(Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)));
        }