New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-accesstoken-validation

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-accesstoken-validation - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

3

index.js

@@ -5,2 +5,3 @@ 'use strict';

const urlJoin = require('url-join');
const urlPattern = require('url-pattern');

@@ -23,3 +24,3 @@

if (_.some(options.unprotected, (route) => {
return route === req._parsedUrl.pathname
return new urlPattern(route).match(req._parsedUrl.pathname);
})) {

@@ -26,0 +27,0 @@ return next();

{
"name": "express-accesstoken-validation",
"version": "0.3.0",
"version": "0.4.0",
"description": "ExpressJS middleware for remote access token validation",

@@ -40,4 +40,5 @@ "main": "index.js",

"request": "^2.69.0",
"url-join": "0.0.1"
"url-join": "0.0.1",
"url-pattern": "^1.0.3"
}
}

@@ -124,2 +124,52 @@ 'use strict';

describe('When calling an unprotected URI with url-params', function () {
it('should call next middleware (=allow access)', function (done) {
bearerTokenValidation({
validationUri: 'http://localhost:3000/oauth/tokenvalidation',
tokenParam: 'token',
unprotected: ['/public/:id', '/public/api']
})({
headers: {},
url: '/public/0815',
_parsedUrl: { pathname: '/public/0815' }
}, {
status: function (number) {
return {
send: function () {
statusCode = number;
}
}
}
}, function (err) {
assert.equal(err, null);
done();
});
});
});
describe('When calling an unprotected URI with query params & url-params', function () {
it('should call next middleware (=allow access)', function (done) {
bearerTokenValidation({
validationUri: 'http://localhost:3000/oauth/tokenvalidation',
tokenParam: 'token',
unprotected: ['/public/:id', '/public/api']
})({
headers: {},
url: '/public/0815?id=1',
_parsedUrl: { pathname: '/public/0815' }
}, {
status: function (number) {
return {
send: function () {
statusCode = number;
}
}
}
}, function (err) {
assert.equal(err, null);
done();
});
});
});
describe('When validating an invalid token', function () {

@@ -126,0 +176,0 @@ it('should return status code 401 ', function (done) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc