Browse Source

Refactored.

pull/194/head
Halil İbrahim Kalkan 9 years ago
parent
commit
5edde96be4
  1. 3
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs
  2. 18
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiAndIdentityResources.cs
  3. 23
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResources.cs
  4. 2
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs
  5. 8
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceStore.cs
  6. 4
      src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResourceRepository.cs

3
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs

@ -2,7 +2,6 @@
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.Temp;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Security; using Volo.Abp.Security;
@ -33,8 +32,6 @@ namespace Volo.Abp.IdentityServer
//TODO: Remove in-memory stores once EF Core stores are fully completed. //TODO: Remove in-memory stores once EF Core stores are fully completed.
identityServerBuilder.AddDeveloperSigningCredential() identityServerBuilder.AddDeveloperSigningCredential()
//.AddInMemoryClients(IdentityServerConfig.GetClients())
//.AddInMemoryApiResources(IdentityServerConfig.GetApiResources())
.AddAbpIdentityServer(); .AddAbpIdentityServer();
services.ExecutePreConfiguredActions(identityServerBuilder); services.ExecutePreConfiguredActions(identityServerBuilder);

18
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiAndIdentityResources.cs

@ -0,0 +1,18 @@
using System.Threading.Tasks;
using Volo.Abp.IdentityServer.IdentityResources;
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiAndIdentityResources
{
public Task<IdentityResource[]> IdentityResources { get; set; }
public Task<ApiResource[]> ApiResources { get; set; }
public ApiAndIdentityResources(Task<IdentityResource[]> identityResources, Task<ApiResource[]> apiResources)
{
IdentityResources = identityResources;
ApiResources = apiResources;
}
}
}

23
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResources.cs

@ -1,23 +0,0 @@
using System.Threading.Tasks;
using Volo.Abp.IdentityServer.IdentityResources;
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiResources
{
public Task<IdentityResource[]> Resources { get; set; }
public Task<ApiResource[]> IdentityResources { get; set; }
public ApiResources()
{
}
public ApiResources(Task<IdentityResource[]> resources, Task<ApiResource[]> identityResources)
{
Resources = resources;
IdentityResources = identityResources;
}
}
}

2
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs

@ -13,6 +13,6 @@ namespace Volo.Abp.IdentityServer.IdentityResources
Task<ApiResource> FindApiResourceAsync(string name); Task<ApiResource> FindApiResourceAsync(string name);
Task<ApiResources.ApiResources> GetAllResourcesAsync(); Task<ApiResources.ApiAndIdentityResources> GetAllResourcesAsync();
} }
} }

8
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceStore.cs

@ -40,10 +40,10 @@ namespace Volo.Abp.IdentityServer.IdentityResources
public virtual async Task<Resources> GetAllResourcesAsync() public virtual async Task<Resources> GetAllResourcesAsync()
{ {
var result = await _identityResourceRepository.GetAllResourcesAsync(); var result = await _identityResourceRepository.GetAllResourcesAsync();
return new Resources
( return new Resources(
result.Resources.Result.Select(y => _objectMapper.Map<IdentityResource, IdentityServer4.Models.IdentityResource>(y)), result.IdentityResources.Result.Select(y => _objectMapper.Map<IdentityResource, IdentityServer4.Models.IdentityResource>(y)),
result.IdentityResources.Result.Select(x => _objectMapper.Map<ApiResources.ApiResource, ApiResource>(x)) result.ApiResources.Result.Select(x => _objectMapper.Map<ApiResources.ApiResource, ApiResource>(x))
); );
} }
} }

4
src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResourceRepository.cs

@ -59,7 +59,7 @@ namespace Volo.Abp.IdentityServer
return apis.FirstOrDefaultAsync(); return apis.FirstOrDefaultAsync();
} }
public Task<ApiResources.ApiResources> GetAllResourcesAsync() public Task<ApiResources.ApiAndIdentityResources> GetAllResourcesAsync()
{ {
var identity = DbContext.IdentityResources var identity = DbContext.IdentityResources
.Include(x => x.UserClaims); .Include(x => x.UserClaims);
@ -70,7 +70,7 @@ namespace Volo.Abp.IdentityServer
.ThenInclude(s => s.UserClaims) .ThenInclude(s => s.UserClaims)
.Include(x => x.UserClaims); .Include(x => x.UserClaims);
return Task.FromResult(new ApiResources.ApiResources(identity.ToArrayAsync(), apis.ToArrayAsync())); return Task.FromResult(new ApiResources.ApiAndIdentityResources(identity.ToArrayAsync(), apis.ToArrayAsync()));
} }
} }
} }

Loading…
Cancel
Save