File tree 3 files changed +10
-26
lines changed
3 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,18 @@ export class AuthGuard implements CanActivate {
21
21
private readonly reflector : Reflector
22
22
) { }
23
23
24
+ getRequest ( context : ExecutionContext ) : any {
25
+ return context . switchToHttp ( ) . getRequest ( )
26
+ }
27
+
24
28
async canActivate ( context : ExecutionContext ) : Promise < boolean > {
25
29
const isPublic : boolean = this . reflector . get < boolean > ( META_PUBLIC , context . getHandler ( ) )
26
30
27
31
if ( isPublic ) {
28
32
return true
29
33
}
30
34
31
- const request = context . switchToHttp ( ) . getRequest ( )
35
+ const request = this . getRequest ( context )
32
36
const jwt = this . extractJwt ( request . headers )
33
37
34
38
try {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ import {
22
22
import { META_RESOURCE } from '../decorators/resource.decorator'
23
23
import { META_FETCH_RESOURCES } from '../decorators/fetch.resources.decorator'
24
24
import { META_PUBLIC } from '../decorators/public.decorator'
25
- import { getRequest } from './execution.request'
26
25
import { PriviledgedRequest } from '../@types/request'
27
26
28
27
@Injectable ( )
@@ -35,6 +34,10 @@ export class ResourceGuard implements CanActivate {
35
34
private readonly reflector : Reflector
36
35
) { }
37
36
37
+ getRequest ( context : ExecutionContext ) : any {
38
+ return context . switchToHttp ( ) . getRequest ( )
39
+ }
40
+
38
41
async canActivate ( context : ExecutionContext ) : Promise < boolean > {
39
42
const isPublic = this . reflector . get < boolean > ( META_PUBLIC , context . getHandler ( ) )
40
43
@@ -43,7 +46,7 @@ export class ResourceGuard implements CanActivate {
43
46
return true
44
47
}
45
48
46
- const request = getRequest ( context )
49
+ const request = this . getRequest ( context )
47
50
48
51
const resourceType = this . reflector . get < string > ( META_RESOURCE , context . getClass ( ) )
49
52
You can’t perform that action at this time.
0 commit comments