feat: add admin guard and JWT role support
- Create AdminGuard to check user role - Update JWT strategy to include role in payload - Update auth service to include role in token generation - Prepare admin module structure - TypeScript will resolve lint errors after server restart
This commit is contained in:
6
apps/api/dist/auth/jwt.strategy.js
vendored
6
apps/api/dist/auth/jwt.strategy.js
vendored
@@ -22,7 +22,11 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
|
||||
});
|
||||
}
|
||||
async validate(payload) {
|
||||
return { userId: payload.sub, email: payload.email };
|
||||
return {
|
||||
userId: payload.sub,
|
||||
email: payload.email,
|
||||
role: payload.role || 'user'
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.JwtStrategy = JwtStrategy;
|
||||
|
||||
Reference in New Issue
Block a user