|
|
|
@ -5,8 +5,10 @@ using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.OpenApi.Models; |
|
|
|
using MsDemo.Shared; |
|
|
|
using StackExchange.Redis; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
|
using Volo.Abp.Auditing; |
|
|
|
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Autofac; |
|
|
|
@ -15,6 +17,7 @@ using Volo.Abp.EntityFrameworkCore.SqlServer; |
|
|
|
using Volo.Abp.EventBus.RabbitMq; |
|
|
|
using Volo.Abp.Localization; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.MultiTenancy; |
|
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Security.Claims; |
|
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
|
@ -32,7 +35,8 @@ namespace TenantManagementService.Host |
|
|
|
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|
|
|
typeof(AbpTenantManagementHttpApiModule), |
|
|
|
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|
|
|
typeof(AbpTenantManagementApplicationModule) |
|
|
|
typeof(AbpTenantManagementApplicationModule), |
|
|
|
typeof(AbpAspNetCoreMultiTenancyModule) |
|
|
|
)] |
|
|
|
public class TenantManagementServiceHostModule : AbpModule |
|
|
|
{ |
|
|
|
@ -40,6 +44,11 @@ namespace TenantManagementService.Host |
|
|
|
{ |
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
Configure<AbpMultiTenancyOptions>(options => |
|
|
|
{ |
|
|
|
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled; |
|
|
|
}); |
|
|
|
|
|
|
|
context.Services.AddAuthentication("Bearer") |
|
|
|
.AddIdentityServerAuthentication(options => |
|
|
|
{ |
|
|
|
@ -104,7 +113,10 @@ namespace TenantManagementService.Host |
|
|
|
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); |
|
|
|
await next(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
app.UseAbpRequestLocalization(); //TODO: localization?
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|