renew ts value, better logging JWT
This commit is contained in:
@@ -30,7 +30,6 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
}
|
||||
|
||||
async validate(payload: JwtPayload): Promise<JwtUser> {
|
||||
this.logger.info('JWT Payload:', payload); // Debugging: JWT Payload anzeigen
|
||||
if (!payload) {
|
||||
this.logger.error('Invalid payload');
|
||||
throw new UnauthorizedException();
|
||||
@@ -39,6 +38,8 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
this.logger.error('Missing required claims');
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
return { userId: payload.sub, username: payload.preferred_username, roles: payload.realm_access?.roles };
|
||||
const result = { userId: payload.sub, username: payload.preferred_username, roles: payload.realm_access?.roles };
|
||||
this.logger.info(`JWT User: ${JSON.stringify(result)}`); // Debugging: JWT Payload anzeigen
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user