コード例 #1
0
        public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant)
        {
            var entity   = _objectMapper.Map <IdentityServer4.Models.PersistedGrant, PersistedGrant>(grant);
            var existing = await _persistentGrantRepository.FindByKeyAsync(grant.Key);

            if (existing == null)
            {
                entity.Id = _guidGenerator.Create();
                await _persistentGrantRepository.InsertAsync(entity);
            }
            else
            {
                await _persistentGrantRepository.UpdateAsync(entity);
            }
        }
コード例 #2
0
ファイル: PersistedGrantStore.cs プロジェクト: zxstudys/abp
        public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant)
        {
            var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key);

            if (entity == null)
            {
                entity = _objectMapper.Map <IdentityServer4.Models.PersistedGrant, PersistedGrant>(grant);
                EntityHelper.TrySetId(entity, () => _guidGenerator.Create());
                await _persistentGrantRepository.InsertAsync(entity);
            }
            else
            {
                _objectMapper.Map(grant, entity);
                await _persistentGrantRepository.UpdateAsync(entity);
            }
        }
コード例 #3
0
        public async Task <PersistedGrantDto> FindByKeyAsync(
            string key
            )
        {
            PersistedGrant item = await PersistentGrantRepository.FindByKeyAsync(key);

            return(ObjectMapper.Map <PersistedGrant, PersistedGrantDto>(item));
        }
コード例 #4
0
 public async Task FindByKeyAsync()
 {
     (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1")).ShouldNotBeNull();
 }