Ejemplo n.º 1
0
        public async Task <IEnumerable <ApiResource> > FetchAllApiResourcesAsync()
        {
            var sql          = $"SELECT* FROM c";
            var apiResources = (await _apiResourceGrantCosmosStore.QueryMultipleAsync(sql));
            var query        = from item in apiResources
                               select item.ToModel();

            return(query);
        }
        public async Task <IEnumerable <PersistedGrant> > GetAllAsync(string subjectId)
        {
            Guard.ForNull(subjectId, nameof(subjectId));
            var sql             = $"SELECT* FROM c where c.SubjectId = \"{subjectId}\"";
            var persistedGrants = (await _persistedGrantCosmosStore.QueryMultipleAsync(sql)).ToList();
            var model           = persistedGrants.Select(x => x.ToModel());

            _logger.LogDebug($"{persistedGrants.Count} persisted grants found for {subjectId}");
            return(model);
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <IdentityResource> > FindIdentityResourcesByScopeAsync(IEnumerable <string> scopeNames)
        {
            /*
             * SELECT DISTINCT VALUE c FROM c
             *  WHERE ARRAY_CONTAINS(["1d2e3da2-76e3-4a58-99d2-c2c04bdeaf4d/a", "strawberries", "bananas"],c.name,false)
             *
             */
            const string sqlTemplate = "SELECT DISTINCT VALUE c FROM c WHERE ARRAY_CONTAINS([{0}],c.name,false)";
            var          query       = from item in scopeNames
                                       let c = $"'{item}'"
                                               select c;
            var sql    = string.Format(sqlTemplate, string.Join(',', query));
            var result = await _identityResourceGrantCosmosStore.QueryMultipleAsync(sql);

            var q2 = from item in result
                     select item.ToModel();

            return(q2);
        }
Ejemplo n.º 4
0
 public Task <IEnumerable <Device> > GetAll()
 {
     return(_deviceStore.QueryMultipleAsync("SELECT * FROM c"));
 }