added new Ep
This commit is contained in:
+10
-2
@@ -1,5 +1,13 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
// jwt-auth.guard.ts
|
||||
import { ExecutionContext, Injectable, ForbiddenException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {}
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
handleRequest(err: any, user: any, info: any, context: ExecutionContext) {
|
||||
if (err || !user) {
|
||||
throw new ForbiddenException('Acceso denegado: token inválido o ausente');
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user