Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

denim-api-auth-middleware

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

denim-api-auth-middleware - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

9

api-auth-middleware.js
const makeApiKeyAuthMiddleware = apiKeys => (req, res, next) => {
const authHeader = req.get('Authorization').split(':')
const reqKey = authHeader[0]
const reqPass = authHeader[authHeader.length - 1]
const authHeader = req.get('Authorization')
if(!authHeader) res.status(403).send('Forbidden')
const authHeaderParts = req.get('Authorization').split(':')
const reqKey = authHeaderParts[0]
const reqPass = authHeaderParts[authHeaderParts.length - 1]
if (apiKeys[reqKey] !== reqPass) {

@@ -7,0 +10,0 @@ res.status(403).send('Forbidden')

@@ -8,6 +8,9 @@ 'use strict';

return function (req, res, next) {
var authHeader = req.get('Authorization').split(':');
var reqKey = authHeader[0];
var reqPass = authHeader[authHeader.length - 1];
var authHeader = req.get('Authorization');
if (!authHeader) res.status(403).send('Forbidden');
var authHeaderParts = req.get('Authorization').split(':');
var reqKey = authHeaderParts[0];
var reqPass = authHeaderParts[authHeaderParts.length - 1];
if (apiKeys[reqKey] !== reqPass) {

@@ -14,0 +17,0 @@ res.status(403).send('Forbidden');

{
"name": "denim-api-auth-middleware",
"version": "1.0.3",
"version": "1.0.4",
"description": "Express API Key Auth Middleware",

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

Sorry, the diff of this file is not supported yet

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