Rendre le site public et restaurer les acces compte
This commit is contained in:
@@ -1,32 +1,8 @@
|
||||
<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);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</Authorized>
|
||||
<Authorizing>
|
||||
<div class="user-access-bar">
|
||||
<div class="user-access-copy">
|
||||
<span class="micro-label">Compte Keycloak</span>
|
||||
<strong>Connexion optionnelle</strong>
|
||||
<span class="user-access-meta">Le site reste accessible sans connexion. Vous pouvez vous connecter ou creer un compte si besoin.</span>
|
||||
</div>
|
||||
<div class="user-access-actions">
|
||||
<a class="button primary small" href="@LoginHref">Se connecter</a>
|
||||
<a class="button ghost small" href="@RegisterHref">Creer un compte</a>
|
||||
</div>
|
||||
</div>
|
||||
</Authorizing>
|
||||
<NotAuthorized>
|
||||
<div class="user-access-bar">
|
||||
<div class="user-access-copy">
|
||||
<span class="micro-label">Compte Keycloak</span>
|
||||
<strong>Connexion requise pour lancer et reprendre les matchs</strong>
|
||||
<span class="user-access-meta">Chaque compte conserve son propre etat de match dans ce navigateur.</span>
|
||||
<strong>Connexion optionnelle</strong>
|
||||
<span class="user-access-meta">Le site reste accessible sans connexion. Chaque compte conserve son propre etat de match dans ce navigateur.</span>
|
||||
</div>
|
||||
<div class="user-access-actions">
|
||||
<a class="button primary small" href="@LoginHref">Se connecter</a>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@page "/application"
|
||||
@page "/application.html"
|
||||
@attribute [Authorize]
|
||||
@inject BrowserBridge Browser
|
||||
@inject MatchStore Store
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@page "/chrono"
|
||||
@page "/chrono.html"
|
||||
@attribute [Authorize]
|
||||
@implements IAsyncDisposable
|
||||
@inject MatchStore Store
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@page "/cube"
|
||||
@page "/cube.html"
|
||||
@attribute [Authorize]
|
||||
@implements IAsyncDisposable
|
||||
@inject BrowserBridge Browser
|
||||
@inject MatchStore Store
|
||||
|
||||
@@ -22,13 +22,19 @@
|
||||
passe par une phase cube obligatoire, puis la partie repart avec un
|
||||
nouveau rythme.
|
||||
</p>
|
||||
<UserAccessBar ReturnUrl="/application.html" />
|
||||
<div class="hero-actions">
|
||||
<a class="button primary" href="application.html">Ouvrir l'application</a>
|
||||
<a class="button secondary" href="reglement.html">Lire le reglement</a>
|
||||
<a class="button ghost" href="/ethan/">Ouvrir l'appli d'Ethan</a>
|
||||
<a class="button ghost" href="/brice/">Ouvrir l'appli de Brice</a>
|
||||
</div>
|
||||
<div class="hero-account-actions">
|
||||
<span class="micro-label">Compte Keycloak</span>
|
||||
<div class="hero-account-buttons">
|
||||
<a class="button secondary small" href="authentication/login?returnUrl=%2Fapplication.html">Se connecter</a>
|
||||
<a class="button ghost small" href="authentication/register?returnUrl=%2Fapplication.html">Creer un compte</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="hero-preview">
|
||||
|
||||
@@ -33,7 +33,7 @@ Le projet continue a exposer les routes historiques `index.html`, `application.h
|
||||
|
||||
L'application embarque maintenant une authentification OpenID Connect basee sur Keycloak.
|
||||
|
||||
- les pages `application.html`, `chrono.html` et `cube.html` demandent une connexion
|
||||
- toutes les pages du site restent accessibles sans connexion
|
||||
- la page d'accueil et la page reglement affichent l'etat de session courant
|
||||
- la page d'accueil propose directement des actions `Se connecter` et `Creer un compte`
|
||||
- les roles Keycloak du realm sont exposes dans l'application
|
||||
|
||||
12
styles.css
12
styles.css
@@ -1047,8 +1047,16 @@ body[data-page="cube"] .zone-button.cube-hold-ready::after {
|
||||
margin-top: 1.2rem;
|
||||
}
|
||||
|
||||
.hero-actions-utility {
|
||||
margin-top: 0.75rem;
|
||||
.hero-account-actions {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.hero-account-buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.user-access-bar {
|
||||
|
||||
Reference in New Issue
Block a user