WBS-11 BFF Hardening: Implement auth caching state provider for instant sidebar transitions, forward proxy authentication cookies, and resolve WASM server-side prerendering BaseAddress null exception
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 8s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 14s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Failing after 3m7s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 8s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 14s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Failing after 3m7s
This commit is contained in:
@@ -42,11 +42,22 @@ namespace QuantEngine.Web.Pages.Account
|
||||
try
|
||||
{
|
||||
var loginRequest = new { Username = username, Password = password };
|
||||
var requestUri = $"{Request.Scheme}://{Request.Host}/api/auth/login";
|
||||
var scheme = string.IsNullOrWhiteSpace(Request.Scheme) ? "http" : Request.Scheme;
|
||||
var host = Request.Host.HasValue ? Request.Host.Value : "localhost:5265";
|
||||
var requestUri = $"{scheme}://{host}/api/auth/login";
|
||||
var response = await _httpClient.PostAsJsonAsync(requestUri, loginRequest);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
// Extract set-cookie header from API response and set it on proxy client response
|
||||
if (response.Headers.TryGetValues("Set-Cookie", out var cookieHeaders))
|
||||
{
|
||||
foreach (var cookieHeader in cookieHeaders)
|
||||
{
|
||||
Response.Headers.Append("Set-Cookie", cookieHeader);
|
||||
}
|
||||
}
|
||||
|
||||
if (rememberUsername)
|
||||
{
|
||||
Response.Cookies.Append(
|
||||
@@ -84,5 +95,12 @@ namespace QuantEngine.Web.Pages.Account
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetLogout()
|
||||
{
|
||||
// Revoke cookies securely
|
||||
Response.Cookies.Delete("quant_auth_token");
|
||||
return Redirect("/Account/Login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user