去掉DataProtection

This commit is contained in:
yubaolee 2024-11-29 16:48:09 +08:00
parent 50a848e2af
commit 9c69df2a36
4 changed files with 2 additions and 38 deletions

View File

@ -6,7 +6,6 @@ using Infrastructure.Extensions.AutofacManager;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -70,7 +69,7 @@ namespace OpenAuth.Mvc
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
//关闭GDPR规范
options.CheckConsentNeeded = context => false;
options.CheckConsentNeeded = (HttpContext context) => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
@ -99,8 +98,6 @@ namespace OpenAuth.Mvc
services.AddHttpClient();
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Configuration["DataProtection"]));
var sqlsugarTypes = UtilMethods.EnumToDictionary<SqlSugar.DbType>();
var dbType = sqlsugarTypes.FirstOrDefault(it =>
dbtypes.ToDictionary(u => u.Key, v => v.Value.ToLower()).ContainsValue(it.Key));
@ -123,7 +120,6 @@ namespace OpenAuth.Mvc
//设置定时启动的任务
services.AddHostedService<QuartzService>();
}
public void ConfigureContainer(ContainerBuilder builder)

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="628839e2-4f54-416f-9b66-23fafd007ab0" version="1">
<creationDate>2020-04-24T08:26:04.9990208Z</creationDate>
<activationDate>2020-04-24T08:26:04.9481282Z</activationDate>
<expirationDate>2020-07-23T08:26:04.9481282Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>blC9xnXdRf5Uytfd1qOaGG6Z9ouurZ4j3p9UUlOs54j0xEhqd01y0AmwUfrJDp37+HZqODq8vgzGz6xBDgv9ZQ==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="dbe172a1-9e7b-4886-a94e-de8124a4bd0d" version="1">
<creationDate>2020-09-10T03:37:11.831349Z</creationDate>
<activationDate>2020-09-10T03:37:11.7080375Z</activationDate>
<expirationDate>2020-12-09T03:37:11.7080375Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>Db49pYY35Nbu4v2FWzc+MuYyu8RO8z/T8pkaHAH/M6aeVmjyeXaBfHnmOiS5LMitCKDqGBTUh15xNCErxEvQzg==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@ -130,7 +130,7 @@ namespace OpenAuth.WebApi
// options.SuppressModelStateInvalidFilter = true;
//启动WebAPI自动模态验证处理返回值
options.InvalidModelStateResponseFactory = context =>
options.InvalidModelStateResponseFactory = (ActionContext context) =>
{
var problems = new CustomBadRequest(context);