feat: 搭建多租户框架

This commit is contained in:
橙子
2024-01-21 00:26:21 +08:00
parent 3412ce64cb
commit 68c1d59638
19 changed files with 527 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ using Microsoft.OpenApi.Models;
using Newtonsoft.Json.Converters;
using Volo.Abp;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Serilog;
@@ -31,8 +32,9 @@ namespace Yi.Abp.Web
[DependsOn(
typeof(YiAbpSqlSugarCoreModule),
typeof(YiAbpApplicationModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreMvcModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
@@ -105,7 +107,7 @@ namespace Yi.Abp.Web
});
});
//jwt鉴权
var jwtOptions = configuration.GetSection(nameof(JwtOptions)).Get<JwtOptions>();
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
@@ -143,7 +145,7 @@ namespace Yi.Abp.Web
.AddGitee(options =>
{
configuration.GetSection("OAuth:Gitee").Bind(options);
});
});
//授权
context.Services.AddAuthorization();
@@ -166,6 +168,9 @@ namespace Yi.Abp.Web
//鉴权
app.UseAuthentication();
//多租户
app.UseMultiTenancy();
//swagger
app.UseYiSwagger();