diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs index d6c7e031bc..0b682a632d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs @@ -35,7 +35,8 @@ namespace Volo.Abp.IdentityServer.ApiResources } - public ApiResource(Guid id, [NotNull] string name, string displayName = null, string description = null) : base(id) + public ApiResource(Guid id, [NotNull] string name, string displayName = null, string description = null) + : base(id) { Check.NotNull(name, nameof(name)); @@ -122,7 +123,15 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual void AddProperty([NotNull] string key, string value) { - Properties.Add(new ApiResourceProperty(Id, key, value)); + var property = FindProperty(key); + if (property == null) + { + Properties.Add(new ApiResourceProperty(Id, key, value)); + } + else + { + property.Value = value; + } } public virtual void RemoveAllProperties() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs index a0cf7ff372..60945195d9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs @@ -79,7 +79,15 @@ namespace Volo.Abp.IdentityServer.ApiScopes public virtual void AddProperty([NotNull] string key, string value) { - Properties.Add(new ApiScopeProperty(Id, key, value)); + var property = FindProperty(key); + if (property == null) + { + Properties.Add(new ApiScopeProperty(Id, key, value)); + } + else + { + property.Value = value; + } } public virtual void RemoveAllProperties() 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 ff9a0faf68..07f9eec153 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 @@ -266,7 +266,15 @@ namespace Volo.Abp.IdentityServer.Clients public virtual void AddProperty([NotNull] string key, [NotNull] string value) { - Properties.Add(new ClientProperty(Id, key,value)); + var property = FindProperty(key); + if (property == null) + { + Properties.Add(new ClientProperty(Id, key, value)); + } + else + { + property.Value = value; + } } public virtual void RemoveAllProperties() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs index d9aa5e0c19..907e2cbff8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs @@ -5,14 +5,6 @@ namespace Volo.Abp.IdentityServer.Grants { public class PersistedGrant : AggregateRoot { - protected PersistedGrant() - { - } - - public PersistedGrant(Guid id) : base(id) - { - } - public virtual string Key { get; set; } public virtual string Type { get; set; } @@ -32,5 +24,14 @@ namespace Volo.Abp.IdentityServer.Grants public virtual DateTime? ConsumedTime { get; set; } public virtual string Data { get; set; } + + protected PersistedGrant() + { + } + + public PersistedGrant(Guid id) + : base(id) + { + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs index fa46298842..4b8782b455 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs @@ -56,7 +56,8 @@ namespace Volo.Abp.IdentityServer.IdentityResources Properties = new List(); } - public IdentityResource(Guid id, IdentityServer4.Models.IdentityResource resource) : base(id) + public IdentityResource(Guid id, IdentityServer4.Models.IdentityResource resource) + : base(id) { Name = resource.Name; DisplayName = resource.DisplayName; @@ -91,7 +92,15 @@ namespace Volo.Abp.IdentityServer.IdentityResources public virtual void AddProperty([NotNull] string key, string value) { - Properties.Add(new IdentityResourceProperty(Id, key, value)); + var property = FindProperty(key); + if (property == null) + { + Properties.Add(new IdentityResourceProperty(Id, key, value)); + } + else + { + property.Value = value; + } } public virtual void RemoveAllProperties()