Example #1
0
        public virtual async Task RemoveAsync(string key)
        {
            var persistedGrant = await PersistentGrantRepository.FindByKeyAsync(key);

            if (persistedGrant == null)
            {
                return;
            }

            await PersistentGrantRepository.DeleteAsync(persistedGrant);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        public virtual async Task <IdentityServer4.Models.PersistedGrant> GetAsync(string key)
        {
            var persistedGrant = await PersistentGrantRepository.FindByKeyAsync(key);

            return(ObjectMapper.Map <PersistedGrant, IdentityServer4.Models.PersistedGrant>(persistedGrant));
        }