Files
Heimdall/src/Heimdall.Web/Components/Routes.razor
T
Arnaud Dartois 129bcfa9d7 feat(ui): Blazor auth redirect + CascadingAuthenticationState
- Routes: wrap with CascadingAuthenticationState + AuthorizeRouteView
- RedirectToLogin: component that redirects unauthenticated users to /login
- HeimdallAuthStateProvider: NotifyLogin/NotifyLogout methods
- Login/Register/MainLayout: use AuthStateProvider.NotifyLogin/Logout
  instead of direct AuthState mutation (triggers Blazor auth cascade)
- _Imports: add Microsoft.AspNetCore.Components.Authorization
2026-07-17 07:05:07 +00:00

13 lines
527 B
Plaintext

<CascadingAuthenticationState>
<Router AppAssembly="typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)">
<NotAuthorized>
<RedirectToLogin />
</NotAuthorized>
</AuthorizeRouteView>
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
</Router>
</CascadingAuthenticationState>