#1 : Test de Keycloak.
This commit is contained in:
13
Webzine.WebApplication/Views/Account/AccessDenied.cshtml
Normal file
13
Webzine.WebApplication/Views/Account/AccessDenied.cshtml
Normal file
@@ -0,0 +1,13 @@
|
||||
@{
|
||||
ViewData["Title"] = "Accès refusé";
|
||||
}
|
||||
|
||||
<div class="container mt-5 text-center">
|
||||
<h2>Accès refusé</h2>
|
||||
|
||||
<p>Vous n'avez pas les droits pour accéder à cette page.</p>
|
||||
|
||||
<a href="/" class="btn btn-secondary">
|
||||
Retour à l'accueil
|
||||
</a>
|
||||
</div>
|
||||
15
Webzine.WebApplication/Views/Account/Login.cshtml
Normal file
15
Webzine.WebApplication/Views/Account/Login.cshtml
Normal file
@@ -0,0 +1,15 @@
|
||||
@{
|
||||
ViewData["Title"] = "Connexion";
|
||||
}
|
||||
|
||||
<div class="container mt-5 text-center">
|
||||
<h2>Connexion</h2>
|
||||
|
||||
<p>Vous allez être redirigé vers le serveur d'authentification.</p>
|
||||
|
||||
<a asp-controller="Account"
|
||||
asp-action="Login"
|
||||
class="btn btn-primary">
|
||||
Se connecter avec Keycloak
|
||||
</a>
|
||||
</div>
|
||||
15
Webzine.WebApplication/Views/Account/Logout.cshtml
Normal file
15
Webzine.WebApplication/Views/Account/Logout.cshtml
Normal file
@@ -0,0 +1,15 @@
|
||||
@{
|
||||
ViewData["Title"] = "Déconnexion";
|
||||
}
|
||||
|
||||
<div class="container mt-5 text-center">
|
||||
<h2>Déconnexion</h2>
|
||||
|
||||
<p>Vous êtes sur le point de vous déconnecter.</p>
|
||||
|
||||
<form asp-controller="Account" asp-action="Logout" method="get">
|
||||
<button type="submit" class="btn btn-danger">
|
||||
Se déconnecter
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -14,6 +14,24 @@
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
<partial name="_Header"/>
|
||||
@if (User.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
<span class="me-2">Bonjour @User.Identity.Name</span>
|
||||
|
||||
<a asp-controller="Account"
|
||||
asp-action="Logout"
|
||||
class="btn btn-outline-danger btn-sm">
|
||||
Déconnexion
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a asp-controller="Account"
|
||||
asp-action="Login"
|
||||
class="btn btn-outline-primary btn-sm">
|
||||
Connexion
|
||||
</a>
|
||||
}
|
||||
<div class="container-fluid flex-grow-1 py-4">
|
||||
<div class="row">
|
||||
<main class="col mx-3">
|
||||
|
||||
Reference in New Issue
Block a user