Fix Central launch profile: auth middleware, cookie auth, antiforgery, static files

- Add UseAuthentication/UseAuthorization/UseAntiforgery/UseStaticFiles middleware
- Register ASP.NET Core cookie authentication scheme in AddSecurity()
- Update auth endpoints to use SignInAsync/SignOutAsync (proper cookie auth)
- Add [AllowAnonymous] to login page
- Create wwwroot for static file serving
- Regenerate clean EF migration after model changes

Verified with launch profile "ScadaLink Central":
- Host starts, connects to SQL Server, applies EF migrations
- Akka.NET cluster forms (remoting on 8081, node joins self as leader)
- /health/ready returns Healthy (DB + Akka checks)
- LDAP auth works (admin/password via GLAuth → 302 + auth cookie set)
- Login page renders (HTTP 200)
- Unauthenticated requests redirect to /login
This commit is contained in:
Joseph Doherty
2026-03-17 03:43:11 -04:00
parent 121983fd66
commit 0b10747bd2
6 changed files with 1061 additions and 24 deletions

View File

@@ -108,6 +108,12 @@ try
}
}
// Middleware pipeline
app.UseStaticFiles();
app.UseAuthentication();
app.UseAuthorization();
app.UseAntiforgery();
// WP-12: Map readiness endpoint — returns 503 until all checks pass, 200 when ready
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{