couchdb-auth-proxy
Advanced tools
Comparing version 1.1.1 to 1.1.2
28
index.js
@@ -11,3 +11,3 @@ 'use strict'; | ||
var name = "couchdb-auth-proxy"; | ||
var version = "1.1.1"; | ||
var version = "1.1.2"; | ||
@@ -83,2 +83,8 @@ var asyncToGenerator = function (fn) { | ||
proxy.on("proxyRes", function (proxyRes, req, res) { | ||
const existing = res.getHeader("Via"); | ||
const viaheader = `${ existing ? existing + ", " : "" }${ req.httpVersion } ${ via } (${ name }/${ version })`; | ||
res.setHeader("Via", viaheader); | ||
}); | ||
return (() => { | ||
@@ -95,22 +101,8 @@ var _ref2 = asyncToGenerator(function* (req, res, next) { | ||
if (ctx != null) { | ||
const name = typeof ctx.name === "string" ? ctx.name : ""; | ||
req.headers[headerFields.username] = name; | ||
const n = typeof ctx.name === "string" ? ctx.name : ""; | ||
req.headers[headerFields.username] = n; | ||
req.headers[headerFields.roles] = Array.isArray(ctx.roles) ? ctx.roles.join(",") : ""; | ||
if (secret) req.headers[headerFields.token] = signRequest(name, secret); | ||
if (secret) req.headers[headerFields.token] = signRequest(n, secret); | ||
} | ||
// attach Via header on response | ||
// do this last in case there was an error | ||
if (via) { | ||
const writeHead = res.writeHead; | ||
res.writeHead = function (code, headers) { | ||
const existing = res.getHeader("Via"); | ||
const viaheader = `${ existing ? existing + ", " : "" }${ req.httpVersion } ${ via } (${ name }/${ version })`; | ||
res.setHeader("Via", viaheader); | ||
if (headers) headers["Via"] = viaheader; | ||
return writeHead.apply(res, arguments); | ||
}; | ||
} | ||
proxy.web(req, res); | ||
@@ -117,0 +109,0 @@ } catch (e) { |
{ | ||
"name": "couchdb-auth-proxy", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "An HTTP reverse proxy library for quick and dirty Couchdb proxy authentication", | ||
@@ -5,0 +5,0 @@ "author": "Tyler Johnson <tyler@tylerjohnson.me>", |
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
10246
113