denim-api-auth-middleware
Advanced tools
Comparing version 1.0.3 to 1.0.4
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262537
40