예제 #1
0
        public async Task RemoveIdentityResourceAsync(string name)
        {
            Guard.ForNull(name, nameof(name));
            var sql    = $"SELECT* FROM c where c.name = '{name}'";
            var entity = (await _identityResourceGrantCosmosStore.QuerySingleAsync(sql, feedOptions: new Microsoft.Azure.Documents.Client.FeedOptions
            {
                PartitionKey = new Microsoft.Azure.Documents.PartitionKey(name)
            }));

            if (entity == null)
            {
                return;
            }

            var response = await _identityResourceGrantCosmosStore.RemoveByIdAsync(entity.Id, entity.Name);
        }
예제 #2
0
        public async Task <ApiResource> FindApiResourceAsync(string name)
        {
            Guard.ForNull(name, nameof(name));
            var sql    = $"SELECT* FROM c where c.name = '{name}'";
            var entity = (await _apiResourceGrantCosmosStore.QuerySingleAsync(sql, feedOptions: new Microsoft.Azure.Documents.Client.FeedOptions
            {
                PartitionKey = new Microsoft.Azure.Documents.PartitionKey(name)
            }));

            if (entity == null)
            {
                return(null);
            }
            var model = entity.ToModel();

            return(model);
        }
        public async Task <PersistedGrant> GetAsync(string key)
        {
            Guard.ForNull(key, nameof(key));
            var sql    = $"SELECT* FROM c where c.key = \"{key}\"";
            var entity = (await _persistedGrantCosmosStore.QuerySingleAsync(sql, feedOptions: new Microsoft.Azure.Documents.Client.FeedOptions
            {
                PartitionKey = new Microsoft.Azure.Documents.PartitionKey(key)
            }));

            if (entity == null)
            {
                return(null);
            }
            var model = entity.ToModel();

            return(model);
        }
        public async Task Persist_Grant_That_Will_Expire_Fetch_SUCCESS()
        {
            var sql    = $"SELECT* FROM c where c.key = \"{_currentEntity.Key}\"";
            var entity = (await _persistedGrantCosmosStore.QuerySingleAsync(sql, feedOptions: new Microsoft.Azure.Documents.Client.FeedOptions
            {
                PartitionKey = new Microsoft.Azure.Documents.PartitionKey(_currentEntity.Key)
            }));

            entity.Should().NotBeNull();
            _currentEntity.Key.Should().Be(entity.Key);

            _currentEntity.Id = entity.Id;

            entity = await _persistedGrantCosmosStore.FindAsync(entity.Id, _currentEntity.Key);

            entity.Should().NotBeNull();
            entity.Key.Should().Be(_currentEntity.Key);
        }
예제 #5
0
 public async Task <Device> GetByName(string deviceName)
 {
     return(await _deviceStore.QuerySingleAsync($"SELECT * FROM c WHERE c.deviceName = \"{deviceName}\""));
 }