File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ import type {
77export type FastifyInstance = BaseFastifyInstance ;
88export interface FastifyRequest extends BaseFastifyRequest {
99 cookies : Record < string , string | undefined > ;
10+ headers : Record < string , string | undefined > ;
1011}
1112export type FastifyReply = BaseFastifyReply ;
Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ export class AuthService {
5353 try {
5454 if (
5555 ! this . validateCsrfToken (
56- ( request . headers [ 'x-csrf-token' ] as string | undefined ) ||
57- ( ( request . query as { csrf_token ?: string } ) ?. csrf_token as string | undefined )
56+ request . headers [ 'x-csrf-token' ] ||
57+ ( request . query as { csrf_token ?: string } ) ?. csrf_token
5858 )
5959 ) {
6060 throw new UnauthorizedException ( 'Invalid CSRF token' ) ;
Original file line number Diff line number Diff line change 1- import { Injectable , Logger } from '@nestjs/common' ;
1+ import { Injectable } from '@nestjs/common' ;
22import { PassportStrategy } from '@nestjs/passport' ;
33
44import { Strategy } from 'passport-custom' ;
@@ -11,13 +11,12 @@ const strategyName = 'user-cookie';
1111@Injectable ( )
1212export class UserCookieStrategy extends PassportStrategy ( Strategy , strategyName ) {
1313 static key = strategyName ;
14- private readonly logger = new Logger ( UserCookieStrategy . name ) ;
1514
1615 constructor ( private authService : AuthService ) {
1716 super ( ) ;
1817 }
1918
20- public validate = async ( req : FastifyRequest ) : Promise < any > => {
21- return this . authService . validateCookiesCasbin ( req ) ;
19+ public validate = async ( request : FastifyRequest ) : Promise < any > => {
20+ return this . authService . validateCookiesCasbin ( request ) ;
2221 } ;
2322}
You can’t perform that action at this time.
0 commit comments