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 82ba75a5fb..ff9a0faf68 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 @@ -274,17 +274,17 @@ namespace Volo.Abp.IdentityServer.Clients Properties.Clear(); } - public virtual void RemoveProperty(string key, string value) + public virtual void RemoveProperty(string key) { - Properties.RemoveAll(c => c.Value == value && c.Key == key); + Properties.RemoveAll(c => c.Key == key); } - public virtual ClientProperty FindProperty(string key, string value) + public virtual ClientProperty FindProperty(string key) { - return Properties.FirstOrDefault(c => c.Key == key && c.Value == value); + return Properties.FirstOrDefault(c => c.Key == key); } - public virtual void AddClaim([NotNull] string value, string type) + public virtual void AddClaim([NotNull] string type, [NotNull] string value) { Claims.Add(new ClientClaim(Id, type, value)); } @@ -294,12 +294,22 @@ namespace Volo.Abp.IdentityServer.Clients Claims.Clear(); } - public virtual void RemoveClaim(string value, string type) + public virtual void RemoveClaim(string type) { - Claims.RemoveAll(c => c.Value == value && c.Type == type); + Claims.RemoveAll(c => c.Type == type); } - public virtual ClientClaim FindClaim(string value, string type) + public virtual void RemoveClaim(string type, string value) + { + Claims.RemoveAll(c => c.Type == type && c.Value == value); + } + + public virtual List FindClaims(string type) + { + return Claims.Where(c => c.Type == type).ToList(); + } + + public virtual ClientClaim FindClaim(string type, string value) { return Claims.FirstOrDefault(c => c.Type == type && c.Value == value); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs index f0b35d772a..6faf585ee0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs @@ -1,4 +1,4 @@ -using System; +using System; using JetBrains.Annotations; using Volo.Abp.Domain.Entities; @@ -17,11 +17,6 @@ namespace Volo.Abp.IdentityServer.Clients } - public virtual bool Equals(Guid clientId, string value, string type) - { - return ClientId == clientId && Type == type && Value == value; - } - protected internal ClientClaim(Guid clientId, [NotNull] string type, string value) { Check.NotNull(type, nameof(type)); @@ -31,9 +26,14 @@ namespace Volo.Abp.IdentityServer.Clients Value = value; } + public virtual bool Equals(Guid clientId, string type, string value) + { + return ClientId == clientId && Type == type && Value == value; + } + public override object[] GetKeys() { return new object[] { ClientId, Type, Value }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index e2bd202ec1..38c32af64d 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; @@ -149,7 +149,7 @@ namespace Volo.Abp.IdentityServer client.AddCorsOrigin("https://client1-origin.com"); client.AddCorsOrigin("https://{0}.abp.io"); - client.AddClaim(nameof(ClientClaim.Value), nameof(ClientClaim.Type)); + client.AddClaim(nameof(ClientClaim.Type), nameof(ClientClaim.Value)); client.AddGrantType(nameof(ClientGrantType.GrantType)); client.AddIdentityProviderRestriction(nameof(ClientIdPRestriction.Provider)); client.AddPostLogoutRedirectUri(nameof(ClientPostLogoutRedirectUri.PostLogoutRedirectUri));