...
This commit is contained in:
+17
@@ -231,6 +231,23 @@ app.Use(async (ctx, next) =>
|
|||||||
});
|
});
|
||||||
// ---- Session middleware (must be before routing) ----
|
// ---- Session middleware (must be before routing) ----
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
app.Use(async (ctx, next) =>
|
||||||
|
{
|
||||||
|
var af = ctx.Request.Cookies[".Divers.Admin.AntiForgery"];
|
||||||
|
app.Logger.LogInformation("AF cookie present={Present} len={Len} prefix={Prefix}",
|
||||||
|
af != null,
|
||||||
|
af?.Length ?? 0,
|
||||||
|
af == null ? "" : af.Substring(0, Math.Min(25, af.Length)));
|
||||||
|
|
||||||
|
await next();
|
||||||
|
|
||||||
|
if (ctx.Response.Headers.TryGetValue("Set-Cookie", out var setCookies))
|
||||||
|
{
|
||||||
|
foreach (var sc in setCookies)
|
||||||
|
if (sc.Contains(".Divers.Admin.AntiForgery", StringComparison.OrdinalIgnoreCase))
|
||||||
|
app.Logger.LogInformation("SET-COOKIE AF: {SetCookie}", sc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ---- WebSockets endpoint ----
|
// ---- WebSockets endpoint ----
|
||||||
app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(20) });
|
app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(20) });
|
||||||
|
|||||||
Reference in New Issue
Block a user