Added Simple Auth with JWT Tokens and Postgres #2

Merged
igorpropisnov merged 10 commits from feature/add-auth into main 2024-05-08 12:28:39 +02:00
1 changed files with 2 additions and 0 deletions
Showing only changes of commit 0d94527aec - Show all commits

View File

@ -12,11 +12,13 @@ export class AccessTokenGuard extends AuthGuard('jwt-access-token') {
public canActivate(
context: ExecutionContext
): boolean | Promise<boolean> | Observable<boolean> {
// Check if the current route is marked as public
const isPublic = this.reflector.getAllAndOverride<boolean>('isPublic', [
context.getHandler(),
context.getClass(),
]);
// Allow access if the route is public, otherwise defer to the standard JWT authentication mechanism
if (isPublic) {
return true;
}