提高
This commit is contained in:
@@ -35,16 +35,16 @@ builder.Services.AddCaptcha(builder.Configuration);
|
||||
//IPRatelimit
|
||||
builder.Services.AddIPRate(builder.Configuration);
|
||||
//builder.Services.AddSession();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddHttpContextAccessor();//todo 注册httpcontext 没事添加2个Httpcontext干嘛呀
|
||||
//绑定整个对象到Model上
|
||||
builder.Services.Configure<OptionsSetting>(builder.Configuration);
|
||||
|
||||
//jwt 认证
|
||||
//jwt 认证 Bearer认证
|
||||
builder.Services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
}).AddCookie()
|
||||
}).AddCookie()//cookie 认证没用了吧 ???????????????
|
||||
.AddJwtBearer(o =>
|
||||
{
|
||||
// 检查客户端和服务器的Token是否一样
|
||||
@@ -65,7 +65,7 @@ builder.Services.AddAuthentication(options =>
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton(new AppSettings(builder.Configuration));
|
||||
builder.Services.AddAppService();
|
||||
builder.Services.AddAppService(); //todo 注册对象
|
||||
//开启计划任务
|
||||
builder.Services.AddTaskSchedulers();
|
||||
|
||||
@@ -100,6 +100,15 @@ InternalApp.WebHostEnvironment = app.Environment;
|
||||
//初始化db
|
||||
builder.Services.AddDb(builder.Configuration, app.Environment);
|
||||
|
||||
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
//《-----------------------------------------------------------------------------------------》
|
||||
// 下面就是中间件
|
||||
|
||||
//使用全局异常中间件
|
||||
app.UseMiddleware<GlobalExceptionMiddleware>();
|
||||
|
||||
@@ -125,7 +134,7 @@ app.UseAuthentication();
|
||||
//todo 授权
|
||||
app.UseAuthorization();
|
||||
|
||||
//开启缓存
|
||||
//开启缓存 ????
|
||||
app.UseResponseCaching();
|
||||
if (builder.Environment.IsProduction())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user