Compare commits
2 Commits
adding-pub
...
12-change-
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b8d7d5ae2 | |||
| 7933198403 |
@@ -1,7 +1,6 @@
|
||||
import { ExecutionContext, Injectable } from '@nestjs/common';
|
||||
import { AuthGuard as PassportAuthGuard } from '@nestjs/passport';
|
||||
import { Observable } from 'rxjs';
|
||||
import { IS_PUBLIC_KEY } from '../decorators/public.decorator';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuard extends PassportAuthGuard('oidc') {
|
||||
@@ -10,13 +9,6 @@ export class AuthGuard extends PassportAuthGuard('oidc') {
|
||||
}
|
||||
|
||||
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> {
|
||||
const isPublic = this.reflector.get<boolean>(
|
||||
IS_PUBLIC_KEY,
|
||||
context.getHandler()
|
||||
)
|
||||
|
||||
if (isPublic) return true;
|
||||
|
||||
return super.canActivate(context);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { SetMetadata } from "@nestjs/common";
|
||||
|
||||
export const IS_PUBLIC_KEY = "isPublic";
|
||||
export const Public = () => SetMetadata(IS_PUBLIC_KEY, true);
|
||||
@@ -8,10 +8,6 @@ export * from './auth/public.decorator';
|
||||
|
||||
export * from './util/customError';
|
||||
|
||||
// Decorators
|
||||
|
||||
export { IS_PUBLIC_KEY, Public } from './decorators/public.decorator'
|
||||
|
||||
// User
|
||||
|
||||
export * from './user/user.module';
|
||||
|
||||
Reference in New Issue
Block a user