Browse Source

ClientRepository changes Yunus Emre Kalkan committed

pull/570/head
Yunus Emre Kalkan 8 years ago
parent
commit
14b0d47420
  1. 14
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs
  2. 3
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs
  3. 14
      modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs

14
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs

@ -193,9 +193,19 @@ namespace Volo.Abp.IdentityServer.Clients
IdentityProviderRestrictions.Add(new ClientIdPRestriction(Id, provider));
}
public virtual void AddProperty([NotNull] string key)
public virtual void RemoveAllIdentityProviderRestriction()
{
Properties.Add(new ClientProperty(Id, key));
IdentityProviderRestrictions.Clear();
}
public virtual void AddProperty([NotNull] string key, [NotNull] string value)
{
Properties.Add(new ClientProperty(Id, key,value));
}
public virtual void RemoveAllProperties()
{
Properties.Clear();
}
public virtual void AddClaim(IGuidGenerator guidGenerator, [NotNull] string type, string value)

3
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs

@ -17,12 +17,13 @@ namespace Volo.Abp.IdentityServer.Clients
}
protected internal ClientProperty(Guid clientId, [NotNull] string key)
protected internal ClientProperty(Guid clientId, [NotNull] string key, [NotNull] string value)
{
Check.NotNull(key, nameof(key));
ClientId = clientId;
Key = key;
Value = value;
}
public override object[] GetKeys()

14
modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs

@ -66,6 +66,20 @@ namespace Volo.Abp.IdentityServer.Clients
DbContext.Set<ClientGrantType>().Remove(grantType);
}
var restrictions = DbContext.Set<ClientIdPRestriction>().Where(s => s.ClientId == entity.Id);
foreach (var restriction in restrictions)
{
DbContext.Set<ClientIdPRestriction>().Remove(restriction);
}
var properties = DbContext.Set<ClientProperty>().Where(s => s.ClientId == entity.Id);
foreach (var clientProperty in properties)
{
DbContext.Set<ClientProperty>().Remove(clientProperty);
}
return await base.UpdateAsync(entity, autoSave, cancellationToken);
}

Loading…
Cancel
Save