From 209711195b01343fb63e9b7c4e07a16f96e0d2bf Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Thu, 29 Jan 2026 14:37:45 +0100 Subject: [PATCH] feat: include user role in JWT payload - Updated `request.interface.ts` to add `role` to the user object. - Modified `auth.service.ts` to include `role` in the JWT payload. --- backend/src/auth/auth.service.ts | 2 ++ backend/src/common/interfaces/request.interface.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts index f564272..f6ad9d2 100644 --- a/backend/src/auth/auth.service.ts +++ b/backend/src/auth/auth.service.ts @@ -136,6 +136,7 @@ export class AuthService { const accessToken = await this.jwtService.generateJwt({ sub: user.uuid, username: user.username, + role: user.role, }); const session = await this.sessionsService.createSession( @@ -178,6 +179,7 @@ export class AuthService { const accessToken = await this.jwtService.generateJwt({ sub: user.uuid, username: user.username, + role: user.role, }); const session = await this.sessionsService.createSession( diff --git a/backend/src/common/interfaces/request.interface.ts b/backend/src/common/interfaces/request.interface.ts index 3232547..12d2207 100644 --- a/backend/src/common/interfaces/request.interface.ts +++ b/backend/src/common/interfaces/request.interface.ts @@ -4,5 +4,6 @@ export interface AuthenticatedRequest extends Request { user: { sub: string; username: string; + role: string; }; }