
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
node-accesstoken-validation
Advanced tools
Component to validate Bearer Token. It validate JWT tokens and reference tokens (Introspection) as well. It support almost all algorithms. RSA, ECDsa, HMAC. Trough jose.
Authentication handler for node that allows accepting both JWTs and reference tokens (Introspection).
$ npm install --save node-accesstoken-validation
Simply specify authority and API name (aka audience):
import { AccessTokenHandler } from 'node-accesstoken-validation';
var at_validation = new AccessTokenHandler({
authority: 'https://localhost:5000',
apiName: "<api name>
});
at_validation.Handle('bearer eyJhbGciOiJFUzI1NiIsImtpZCI6IjlXVFR1Nm9nZzQyamR2WUpaTUZRYXciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE1ODU5NDI5MjIsImV4cCI6MTU4NTk0NjUyMiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwMCIsImF1ZCI6ImpwX2FwaSIsImNsaWVudF9pZCI6IklTNC1BZG1pbiIsInN1YiI6IjA5MDRlNzVlLTQxM2QtNDg2MC05MzI5LWIyNTg3MjQ3MDY1YSIsImF1dGhfdGltZSI6MTU4NTcyMzY3NSwiaWRwIjoibG9jYWwiLCJpczQtcmlnaHRzIjoibWFuYWdlciIsInJvbGUiOiJBZG1pbmlzdHJhdG9yIiwiZW1haWwiOiJiaGRlYnJpdG9AZ21haWwuY29tIiwidXNlcm5hbWUiOiJicnVubyIsInNjb3BlIjpbInJvbGUiLCJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJqcF9hcGkuaXM0Il0sImFtciI6WyJwd2QiXX0.IXXE3P1lU5a_G4uMdVuilpej4E6inlV7ObOprszbyZbjnoS2gwOyegB3WSAjwsbTmzGM-T9_SgLhVP-lqJ94mg').then(console.log).catch(console.warn);
Additionally specify the API secret for the introspection endpoint:
import { AccessTokenHandler } from 'node-accesstoken-validation';
var at_validation = new AccessTokenHandler({
authority: 'https://localhost:5000',
apiName: "<api name>",
apiSecret: "<api secret>"
});
at_validation.Handle('bearer z5RuNoKkZQ1cAwstP7ZhHAV8NcmljulxPHzOvNuIRLQ').then(console.log).catch(console.warn);
In addition to API name checking, you can do more fine-grained scope checks.
at_validation.Handle('bearer <bearer>').then(claims => {
if(claims["custom_claims"] != "custom_value")
throw new Error();
//...
}).catch(console.warn):
By default response stay cached by 5 minutes (300 sec). You can change or disable.
var at_validation = new AccessTokenHandler({
authority: 'https://localhost:5000',
apiName: "<api name>",
apiSecret: "<api secret>",
enableCache: true,
cacheDuration: 300
});
at_validation.Handle('bearer <bearer>').then(console.log).catch(console.warn);
You can explicit disable JWT or Reference tokens.
var at_validation = new AccessTokenHandler({
authority: 'https://localhost:5000',
supportedTokens = SupportedTokens.Jwt
});
at_validation.Handle('bearer <bearer>').then(console.log).catch(console.warn);
By default it checks audience. If you are running through API Gateway and validating many requests disable it.
var at_validation = new AccessTokenHandler({
authority: 'https://localhost:5000',
apiName: '<api name>'
checkAudience = false;
});
at_validation.Handle('bearer <bearer>').then(console.log).catch(console.warn);
Node Access Token Validation is Open Source software and is released under the MIT license. This license allow the use of Node Access Token Validation in free and commercial applications and libraries without restrictions.
FAQs
Component to validate Bearer Token. It validate JWT tokens and reference tokens (Introspection) as well. It support almost all algorithms. RSA, ECDsa, HMAC. Trough jose.
We found that node-accesstoken-validation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.