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.
This commit is contained in:
Mathis HERRIOT
2026-01-29 14:37:45 +01:00
parent fafdaee668
commit 209711195b
2 changed files with 3 additions and 0 deletions

View File

@@ -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(

View File

@@ -4,5 +4,6 @@ export interface AuthenticatedRequest extends Request {
user: {
sub: string;
username: string;
role: string;
};
}