|
|
|
@ -144,18 +144,19 @@ namespace Volo.Abp.IdentityServer.Clients |
|
|
|
AllowedGrantTypes.Add(new ClientGrantType(Id, grantType)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddGrantTypes(IEnumerable<string> grantTypes) |
|
|
|
public virtual void RemoveAllAllowedGrantTypes() |
|
|
|
{ |
|
|
|
AllowedGrantTypes.AddRange( |
|
|
|
grantTypes.Select( |
|
|
|
grantType => new ClientGrantType(Id, grantType) |
|
|
|
) |
|
|
|
); |
|
|
|
AllowedGrantTypes.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllAllowedGrantTypes() |
|
|
|
public virtual void RemoveGrantType(string grantType) |
|
|
|
{ |
|
|
|
AllowedGrantTypes.Clear(); |
|
|
|
AllowedGrantTypes.RemoveAll(r => r.GrantType == grantType); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientGrantType FindGrantType(string grantType) |
|
|
|
{ |
|
|
|
return AllowedGrantTypes.FirstOrDefault(r => r.GrantType == grantType); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddSecret([NotNull] string value, DateTime? expiration = null, string type = IdentityServerConstants.SecretTypes.SharedSecret, string description = null) |
|
|
|
@ -183,6 +184,16 @@ namespace Volo.Abp.IdentityServer.Clients |
|
|
|
AllowedScopes.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveScope(string scope) |
|
|
|
{ |
|
|
|
AllowedScopes.RemoveAll(r => r.Scope == scope); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientScope FindScope(string scope) |
|
|
|
{ |
|
|
|
return AllowedScopes.FirstOrDefault(r => r.Scope == scope); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddCorsOrigin([NotNull] string origin) |
|
|
|
{ |
|
|
|
AllowedCorsOrigins.Add(new ClientCorsOrigin(Id, origin)); |
|
|
|
@ -198,29 +209,49 @@ namespace Volo.Abp.IdentityServer.Clients |
|
|
|
PostLogoutRedirectUris.Add(new ClientPostLogoutRedirectUri(Id, postLogoutRedirectUri)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllCorsOrigin() |
|
|
|
public virtual void RemoveAllCorsOrigins() |
|
|
|
{ |
|
|
|
AllowedCorsOrigins.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllRedirectUri() |
|
|
|
public virtual void RemoveCorsOrigin(string uri) |
|
|
|
{ |
|
|
|
AllowedCorsOrigins.RemoveAll(c => c.Origin == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllRedirectUris() |
|
|
|
{ |
|
|
|
RedirectUris.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllPostLogoutRedirectUri() |
|
|
|
public virtual void RemoveRedirectUri(string uri) |
|
|
|
{ |
|
|
|
RedirectUris.RemoveAll(r => r.RedirectUri == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllPostLogoutRedirectUris() |
|
|
|
{ |
|
|
|
PostLogoutRedirectUris.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddIdentityProviderRestriction([NotNull] string provider) |
|
|
|
public virtual void RemovePostLogoutRedirectUri(string uri) |
|
|
|
{ |
|
|
|
IdentityProviderRestrictions.Add(new ClientIdPRestriction(Id, provider)); |
|
|
|
PostLogoutRedirectUris.RemoveAll(p => p.PostLogoutRedirectUri == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllIdentityProviderRestriction() |
|
|
|
public virtual ClientCorsOrigin FindCorsOrigin(string uri) |
|
|
|
{ |
|
|
|
IdentityProviderRestrictions.Clear(); |
|
|
|
return AllowedCorsOrigins.FirstOrDefault(c => c.Origin == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientRedirectUri FindRedirectUri(string uri) |
|
|
|
{ |
|
|
|
return RedirectUris.FirstOrDefault(r => r.RedirectUri == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientPostLogoutRedirectUri FindPostLogoutRedirectUri(string uri) |
|
|
|
{ |
|
|
|
return PostLogoutRedirectUris.FirstOrDefault(p => p.PostLogoutRedirectUri == uri); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddProperty([NotNull] string key, [NotNull] string value) |
|
|
|
@ -233,14 +264,54 @@ namespace Volo.Abp.IdentityServer.Clients |
|
|
|
Properties.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddClaim(IGuidGenerator guidGenerator, [NotNull] string type, string value) |
|
|
|
public virtual void RemoveProperty(string key, string value) |
|
|
|
{ |
|
|
|
Claims.Add(new ClientClaim(guidGenerator.Create(), Id, type, value)); |
|
|
|
Properties.RemoveAll(c => c.Value == value && c.Key == key); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientProperty FindProperty(string key, string value) |
|
|
|
{ |
|
|
|
return Properties.FirstOrDefault(c => c.Key == key && c.Value == value); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddClaim([NotNull] string value, string type) |
|
|
|
{ |
|
|
|
Claims.Add(new ClientClaim(Id, type, value)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllClaims() |
|
|
|
{ |
|
|
|
Claims.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveClaim(string value, string type) |
|
|
|
{ |
|
|
|
Claims.RemoveAll(c => c.Value == value && c.Type == type); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientClaim FindClaim(string value, string type) |
|
|
|
{ |
|
|
|
return Claims.FirstOrDefault(c => c.Type == type && c.Value == value); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddIdentityProviderRestriction([NotNull] string provider) |
|
|
|
{ |
|
|
|
IdentityProviderRestrictions.Add(new ClientIdPRestriction(Id, provider)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveAllIdentityProviderRestrictions() |
|
|
|
{ |
|
|
|
IdentityProviderRestrictions.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void RemoveIdentityProviderRestriction(string provider) |
|
|
|
{ |
|
|
|
IdentityProviderRestrictions.RemoveAll(r => r.Provider == provider); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual ClientIdPRestriction FindIdentityProviderRestriction(string provider) |
|
|
|
{ |
|
|
|
return IdentityProviderRestrictions.FirstOrDefault(r => r.Provider == provider); |
|
|
|
} |
|
|
|
} |
|
|
|
} |