/// <inheritdoc/> public async Task RemoveAllGrantsAsync(string subjectId, string clientId = null, string sessionId = null) { var removedGrants = await _persistedGrantDbContext.PersistedGrants.Where(x => x.SubjectId == subjectId && x.ClientId == clientId).ToListAsync(); await _inner.RemoveAllGrantsAsync(subjectId, clientId); var consents = removedGrants.Where(x => x.Type == IdentityServerConstants.PersistedGrantTypes.UserConsent); var scopeValues = new List <string>(); foreach (var consent in consents) { var consentData = _serializer.Deserialize <Consent>(consent.Data); if (consentData?.Scopes != null && consentData.Scopes.Any()) { scopeValues.AddRange(consentData.Scopes); } } var parsedScopesResult = _scopeParser.ParseScopeValues(scopeValues); if (!parsedScopesResult.Succeeded) { return; } await _parsedScopeNotificationService.Notify(clientId, parsedScopesResult.ParsedScopes, ParsedScopeNotificationType.GrantsRevoked); }
/// <summary> /// Updates the consent. /// </summary> /// <param name="subject">The user.</param> /// <param name="client">The client.</param> /// <param name="parsedScopes">The scopes.</param> public async Task UpdateConsentAsync(ClaimsPrincipal subject, Client client, IEnumerable <ParsedScopeValue> parsedScopes) { await _inner.UpdateConsentAsync(subject, client, parsedScopes); if (client.AllowRememberConsent && parsedScopes != null && parsedScopes.Any()) { await _parsedScopeNotificationService.Notify(client.ClientId, parsedScopes, ParsedScopeNotificationType.ConsentGranted); } }