Tsing still..
This commit is contained in:
+18
@@ -160,6 +160,24 @@ app.Use(async (ctx, next) =>
|
||||
|
||||
await next();
|
||||
});
|
||||
app.Use(async (ctx, next) =>
|
||||
{
|
||||
// DP round-trip sanity check to verify protect/unprotect uses same key ring.
|
||||
try
|
||||
{
|
||||
var dp = ctx.RequestServices.GetRequiredService<IDataProtectionProvider>();
|
||||
var protector = dp.CreateProtector("SystemRevivalServer.DPTest");
|
||||
var protectedValue = protector.Protect("ping");
|
||||
var unprotectedValue = protector.Unprotect(protectedValue);
|
||||
app.Logger.LogInformation("DP round-trip OK: {Value}", unprotectedValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
app.Logger.LogError(ex, "DP round-trip FAILED");
|
||||
}
|
||||
|
||||
await next();
|
||||
});
|
||||
// ---- Session middleware (must be before routing) ----
|
||||
app.UseSession();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Microsoft.AspNetCore.DataProtection": "Debug",
|
||||
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user