|
|
|
@ -7,6 +7,7 @@ using MyCompanyName.MyProjectName.Localization.MyProjectName; |
|
|
|
using MyCompanyName.MyProjectName.Menus; |
|
|
|
using Swashbuckle.AspNetCore.Swagger; |
|
|
|
using System.IO; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using MyCompanyName.MyProjectName.MultiTenancy; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Account.Web; |
|
|
|
@ -23,6 +24,7 @@ using Volo.Abp.Localization; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.PermissionManagement.Web; |
|
|
|
using Volo.Abp.TenantManagement.Web; |
|
|
|
using Volo.Abp.Ui.Navigation.Urls; |
|
|
|
using Volo.Abp.UI; |
|
|
|
using Volo.Abp.UI.Navigation; |
|
|
|
using Volo.Abp.VirtualFileSystem; |
|
|
|
@ -35,7 +37,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
typeof(MyProjectNameEntityFrameworkCoreModule), |
|
|
|
typeof(AbpAutofacModule), |
|
|
|
typeof(AbpIdentityWebModule), |
|
|
|
typeof(AbpAccountWebModule), |
|
|
|
typeof(AbpAccountWebIdentityServerModule), |
|
|
|
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|
|
|
typeof(AbpTenantManagementWebModule) |
|
|
|
)] |
|
|
|
@ -60,7 +62,9 @@ namespace MyCompanyName.MyProjectName |
|
|
|
{ |
|
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
|
|
|
|
ConfigureUrls(configuration); |
|
|
|
ConfigureAuthentication(context, configuration); |
|
|
|
ConfigureAutoMapper(); |
|
|
|
ConfigureVirtualFileSystem(hostingEnvironment); |
|
|
|
ConfigureLocalizationServices(); |
|
|
|
@ -69,6 +73,25 @@ namespace MyCompanyName.MyProjectName |
|
|
|
ConfigureSwaggerServices(context.Services); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureUrls(IConfigurationRoot configuration) |
|
|
|
{ |
|
|
|
Configure<AppUrlOptions>(options => |
|
|
|
{ |
|
|
|
options.Applications["MVC"].RootUrl = configuration["AppSelfUrl"]; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) |
|
|
|
{ |
|
|
|
context.Services.AddAuthentication() |
|
|
|
.AddIdentityServerAuthentication(options => |
|
|
|
{ |
|
|
|
options.Authority = configuration["AuthServer:Authority"]; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
options.ApiName = "MyProjectName"; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureAutoMapper() |
|
|
|
{ |
|
|
|
Configure<AbpAutoMapperOptions>(options => |
|
|
|
@ -164,12 +187,15 @@ namespace MyCompanyName.MyProjectName |
|
|
|
|
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseIdentityServer(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
|