|
|
|
@ -1,4 +1,6 @@ |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using IdentityServer4.Services; |
|
|
|
using IdentityServer4.Stores; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.AutoMapper; |
|
|
|
using Volo.Abp.Domain; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
@ -8,11 +10,13 @@ using Volo.Abp.Security; |
|
|
|
|
|
|
|
namespace Volo.Abp.IdentityServer |
|
|
|
{ |
|
|
|
[DependsOn(typeof(AbpIdentityServerDomainSharedModule))] |
|
|
|
[DependsOn(typeof(AbpDddDomainModule))] |
|
|
|
[DependsOn(typeof(AbpAutoMapperModule))] |
|
|
|
[DependsOn(typeof(AbpIdentityDomainModule))] |
|
|
|
[DependsOn(typeof(AbpSecurityModule))] |
|
|
|
[DependsOn( |
|
|
|
typeof(AbpIdentityServerDomainSharedModule), |
|
|
|
typeof(AbpDddDomainModule), |
|
|
|
typeof(AbpAutoMapperModule), |
|
|
|
typeof(AbpIdentityDomainModule), |
|
|
|
typeof(AbpSecurityModule) |
|
|
|
)] |
|
|
|
public class AbpIdentityServerDomainModule : AbpModule |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
@ -24,9 +28,12 @@ namespace Volo.Abp.IdentityServer |
|
|
|
|
|
|
|
AddIdentityServer(context.Services); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void AddIdentityServer(IServiceCollection services) |
|
|
|
{ |
|
|
|
var configuration = services.GetConfiguration(); |
|
|
|
var builderOptions = services.ExecutePreConfiguredActions<AbpIdentityServerBuilderOptions>(); |
|
|
|
|
|
|
|
var identityServerBuilder = services.AddIdentityServer(options => |
|
|
|
{ |
|
|
|
options.Events.RaiseErrorEvents = true; |
|
|
|
@ -37,11 +44,25 @@ namespace Volo.Abp.IdentityServer |
|
|
|
|
|
|
|
identityServerBuilder |
|
|
|
.AddDeveloperSigningCredential() //TODO: Should be able to change this!
|
|
|
|
.AddClientStore<ClientStore>() |
|
|
|
.AddResourceStore<ResourceStore>() |
|
|
|
.AddAbpIdentityServer(); |
|
|
|
.AddAbpIdentityServer(builderOptions); |
|
|
|
|
|
|
|
services.ExecutePreConfiguredActions(identityServerBuilder); |
|
|
|
|
|
|
|
if (!services.IsAdded<IPersistedGrantService>()) |
|
|
|
{ |
|
|
|
identityServerBuilder.AddInMemoryPersistedGrants(); |
|
|
|
} |
|
|
|
|
|
|
|
if (!services.IsAdded<IClientStore>()) |
|
|
|
{ |
|
|
|
identityServerBuilder.AddInMemoryClients(configuration.GetSection("IdentityServer:Clients")); |
|
|
|
} |
|
|
|
|
|
|
|
if (!services.IsAdded<IResourceStore>()) |
|
|
|
{ |
|
|
|
identityServerBuilder.AddInMemoryApiResources(configuration.GetSection("IdentityServer:ApiResources")); |
|
|
|
identityServerBuilder.AddInMemoryIdentityResources(configuration.GetSection("IdentityServer:IdentityResources")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|