Skip to content
Browse files

Added new security type ClientSSLSecurity that exposes key, cert

params that are ultimately passed to request/https.
  • Loading branch information...
1 parent 85d3442 commit 44b3155d1adb43ed7ebb64a0f549c4d350cefcfe @sharedinnovationlab sharedinnovationlab committed
Showing with 18 additions and 1 deletion.
  1. +18 −1 lib/soap.js
View
19 lib/soap.js
@@ -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 = {};
@@ -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;
@@ -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;

0 comments on commit 44b3155

Please sign in to comment.
Something went wrong with that request. Please try again.