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); }