From 162b4112e66901c354cc9052a35e0f007f13872c Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 23 Oct 2018 09:31:49 +0300 Subject: [PATCH] ClientRepository changes --- .../Volo/Abp/IdentityServer/Clients/Client.cs | 5 +++++ .../Volo/Abp/IdentityServer/Clients/ClientRepository.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs index bb0f9d3744..3ec1cf066a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs @@ -153,6 +153,11 @@ namespace Volo.Abp.IdentityServer.Clients ); } + public virtual void RemoveAllAllowedGrantTypes() + { + AllowedGrantTypes.Clear(); + } + public virtual void AddSecret([NotNull] string value, DateTime? expiration = null, string type = IdentityServerConstants.SecretTypes.SharedSecret, string description = null) { ClientSecrets.Add(new ClientSecret(Id, value, expiration, type, description)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 3b07423bc7..559946b6d6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -59,6 +59,13 @@ namespace Volo.Abp.IdentityServer.Clients DbContext.Set().Remove(claim); } + var grantTypes = DbContext.Set().Where(s => s.ClientId == entity.Id); + + foreach (var grantType in grantTypes) + { + DbContext.Set().Remove(grantType); + } + return await base.UpdateAsync(entity, autoSave, cancellationToken); }