@rabstack/rab-api 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1 -3
- package/index.esm.js +1 -3
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -581,15 +581,13 @@ const authHandler = (isProtected, config)=>(req, res, next)=>{
|
|
|
581
581
|
console.log('authHandler:UnauthorizedException:Token Not Found');
|
|
582
582
|
throw new UnauthorizedException('Unauthorized', config.errorCode);
|
|
583
583
|
}
|
|
584
|
-
// Token exists - verify it
|
|
584
|
+
// Token exists - verify it (must be valid regardless of protection)
|
|
585
585
|
try {
|
|
586
586
|
const payload = jwt.verify(token, config.jwt.secret_key);
|
|
587
587
|
req['auth'] = payload;
|
|
588
588
|
return next();
|
|
589
589
|
} catch (err) {
|
|
590
590
|
console.error('authHandler:JWT Error:', err.message);
|
|
591
|
-
// If not protected, continue without auth even if token is invalid
|
|
592
|
-
if (!isProtected) return next();
|
|
593
591
|
throw new UnauthorizedException('Unauthorized', config.errorCode);
|
|
594
592
|
}
|
|
595
593
|
};
|
package/index.esm.js
CHANGED
|
@@ -579,15 +579,13 @@ const authHandler = (isProtected, config)=>(req, res, next)=>{
|
|
|
579
579
|
console.log('authHandler:UnauthorizedException:Token Not Found');
|
|
580
580
|
throw new UnauthorizedException('Unauthorized', config.errorCode);
|
|
581
581
|
}
|
|
582
|
-
// Token exists - verify it
|
|
582
|
+
// Token exists - verify it (must be valid regardless of protection)
|
|
583
583
|
try {
|
|
584
584
|
const payload = jwt.verify(token, config.jwt.secret_key);
|
|
585
585
|
req['auth'] = payload;
|
|
586
586
|
return next();
|
|
587
587
|
} catch (err) {
|
|
588
588
|
console.error('authHandler:JWT Error:', err.message);
|
|
589
|
-
// If not protected, continue without auth even if token is invalid
|
|
590
|
-
if (!isProtected) return next();
|
|
591
589
|
throw new UnauthorizedException('Unauthorized', config.errorCode);
|
|
592
590
|
}
|
|
593
591
|
};
|
package/package.json
CHANGED