Skip to content

Class: JwtAuthGuard

Class: JwtAuthGuard

Defined in: auth-server-nest/src/guards/jwt-auth.guard.ts:29

Extracts the bearer token, validates it, attaches the principal to the request.

Applied globally by AuthClientModule.forRoot (as APP_GUARD). Opt out of auth on specific routes with @Public().

Respects options.enabled = false for dev bypass: the request gets a synthetic system_admin user with id devUserId. Production misuse is prevented at the env-validation layer in the consumer, not here.

Implements

  • CanActivate

Constructors

Constructor

new JwtAuthGuard(reflector, validator, opts): JwtAuthGuard

Defined in: auth-server-nest/src/guards/jwt-auth.guard.ts:30

Parameters

reflector

Reflector

validator

TokenValidatorService

opts

AuthClientOptions

Returns

JwtAuthGuard

Methods

canActivate()

canActivate(context): Promise<boolean>

Defined in: auth-server-nest/src/guards/jwt-auth.guard.ts:36

Parameters

context

ExecutionContext

Current execution context. Provides access to details about the current request pipeline.

Returns

Promise<boolean>

Value indicating whether or not the current request is allowed to proceed.

Implementation of

CanActivate.canActivate