Skip to content

Commit

Permalink
Added new security type ClientSSLSecurity that exposes key, cert
Browse files Browse the repository at this point in the history
params that are ultimately passed to request/https.
  • Loading branch information
sharedinnovationlab committed Aug 31, 2012
1 parent 85d3442 commit 44b3155
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/soap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var Client = require('./client').Client,
Server = require('./server').Server,
open_wsdl = require('./wsdl').open_wsdl,
crypto = require('crypto'),
WSDL = require('./wsdl').WSDL;
WSDL = require('./wsdl').WSDL,
fs = require('fs');

var WSDL = require('./wsdl').WSDL;
var _wsdlCache = {};
Expand Down Expand Up @@ -73,6 +74,21 @@ BasicAuthSecurity.prototype.toXML = function() {
return "";
}

function ClientSSLSecurity(keyPath, certPath) {
this.key = fs.readFileSync(keyPath);
this.cert = fs.readFileSync(certPath);
}

ClientSSLSecurity.prototype.toXML = function (headers) {
return "";
}

ClientSSLSecurity.prototype.addOptions = function (options) {
options.key = this.key;
options.cert = this.cert;
options.agent = new https.Agent(options);
}

function WSSecurity(username, password, passwordType) {
this._username = username;
this._password = password;
Expand Down Expand Up @@ -128,6 +144,7 @@ WSSecurity.prototype.toXML = function() {

exports.BasicAuthSecurity = BasicAuthSecurity;
exports.WSSecurity = WSSecurity;
exports.ClientSSLSecurity = ClientSSLSecurity;
exports.createClient = createClient;
exports.passwordDigest = passwordDigest;
exports.listen = listen;
Expand Down

0 comments on commit 44b3155

Please sign in to comment.