33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
<CascadingAuthenticationState>
|
|
<Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(Pages.NotFound)">
|
|
<Found Context="routeData">
|
|
@if (RequiresAuthorization(routeData.PageType))
|
|
{
|
|
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)">
|
|
<Authorizing>
|
|
<main class="rules-shell">
|
|
<section class="panel panel-wide cta-panel" style="margin-top: 2rem;">
|
|
<p class="eyebrow">Authentification</p>
|
|
<h1>Verification de la session en cours...</h1>
|
|
</section>
|
|
</main>
|
|
</Authorizing>
|
|
<NotAuthorized>
|
|
<RedirectToLogin />
|
|
</NotAuthorized>
|
|
</AuthorizeRouteView>
|
|
}
|
|
else
|
|
{
|
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)" />
|
|
}
|
|
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
|
</Found>
|
|
</Router>
|
|
</CascadingAuthenticationState>
|
|
|
|
@code {
|
|
private static bool RequiresAuthorization(Type pageType)
|
|
=> Attribute.IsDefined(pageType, typeof(AuthorizeAttribute), inherit: true);
|
|
}
|