Feature/8 add optional auth guard (#9)

* adding optional auth to guard

* adding optional auth to guard
This commit was merged in pull request #9.
This commit is contained in:
2024-09-24 08:58:43 -05:00
committed by GitHub
parent fcffd65d33
commit e192dcdb05
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',
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;
}