From 72683c9ae2fed3bbbd28acfa47eb7e2d37b0aedf Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Tue, 24 Sep 2024 08:47:52 -0500 Subject: [PATCH 1/2] adding optional auth to guard --- libs/modules/src/auth/auth.gaurd.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/modules/src/auth/auth.gaurd.ts b/libs/modules/src/auth/auth.gaurd.ts index 81bb84c..5313256 100644 --- a/libs/modules/src/auth/auth.gaurd.ts +++ b/libs/modules/src/auth/auth.gaurd.ts @@ -15,8 +15,11 @@ export class AuthGuard extends PassportAuthGuard('azure-ad') implements CanActiv 'isPublic', context.getHandler() ); + const req = context.switchToHttp().getRequest(); + const authHeader = req.headers.authorization; + const token = authHeader && authHeader.split(' ')[1]; - if (isPublic) { + if (isPublic && !token) { return true; } -- 2.49.1 From adfbd5f8a3aab5b20dd9797809572892d5fa8bad Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Tue, 24 Sep 2024 08:48:10 -0500 Subject: [PATCH 2/2] adding optional auth to guard --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ed3cba0..80cd8e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@noahspan/noahspan-modules", - "version": "0.3.9", + "version": "0.4.0", "description": "", "author": "", "license": "UNLICENSED", -- 2.49.1