couch-login
Advanced tools
Comparing version 0.1.18 to 0.1.19
@@ -40,2 +40,5 @@ var request = require('request') | ||
// ensure that couch url ends with a slash | ||
couch.pathname = couch.pathname.replace(/\/?$/, '/'); | ||
this.token = tok | ||
@@ -52,2 +55,8 @@ this.couch = url.format(couch) | ||
// replace these with client certificate and private key if required by | ||
// the server. Only relevant for HTTPS couches. These are passed to | ||
// the request and then on to https and tls as-is. | ||
this.cert = null | ||
this.key = null | ||
// set to boolean true or false to specify the strictSSL behavior. | ||
@@ -133,3 +142,3 @@ // if left as null, then it'll use whatever node defaults to, which | ||
var h = {} | ||
, u = url.resolve(this.couch, p) | ||
, u = url.resolve(this.couch, p.replace(/^\//, '')) | ||
, req = { uri: u, headers: h, json: true, body: d, method: meth } | ||
@@ -156,2 +165,7 @@ | ||
req.ca = this.ca | ||
if (this.cert) | ||
req.cert = this.cert | ||
if (this.key) | ||
req.key = this.key | ||
@@ -365,3 +379,3 @@ if (typeof this.strictSSL === 'boolean') | ||
var h = { cookie: 'AuthSession=' + this.token.AuthSession } | ||
, u = url.resolve(this.couch, '/_session') | ||
, u = url.resolve(this.couch, '_session') | ||
, req = { uri: u, headers: h, json: true } | ||
@@ -368,0 +382,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A module for doing logged-in requests to a couchdb server", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -155,3 +155,3 @@ # couch-login | ||
A certificate authority string, or an array of CA strings. Only | ||
A certificate authority string (PEM encoded), or an array of CA strings. Only | ||
relevant for HTTPS couches, of course. | ||
@@ -161,2 +161,20 @@ | ||
### couch.cert | ||
* {String | null} | ||
A client certificate (PEM encoded) used to support secure access to servers that require client certificate. Only | ||
relevant for HTTPS couches, of course. | ||
Leave as `null` when not supporting client certificates. | ||
### couch.key | ||
* {String | null} | ||
A private key string (PEM encoded) used to validate a client certificate. Only | ||
relevant for HTTPS couches, of course. | ||
Leave as `null` when not supporting client certificates. | ||
### couch.strictSSL | ||
@@ -163,0 +181,0 @@ |
71842
1032
279