Feature/8 add optional auth guard #9

Merged
noahspannbauer merged 2 commits from feature/8-add-optional-auth-guard into main 2024-09-24 09:58:43 -04:00
2 changed files with 5 additions and 2 deletions

View File

@@ -15,8 +15,11 @@ export class AuthGuard extends PassportAuthGuard('azure-ad') implements CanActiv
'isPublic', 'isPublic',
context.getHandler() 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; return true;
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@noahspan/noahspan-modules", "name": "@noahspan/noahspan-modules",
"version": "0.3.9", "version": "0.4.0",
"description": "", "description": "",
"author": "", "author": "",
"license": "UNLICENSED", "license": "UNLICENSED",