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.4.0 to 0.5.0

4

index.js

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

if (req.headers.authorization) {
let bearerToken = req.headers.authorization.substr(7);
const tokens = req.headers.authorization.split(', ');
const bearerTokenHeader = _.find(tokens, token => token.toLowerCase().startsWith('bearer'));
let bearerToken = bearerTokenHeader.substr(7);
let tokenParam = `?${options.tokenParam}=${bearerToken}`;

@@ -32,0 +34,0 @@ var uri = urlJoin(options.validationUri, tokenParam);

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

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -196,2 +196,27 @@ 'use strict';

describe('With multiple tokens', function () {
it('should select the correct and call next middleware (=allow access)', function (done) {
bearerTokenValidation({
validationUri: 'http://localhost:3000/oauth/tokenvalidation',
tokenParam: 'token'
})({
headers: {
'authorization': 'bearer token, policy policytoken'
},
url: '/protected'
}, {
status: function (number) {
return {
send: function () {
statusCode = number;
}
}
}
}, function (err) {
assert.equal(err, null);
done();
});
});
});
describe('When authorization header is missing', function () {

@@ -198,0 +223,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