feat(identity-server): improve property and claim of Client.

pull/10142/head
PM Extra 4 years ago
parent 3149f770ea
commit f6ef8e5ed2

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

@ -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,6 +26,11 @@ 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 };

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

Loading…
Cancel
Save