guard,守卫,身份验证用的吧,创建一个,nest generate guard demoAuth core/guards
This commit is contained in:
parent
8f9ae7d1b9
commit
d20d72db9a
|
@ -0,0 +1,7 @@
|
|||
import { DemoAuthGuard } from './demo-auth.guard';
|
||||
|
||||
describe('DemoAuthGuard', () => {
|
||||
it('should be defined', () => {
|
||||
expect(new DemoAuthGuard()).toBeDefined();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class DemoAuthGuard implements CanActivate {
|
||||
canActivate(
|
||||
context: ExecutionContext,
|
||||
): boolean | Promise<boolean> | Observable<boolean> {
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue