我在每个应用程序启动时都有这个。
有谁知道这是从哪里来的?
信息:Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] 用户配置文件可用。使用“/Users/thomas/.aspnet/DataProtection-Keys”作为密钥库;密钥不会被静态加密。
// run the web host
var PathToContentRoot = Directory.GetCurrentDirectory();
var Host = WebHost.CreateDefaultBuilder()
.UseKestrel()
.UseContentRoot(PathToContentRoot)
.UseStartup<WebStartup>()
.UseNLog()
.Build();
Run Code Online (Sandbox Code Playgroud)
我对“数据保护”、“密钥”等一无所知,也不想要任何形式的安全功能。
ConfigureServices 部分的代码是:
// find all controllers
var Controllers =
from a in AppDomain.CurrentDomain.GetAssemblies().AsParallel()
from t in a.GetTypes()
let attributes = t.GetCustomAttributes(typeof(ControllerAttribute), true)
where attributes?.Length > 0
select new { Type = t };
var ControllersList = Controllers.ToList();
Logging.Info($"Found {ControllersList.Count} controllers");
// register them
foreach (var Controller in ControllersList)
{
Logging.Info($"[Controller] Registering {Controller.Type.Name}");
Services
.AddMvc()
.AddJsonOptions(Options => Options.SerializerSettings.ContractResolver = new DefaultContractResolver())
.AddApplicationPart(Controller.Type.Assembly);
}
// add signalR
Services.AddSignalR();
Run Code Online (Sandbox Code Playgroud)
这样做是为了允许使用来自外部程序集的控制器。
根据您使用的 ASP.NET 功能,可以设置核心数据保护中间件并将其添加到依赖项注入容器中。
这提供了一种存储敏感数据的机制。根据您运行的环境,敏感数据将存储在不同的位置。在您的情况下,您收到的消息是它以纯文本形式存储在用户配置文件(系统上的文件夹)中(我假设是因为您在 Linux 上运行,因为默认情况下它们在 Windows 上会被加密)。本文很好地描述了存储敏感数据的默认位置。
在您的情况下,我怀疑是使用 SignalR 导致添加了核心数据保护中间件。添加它的另一个常见原因是调用
IServiceCollection.AddAuthentication
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4996 次 |
最近记录: |