Working on Client aggregate

pull/206/head
Halil İbrahim Kalkan 8 years ago
parent 9614530e90
commit a03ac02ead

@ -50,7 +50,7 @@ namespace AbpDesk.Web.Mvc.Controllers
client.AddGrantTypes(GrantTypes.ClientCredentials);
client.AddSecret("secret".Sha256());
client.AddAllowedScope(GuidGenerator, "api1"); //TODO: Why not with Id..?
client.AddScope("api1");
await _clientRepository.InsertAsync(client);

@ -2,6 +2,6 @@
{
public class ClientScopeConsts
{
public const int ScopeMaxLength = 200;
public const int ScopeMaxLength = 196;
}
}

@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer.Clients
public virtual bool RequireClientSecret { get; set; }
public virtual bool RequireConsent { get; set; } = true;
public virtual bool RequireConsent { get; set; }
public virtual bool AllowRememberConsent { get; set; }
@ -159,9 +159,9 @@ namespace Volo.Abp.IdentityServer.Clients
);
}
public virtual void AddAllowedScope(IGuidGenerator guidGenerator, string scope)
public virtual void AddScope(string scope)
{
AllowedScopes.Add(new ClientScope(guidGenerator.Create(), Id, scope));
AllowedScopes.Add(new ClientScope(Id, scope));
}
}
}

@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientScope : Entity<Guid>
public class ClientScope : Entity
{
public virtual Guid ClientId { get; protected set; }
@ -14,9 +14,8 @@ namespace Volo.Abp.IdentityServer.Clients
}
public ClientScope(Guid id, Guid clientId, string scope)
protected internal ClientScope(Guid clientId, string scope)
{
Id = id;
ClientId = clientId;
Scope = scope;
}

@ -113,6 +113,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
{
scope.ToTable(TablePrefix + "ClientScopes");
scope.HasKey(x => new {x.ClientId, x.Scope});
scope.Property(x => x.Scope).HasMaxLength(ClientScopeConsts.ScopeMaxLength).IsRequired();
});

@ -58,7 +58,7 @@ namespace Volo.Abp.IdentityServer
}
);
client42.AddAllowedScope(_guidGenerator, "api1");
client42.AddScope("api1");
_clientRepository.Insert(client42);
}

Loading…
Cancel
Save