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 { AuthGuard } from '@nestjs/passport';
|
||||||
|
|
||||||
import type { JwtPayload } from './keycloak.strategy';
|
import type { JwtPayload } from './keycloak.strategy';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class KeycloakAuthGuard extends AuthGuard('jwt') {
|
export class KeycloakAuthGuard extends AuthGuard('jwt') {
|
||||||
|
private readonly logger = new Logger(KeycloakAuthGuard.name);
|
||||||
|
|
||||||
handleRequest<TUser = JwtPayload>(err: any, user: JwtPayload): TUser {
|
handleRequest<TUser = JwtPayload>(err: any, user: JwtPayload): TUser {
|
||||||
|
this.logger.log('KeycloakAuthGuard.handleRequest');
|
||||||
|
console.log(user);
|
||||||
|
console.log(err);
|
||||||
if (err || !user) {
|
if (err || !user) {
|
||||||
if (err instanceof UnauthorizedException) {
|
if (err instanceof UnauthorizedException) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
Reference in New Issue
Block a user