fucking versioning. cleaned up debugs
This commit is contained in:
-60
@@ -150,34 +150,6 @@ fwdOpts.KnownProxies.Clear();
|
|||||||
app.UseForwardedHeaders(fwdOpts);
|
app.UseForwardedHeaders(fwdOpts);
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.Use(async (ctx, next) =>
|
|
||||||
{
|
|
||||||
var raw = ctx.Request.Headers.Cookie.ToString();
|
|
||||||
var session = ctx.Request.Cookies[".Divers.Admin.Session"];
|
|
||||||
if (!string.IsNullOrEmpty(raw))
|
|
||||||
app.Logger.LogInformation("RAW Cookie Header: {Raw}", raw);
|
|
||||||
app.Logger.LogInformation("Decoded Session Cookie: {Session}", session ?? "<null>");
|
|
||||||
|
|
||||||
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) ----
|
// ---- Session middleware (must be before routing) ----
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
|
||||||
@@ -268,38 +240,6 @@ app.MapGet("/health/ready", async (IRedisManager rm, HealthCheckService hc) =>
|
|||||||
catch { return Results.StatusCode(503); }
|
catch { return Results.StatusCode(503); }
|
||||||
});
|
});
|
||||||
|
|
||||||
app.Use(async (ctx, next) =>
|
|
||||||
{
|
|
||||||
app.Logger.LogInformation("REQ {Method} {Scheme}://{Host}{Path} CookieHdrLen={Len}",
|
|
||||||
ctx.Request.Method,
|
|
||||||
ctx.Request.Scheme,
|
|
||||||
ctx.Request.Host.Value,
|
|
||||||
ctx.Request.Path.Value,
|
|
||||||
ctx.Request.Headers.Cookie.ToString().Length);
|
|
||||||
|
|
||||||
await next();
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
else if (sc.Contains(".Divers.Admin.Session", StringComparison.OrdinalIgnoreCase))
|
|
||||||
app.Logger.LogInformation("SET-COOKIE SESSION: {SetCookie}", sc);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.Map("/ws", async (HttpContext httpContext, NetworkManager networkManager) =>
|
app.Map("/ws", async (HttpContext httpContext, NetworkManager networkManager) =>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using GameServices.Auth;
|
|||||||
|
|
||||||
namespace GameServices.Admin.Pages;
|
namespace GameServices.Admin.Pages;
|
||||||
|
|
||||||
[IgnoreAntiforgeryToken]
|
|
||||||
public class LoginModel : PageModel
|
public class LoginModel : PageModel
|
||||||
{
|
{
|
||||||
private readonly GameDbContext _db;
|
private readonly GameDbContext _db;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning",
|
"Microsoft.AspNetCore": "Warning",
|
||||||
"Microsoft.AspNetCore.DataProtection": "Debug",
|
|
||||||
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
|
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user