From 22e103e209e0a4c54db726730a0c52d94ab2e5bc Mon Sep 17 00:00:00 2001 From: Aydan Pirani Date: Fri, 23 Feb 2024 21:45:10 -0600 Subject: [PATCH 1/2] Added logs --- src/middleware/verify-jwt.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/middleware/verify-jwt.ts b/src/middleware/verify-jwt.ts index e3f6c7d7..598707f3 100644 --- a/src/middleware/verify-jwt.ts +++ b/src/middleware/verify-jwt.ts @@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from "express"; import { decodeJwtToken } from "../services/auth/auth-lib.js"; import jsonwebtoken from "jsonwebtoken"; import { StatusCode } from "status-code-enum"; +import Config from "config.js"; /** * @apiDefine strongVerifyErrors @@ -29,6 +30,9 @@ export function strongJwtVerification(req: Request, res: Response, next: NextFun try { res.locals.payload = decodeJwtToken(token); + if (!Config.TEST) { + console.log(`new request from user: ${res.locals.payload.id}`); + } next(); } catch (error) { console.error(error); @@ -55,6 +59,9 @@ export function weakJwtVerification(req: Request, res: Response, next: NextFunct try { res.locals.payload = decodeJwtToken(token); + if (!Config.TEST) { + console.log(`new request from user: ${res.locals.payload.id}`); + } next(); } catch (error) { console.error(error); From be10679ec989d559a38919148c4c4c19e368303b Mon Sep 17 00:00:00 2001 From: Aydan Pirani Date: Fri, 23 Feb 2024 21:46:08 -0600 Subject: [PATCH 2/2] Added prod tests --- src/middleware/verify-jwt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/verify-jwt.ts b/src/middleware/verify-jwt.ts index 598707f3..e1a36704 100644 --- a/src/middleware/verify-jwt.ts +++ b/src/middleware/verify-jwt.ts @@ -2,7 +2,7 @@ import { Request, Response, NextFunction } from "express"; import { decodeJwtToken } from "../services/auth/auth-lib.js"; import jsonwebtoken from "jsonwebtoken"; import { StatusCode } from "status-code-enum"; -import Config from "config.js"; +import Config from "../config.js"; /** * @apiDefine strongVerifyErrors