add logs
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { Injectable, UnauthorizedException } from '@nestjs/common';
|
||||
import { Injectable, Logger, UnauthorizedException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
import type { JwtPayload } from './keycloak.strategy';
|
||||
|
||||
@Injectable()
|
||||
export class KeycloakAuthGuard extends AuthGuard('jwt') {
|
||||
private readonly logger = new Logger(KeycloakAuthGuard.name);
|
||||
|
||||
handleRequest<TUser = JwtPayload>(err: any, user: JwtPayload): TUser {
|
||||
this.logger.log('KeycloakAuthGuard.handleRequest');
|
||||
console.log(user);
|
||||
console.log(err);
|
||||
if (err || !user) {
|
||||
if (err instanceof UnauthorizedException) {
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user