#1 : Gougougaga.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
namespace Webzine.WebApplication.Controllers
|
||||
{
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Webzine.Repository.Contracts;
|
||||
@@ -39,7 +38,6 @@
|
||||
/// </summary>
|
||||
/// <param name="page">Le numéro de page pour la pagination des titres (par défaut à 0).</param>
|
||||
/// <returns>La vue Index avec le ViewModel contenant les listes de titres à afficher.</returns>
|
||||
[Authorize(Roles = "ADMIN")]
|
||||
public IActionResult Index(int page = 0)
|
||||
{
|
||||
this.logger.LogInformation("Arrivée sur la page d'accueil");
|
||||
|
||||
@@ -37,26 +37,44 @@
|
||||
|
||||
this.logger.LogInformation("[IN] TraceId: {traceId} | Méthode: {methode} | Endpoint: {endpoint}", traceId, methode, endpoint);
|
||||
|
||||
await this.next(context);
|
||||
|
||||
// (Après le contrôleur)
|
||||
chronometre.Stop(); // arrête le chrono
|
||||
var tempsEcoule = chronometre.ElapsedMilliseconds;
|
||||
|
||||
var httpCode = context.Response.StatusCode; // exemple: 200, 404, 500
|
||||
|
||||
// --- OUT ---
|
||||
if (httpCode >= 500)
|
||||
try
|
||||
{
|
||||
this.logger.LogError("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
await this.next(context);
|
||||
}
|
||||
else if (httpCode >= 400)
|
||||
catch (Exception exception)
|
||||
{
|
||||
this.logger.LogWarning("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
chronometre.Stop();
|
||||
this.logger.LogError(
|
||||
exception,
|
||||
"[EXCEPTION] TraceId: {traceId} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}",
|
||||
traceId,
|
||||
chronometre.ElapsedMilliseconds,
|
||||
endpoint);
|
||||
throw;
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
this.logger.LogInformation("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
if (chronometre.IsRunning)
|
||||
{
|
||||
chronometre.Stop();
|
||||
}
|
||||
|
||||
var tempsEcoule = chronometre.ElapsedMilliseconds;
|
||||
var httpCode = context.Response.StatusCode; // exemple: 200, 404, 500
|
||||
|
||||
// --- OUT ---
|
||||
if (httpCode >= 500)
|
||||
{
|
||||
this.logger.LogError("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
}
|
||||
else if (httpCode >= 400)
|
||||
{
|
||||
this.logger.LogWarning("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logger.LogInformation("[OUT] TraceId: {traceId} | HTTP {httpCode} | Temps: {tempsEcoule} ms | Endpoint: {endpoint}", traceId, httpCode, tempsEcoule, endpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Webzine.WebApplication/Views/Account/AuthError.cshtml
Normal file
19
Webzine.WebApplication/Views/Account/AuthError.cshtml
Normal file
@@ -0,0 +1,19 @@
|
||||
@{
|
||||
ViewData["Title"] = "Erreur de connexion";
|
||||
var message = ViewData["Message"]?.ToString();
|
||||
}
|
||||
|
||||
<div class="container mt-5 text-center">
|
||||
<h2>Erreur de connexion</h2>
|
||||
|
||||
<p>La connexion avec Keycloak n'a pas pu aboutir.</p>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
<pre class="alert alert-danger text-start">@message</pre>
|
||||
}
|
||||
|
||||
<a href="/" class="btn btn-secondary">
|
||||
Retour à l'accueil
|
||||
</a>
|
||||
</div>
|
||||
@@ -4,5 +4,8 @@
|
||||
"SpotifySeeder": {
|
||||
"ClientId": "",
|
||||
"ClientSecret": ""
|
||||
},
|
||||
"Keycloak": {
|
||||
"PublicOrigin": "http://192.168.10.80:8080"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user