|
|
@ -1,5 +1,4 @@ |
|
|
using DotNetCore.CAP; |
|
|
using LINGYUN.Abp.AspNetCore.HttpOverrides; |
|
|
using LINGYUN.Abp.AspNetCore.HttpOverrides; |
|
|
|
|
|
using LINGYUN.Abp.AuditLogging.Elasticsearch; |
|
|
using LINGYUN.Abp.AuditLogging.Elasticsearch; |
|
|
using LINGYUN.Abp.EventBus.CAP; |
|
|
using LINGYUN.Abp.EventBus.CAP; |
|
|
using LINGYUN.Abp.Identity.EntityFrameworkCore; |
|
|
using LINGYUN.Abp.Identity.EntityFrameworkCore; |
|
|
@ -8,14 +7,12 @@ using LINGYUN.Abp.IdentityServer.EntityFrameworkCore; |
|
|
using LINGYUN.Abp.IdentityServer.WeChat; |
|
|
using LINGYUN.Abp.IdentityServer.WeChat; |
|
|
using LINGYUN.Abp.MultiTenancy.DbFinder; |
|
|
using LINGYUN.Abp.MultiTenancy.DbFinder; |
|
|
using LINGYUN.Abp.PermissionManagement.Identity; |
|
|
using LINGYUN.Abp.PermissionManagement.Identity; |
|
|
|
|
|
using LINGYUN.Abp.Serilog.Enrichers.Application; |
|
|
using LINGYUN.Abp.Sms.Aliyun; |
|
|
using LINGYUN.Abp.Sms.Aliyun; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.Hosting; |
|
|
using Microsoft.Extensions.Hosting; |
|
|
using System.IO; |
|
|
|
|
|
using System.Security.Cryptography.X509Certificates; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Account; |
|
|
using Volo.Abp.Account; |
|
|
using Volo.Abp.Account.Web; |
|
|
using Volo.Abp.Account.Web; |
|
|
@ -28,7 +25,6 @@ using Volo.Abp.Caching.StackExchangeRedis; |
|
|
using Volo.Abp.EntityFrameworkCore.MySQL; |
|
|
using Volo.Abp.EntityFrameworkCore.MySQL; |
|
|
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.Identity; |
|
|
using Volo.Abp.Identity; |
|
|
using Volo.Abp.IdentityServer; |
|
|
|
|
|
using Volo.Abp.IdentityServer.Jwt; |
|
|
using Volo.Abp.IdentityServer.Jwt; |
|
|
using Volo.Abp.Modularity; |
|
|
using Volo.Abp.Modularity; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
@ -38,8 +34,8 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|
|
namespace AuthServer.Host |
|
|
namespace AuthServer.Host |
|
|
{ |
|
|
{ |
|
|
[DependsOn( |
|
|
[DependsOn( |
|
|
|
|
|
typeof(AbpSerilogEnrichersApplicationModule), |
|
|
typeof(AbpAspNetCoreSerilogModule), |
|
|
typeof(AbpAspNetCoreSerilogModule), |
|
|
typeof(AbpAuditLoggingElasticsearchModule), |
|
|
|
|
|
typeof(AbpAccountWebIdentityServerModule), |
|
|
typeof(AbpAccountWebIdentityServerModule), |
|
|
typeof(AbpAccountApplicationModule), |
|
|
typeof(AbpAccountApplicationModule), |
|
|
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|
|
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|
|
@ -58,6 +54,7 @@ namespace AuthServer.Host |
|
|
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|
|
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|
|
|
|
|
typeof(AbpAuditLoggingElasticsearchModule), // 放在 AbpIdentity 模块之后,避免被覆盖
|
|
|
typeof(AbpAspNetCoreHttpOverridesModule), |
|
|
typeof(AbpAspNetCoreHttpOverridesModule), |
|
|
typeof(AbpDbFinderMultiTenancyModule), |
|
|
typeof(AbpDbFinderMultiTenancyModule), |
|
|
typeof(AbpCAPEventBusModule), |
|
|
typeof(AbpCAPEventBusModule), |
|
|
@ -72,39 +69,9 @@ namespace AuthServer.Host |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
|
|
|
|
|
|
PreConfigure<CapOptions>(options => |
|
|
PreConfigureApp(); |
|
|
{ |
|
|
PreConfigureCAP(configuration); |
|
|
options |
|
|
PreConfigureCertificate(configuration, hostingEnvironment); |
|
|
.UseMySql(configuration.GetConnectionString("Default")) |
|
|
|
|
|
.UseRabbitMQ(rabbitMQOptions => |
|
|
|
|
|
{ |
|
|
|
|
|
configuration.GetSection("CAP:RabbitMQ").Bind(rabbitMQOptions); |
|
|
|
|
|
}) |
|
|
|
|
|
.UseDashboard(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var cerConfig = configuration.GetSection("Certificates"); |
|
|
|
|
|
if (hostingEnvironment.IsProduction() && |
|
|
|
|
|
cerConfig.Exists()) |
|
|
|
|
|
{ |
|
|
|
|
|
// 开发环境下存在证书配置
|
|
|
|
|
|
// 且证书文件存在则使用自定义的证书文件来启动Ids服务器
|
|
|
|
|
|
var cerPath = Path.Combine(hostingEnvironment.ContentRootPath, cerConfig["CerPath"]); |
|
|
|
|
|
if (File.Exists(cerPath)) |
|
|
|
|
|
{ |
|
|
|
|
|
PreConfigure<AbpIdentityServerBuilderOptions>(options => |
|
|
|
|
|
{ |
|
|
|
|
|
options.AddDeveloperSigningCredential = false; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var cer = new X509Certificate2(cerPath, cerConfig["Password"]); |
|
|
|
|
|
|
|
|
|
|
|
PreConfigure<IIdentityServerBuilder>(builder => |
|
|
|
|
|
{ |
|
|
|
|
|
builder.AddSigningCredential(cer); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|