Application mono-utilisateur : inscription unique, connexion par JWT (12 h), protection de toutes les routes de données, réinitialisation de mot de passe par email avec repli de journalisation, onboarding réorganisé en deux étapes (inscription → connexion → profil + véhicule). Backend (SchotzIadKmTracker.Api) : - Entités Compte (singleton) et ResetPasswordToken + migration AjoutAuthentification. - Hachage PasswordHasher, JwtService (HS256, durée configurable), IEmailService (MailKit + repli LoggingEmailService selon Smtp:Host). - AuthService (register 409 si compte existant, login 401 générique, forgot-password non-divulgation, reset à usage unique + expiration), AuthController (5 endpoints publics), DTOs + validateurs FluentValidation. - Sécurité pipeline : JwtBearer + filtre d'autorisation global, UseAuthentication avant UseAuthorization ; /health et /api/auth/* publics. Frontend (schotziad-km-tracker, zoneless + signals) : - AuthService (localStorage), authInterceptor (Bearer + purge/redirection 401), authGuard, écrans Login/Register/ForgotPassword/ResetPassword, routes publiques et protection [authGuard, profilConfigureGuard]. Configuration : .env.example et docker-compose.yml (JWT__SecretKey, durées, Smtp__*). Tests : 54 tests backend (propriétés FsCheck P1–P14, exemples, intégration WebApplicationFactory) + tests frontend (AuthService, authGuard, authInterceptor, ResetPasswordComponent). Suite complète au vert. Spec : .kiro/specs/authentification (requirements, design, tasks).
20 lines
730 B
C#
20 lines
730 B
C#
namespace SchotzIadKmTracker.Api.Configuration;
|
|
|
|
/// <summary>Options de configuration des jetons JWT d'authentification.</summary>
|
|
public class JwtOptions
|
|
{
|
|
public const string SectionName = "Jwt";
|
|
|
|
/// <summary>Clé secrète utilisée pour signer les jetons (HS256).</summary>
|
|
public string SecretKey { get; set; } = string.Empty;
|
|
|
|
/// <summary>Émetteur (issuer) des jetons.</summary>
|
|
public string Issuer { get; set; } = "SchotzIadKmTracker";
|
|
|
|
/// <summary>Audience attendue des jetons.</summary>
|
|
public string Audience { get; set; } = "SchotzIadKmTracker";
|
|
|
|
/// <summary>Durée de validité d'un jeton en minutes (720 = 12 h).</summary>
|
|
public int ExpirationMinutes { get; set; } = 720;
|
|
}
|