feat(dashboard): Blazor LoginCard page reusing the hardened /login endpoint
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
@page "/login"
|
||||
@layout LoginLayout
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@* Login MUST stay anonymously reachable — [AllowAnonymous] overrides the
|
||||
RequireAuthorization(ViewerPolicy) that MapRazorComponents<App>() applies, so the
|
||||
cookie scheme's LoginPath="/login" redirect lands here for unauthenticated users.
|
||||
|
||||
The card is the shared kit's <LoginCard>: it renders a NATIVE static
|
||||
<form method="post" action="/login"> (username/password + hidden returnUrl). A native
|
||||
form submit is not a Blazor event, so it reaches the minimal-API POST /login endpoint
|
||||
regardless of this app's InteractiveServer render mode. <AntiforgeryToken/> supplies the
|
||||
token that PostLoginAsync's antiforgery.ValidateRequestAsync checks. *@
|
||||
@attribute [AllowAnonymous]
|
||||
|
||||
<LoginCard Product="MXAccess Gateway" Action="/login" ReturnUrl="@ReturnUrl" Error="@Error">
|
||||
<AntiforgeryToken />
|
||||
</LoginCard>
|
||||
|
||||
@code {
|
||||
/// <summary>Original protected URL the operator was bounced from; round-tripped to POST /login.</summary>
|
||||
[SupplyParameterFromQuery(Name = "returnUrl")]
|
||||
private string? ReturnUrl { get; set; }
|
||||
|
||||
/// <summary>Failure message surfaced by POST /login after a failed authentication.</summary>
|
||||
[SupplyParameterFromQuery(Name = "error")]
|
||||
private string? Error { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user