import { CanActivate , ExecutionContext , Injectable } from '@nestjs/common' ; import { Observable } from 'rxjs' ; @ Injectable ( ) export class CatGuard implements CanActivate { canActivate ( context ) { const req = context . switchToHttp ( ) . getRequest ( ) ; req . user = 'my user value' ; return req . headers . authorization === 'auth' ; } }