Ajout de l'authentification (compte unique, JWT, reset par email)
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).
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using SchotzIadKmTracker.Api.Models.Entities;
|
||||
|
||||
namespace SchotzIadKmTracker.Api.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service d'émission des jetons JWT d'authentification.
|
||||
/// </summary>
|
||||
public interface IJwtService
|
||||
{
|
||||
/// <summary>
|
||||
/// Émet un Jeton_JWT signé en HS256 pour le compte fourni.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Le jeton porte les claims <c>sub</c> (identifiant du compte), <c>email</c> et un
|
||||
/// identifiant unique <c>jti</c>. Sa date d'expiration vaut l'instant courant plus
|
||||
/// <c>JwtOptions.ExpirationMinutes</c> (720 minutes / 12 h par défaut). Aucune donnée
|
||||
/// sensible n'est incluse (jamais le hachage du mot de passe).
|
||||
/// Exigences 2.1 (émission du jeton à la connexion), 2.4 (date d'expiration associée),
|
||||
/// 5.4 (expiration à 12 h par défaut).
|
||||
/// </remarks>
|
||||
/// <param name="compte">Le compte pour lequel émettre le jeton.</param>
|
||||
/// <returns>Le Jeton_JWT sérialisé (chaîne compacte).</returns>
|
||||
string GenererJeton(Compte compte);
|
||||
}
|
||||
Reference in New Issue
Block a user