Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 2x 2x 2x 2x 30x 30x | import { Injectable, ExecutionContext } from "@nestjs/common"; import { AuthGuard } from "@nestjs/passport"; import { Reflector } from "@nestjs/core"; @Injectable() export class JwtAuthGuard extends AuthGuard("jwt") { constructor(private reflector: Reflector) { super(); } canActivate(context: ExecutionContext) { const isPublic = this.reflector.getAllAndOverride<boolean>("isPublic", [ context.getHandler(), context.getClass(), ]); Iif (isPublic) { return true; } return super.canActivate(context); } } |