This commit is contained in:
2025-11-11 11:29:39 +03:30
parent 5dd7a6588e
commit d4db672672
9 changed files with 76 additions and 20 deletions
+1 -2
View File
@@ -11,6 +11,7 @@ export enum AuthEntityType {
export interface AuthRequest extends Request {
user: {
sub: string; // userId
slug: string;
};
}
export interface JwtPayload {
@@ -42,8 +43,6 @@ export class AuthGuard implements CanActivate {
if (payload.type !== AuthEntityType.USER) {
throw new UnauthorizedException('Access denied. User rights required.');
}
// 💡 We're assigning the payload to the request object here
// so that we can access it in our route handlers
request['user'] = payload;
} catch {
throw new UnauthorizedException();