Пример #1
0
        public async Task UpdateAsync(IdentityServer3.Core.Models.Consent consent)
        {
            Consent item = null;

            if (options != null && options.SynchronousReads)
            {
                item = context.Consents.Find(consent.Subject, consent.ClientId);
            }
            else
            {
                item = await context.Consents.FindAsync(consent.Subject, consent.ClientId);
            }

            if (item == null)
            {
                item = new Entities.Consent
                {
                    Subject  = consent.Subject,
                    ClientId = consent.ClientId
                };
                context.Consents.Add(item);
            }

            if (consent.Scopes == null || !consent.Scopes.Any())
            {
                context.Consents.Remove(item);
            }

            item.Scopes = StringifyScopes(consent.Scopes);

            await context.SaveChangesAsync();
        }
        public async Task RemoveAsync(string key)
        {
            var token = await context.Tokens.FindAsync(key, tokenType);

            if (token != null)
            {
                context.Tokens.Remove(token);
                await context.SaveChangesAsync();
            }
        }
        public async Task RemoveAsync(string key)
        {
            Entities.Token token = null;
            if (options != null && options.SynchronousReads)
            {
                token = context.Tokens.Find(key, tokenType);
            }
            else
            {
                token = await context.Tokens.FindAsync(key, tokenType);
            }

            if (token != null)
            {
                context.Tokens.Remove(token);
                await context.SaveChangesAsync();
            }
        }