Comparing version 0.15.0 to 0.16.0
@@ -0,1 +1,16 @@ | ||
0.16.0 / 2016-06-23 | ||
================= | ||
* [ENHANCEMENT] Add nonce and soap:actor support for WSSecurity (#851) | ||
* [MAINTENANCE] Fix typo in readme (#853) | ||
* [FIX fixes and issue that causes the module to break if no re or req.headers present in client (#852) | ||
* [FIX] fixed the soap request envelop generation part when request has complex Type as root. (#849) | ||
* [FIX] Gracefully handle errors while parsing xml in xmlToObject and resume the parser with p.resume() (#842) | ||
* [FIX] XSD import in WSDL files and relative path (server creation) - resubmit (#846) | ||
* [ENHANCEMENT] Support array of certs for ClientSSLSecurity ca. (#841) | ||
* [MAINTENANCE] Attribute value of body id in double quotes (#843) | ||
* [MAINTENANCE] Bumping ursa to 0.9.4 (#836) | ||
* [ENHANCEMENT] Optionally add Created to wssecurity header (#833) | ||
* [MAINTENANCE] Clean up brace style (#835) | ||
* [FIX] Fix custom http client not being used when fetching related resources (#834) | ||
0.15.0 / 2016-05-09 | ||
@@ -6,3 +21,3 @@ ================= | ||
* [FIX] Fixed incorrect WSDL in `CDATA` tests (#830) | ||
* [FIX] Added mocks for node.js streams `cork`/`uncork` in tests (for `node >= 4.x`) (#829) | ||
* [FIX] Added mocks for node.js streams `cork`/`uncork` in tests (for `node >= 4.x`) (#829) | ||
* [ENHANCEMENT] Added basic `CDATA` support (#787) | ||
@@ -34,3 +49,3 @@ * [DOC] Added missing documentation about `Client.setEndpoint(url)` (#827) | ||
* [FIX] Maintain `ignoredNamespaces` option when processing WSDL includes (#796) | ||
* [ENHANCEMENT] SOAP Headers for server response & `changeSoapHeader()` method for client & server (#792) | ||
* [ENHANCEMENT] SOAP Headers for server response & `changeSoapHeader()` method for client & server (#792) | ||
* [ENHANCEMENT] Added XML declaration (version & encoding) to client requests (#797) | ||
@@ -37,0 +52,0 @@ * [DOC] Added example for `server.options` to README, fixed typos in CONTRIBUTING (#798) |
@@ -220,7 +220,7 @@ /* | ||
if (input.parts || args === null) { | ||
assert.ok(!style || style === 'rpc', 'invalid message definition for document style binding'); | ||
message = self.wsdl.objectToRpcXML(name, args, alias, ns); | ||
(method.inputSoap === 'encoded') && (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '); | ||
} else if (typeof (args) === 'string') { | ||
if ((style === 'rpc')&& ( ( input.parts || input.name==="element" ) || args === null) ) { | ||
assert.ok(!style || style === 'rpc', 'invalid message definition for document style binding'); | ||
message = self.wsdl.objectToRpcXML(name, args, alias, ns,(input.name!=="element" )); | ||
(method.inputSoap === 'encoded') && (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '); | ||
} else if (typeof (args) === 'string') { | ||
message = args; | ||
@@ -250,3 +250,3 @@ } else { | ||
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') + | ||
(self.security && self.security.postProcess ? " Id='_0'" : '') + | ||
(self.security && self.security.postProcess ? ' Id="_0"' : '') + | ||
">" + | ||
@@ -340,5 +340,6 @@ message + | ||
// Added mostly for testability, but possibly useful for debugging | ||
self.lastRequestHeaders = req.headers; | ||
if(req && req.headers) //fixes an issue when req or req.headers is indefined | ||
self.lastRequestHeaders = req.headers; | ||
}; | ||
exports.Client = Client; |
@@ -13,3 +13,3 @@ 'use strict'; | ||
* @param {Buffer|String} cert | ||
* @param {Buffer|String} [ca] | ||
* @param {Buffer|String|Array} [ca] | ||
* @param {Object} [defaults] | ||
@@ -40,3 +40,3 @@ * @constructor | ||
if (ca) { | ||
if(Buffer.isBuffer(ca)) { | ||
if(Buffer.isBuffer(ca) || Array.isArray(ca)) { | ||
this.ca = ca; | ||
@@ -43,0 +43,0 @@ } else if (typeof ca === 'string') { |
@@ -14,2 +14,3 @@ "use strict"; | ||
this._passwordType = options ? options : 'PasswordText'; | ||
options = {}; | ||
} else { | ||
@@ -24,2 +25,13 @@ this._passwordType = options.passwordType ? options.passwordType : 'PasswordText'; | ||
this._hasTimeStamp = options.hasTimeStamp || typeof options.hasTimeStamp === 'boolean' ? !!options.hasTimeStamp : true; | ||
/*jshint eqnull:true */ | ||
if (options.hasNonce != null) { | ||
this._hasNonce = !!options.hasNonce; | ||
} | ||
this._hasTokenCreated = options.hasTokenCreated || typeof options.hasTokenCreated === 'boolean' ? !!options.hasTokenCreated : true; | ||
if (options.actor != null) { | ||
this._actor = options.actor; | ||
} | ||
if (options.mustUnderstand != null) { | ||
this._mustUnderstand = !!options.mustUnderstand; | ||
} | ||
} | ||
@@ -51,10 +63,15 @@ | ||
var password; | ||
if(this._passwordType === 'PasswordText') { | ||
password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this._password + "</wsse:Password>"; | ||
} else { | ||
var password, nonce; | ||
if (this._hasNonce || this._passwordType !== 'PasswordText') { | ||
// nonce = base64 ( sha1 ( created + random ) ) | ||
var nHash = crypto.createHash('sha1'); | ||
nHash.update(created + Math.random()); | ||
var nonce = nHash.digest('base64'); | ||
nonce = nHash.digest('base64'); | ||
} | ||
if (this._passwordType === 'PasswordText') { | ||
password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this._password + "</wsse:Password>"; | ||
if (nonce) { | ||
password += "<wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">" + nonce + "</wsse:Nonce>"; | ||
} | ||
} else { | ||
password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">" + passwordDigest(nonce, created, this._password) + "</wsse:Password>" + | ||
@@ -64,3 +81,5 @@ "<wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">" + nonce + "</wsse:Nonce>"; | ||
return "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + | ||
return "<wsse:Security " + (this._actor ? "soap:actor=\"" + this._actor + "\" " : "") + | ||
(this._mustUnderstand ? "soap:mustUnderstand=\"1\" " : "") + | ||
"xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + | ||
timeStampXml + | ||
@@ -70,3 +89,3 @@ "<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"SecurityToken-" + created + "\">" + | ||
password + | ||
"<wsu:Created>" + created + "</wsu:Created>" + | ||
(this._hasTokenCreated ? "<wsu:Created>" + created + "</wsu:Created>" : "") + | ||
"</wsse:UsernameToken>" + | ||
@@ -73,0 +92,0 @@ "</wsse:Security>"; |
@@ -158,8 +158,21 @@ /* | ||
catch (err) { | ||
error = err.stack || err; | ||
res.statusCode = 500; | ||
res.write(error); | ||
res.end(); | ||
if (typeof self.log === 'function') { | ||
self.log("error", error); | ||
if (err.Fault !== undefined) { | ||
return self._sendError(err.Fault, function(result, statusCode) { | ||
if(statusCode) { | ||
res.statusCode = statusCode || 500; | ||
} | ||
res.write(result); | ||
res.end(); | ||
if (typeof self.log === 'function') { | ||
self.log("error", err); | ||
} | ||
}, new Date().toISOString()); | ||
} else { | ||
error = err.stack || err; | ||
res.statusCode = 500; | ||
res.write(error); | ||
res.end(); | ||
if (typeof self.log === 'function') { | ||
self.log("error", error); | ||
} | ||
} | ||
@@ -166,0 +179,0 @@ } |
@@ -32,6 +32,7 @@ /* | ||
open_wsdl(url, options, function(err, wsdl) { | ||
if (err) | ||
if (err) { | ||
return callback(err); | ||
else | ||
} else { | ||
_wsdlCache[url] = wsdl; | ||
} | ||
callback(null, wsdl); | ||
@@ -56,3 +57,4 @@ }); | ||
var options = {}, | ||
path = pathOrOptions; | ||
path = pathOrOptions, | ||
uri = null; | ||
@@ -64,5 +66,6 @@ if (typeof pathOrOptions === 'object') { | ||
xml = options.xml; | ||
uri = options.uri; | ||
} | ||
var wsdl = new WSDL(xml || services, null, options); | ||
var wsdl = new WSDL(xml || services, uri, options); | ||
return new Server(server, path, services, wsdl); | ||
@@ -69,0 +72,0 @@ } |
@@ -26,8 +26,6 @@ | ||
if (n === TNS_PREFIX) continue; | ||
if (xmlnsMapping[n] === nsURI) | ||
if (xmlnsMapping[n] === nsURI) { | ||
return n; | ||
} | ||
} | ||
}; | ||
{ | ||
"name": "soap", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "A minimal node SOAP client", | ||
@@ -23,3 +23,3 @@ "engines": { | ||
"optionalDependencies": { | ||
"ursa": "0.8.5 || >=0.9.3" | ||
"ursa": "0.8.5 || >=0.9.4" | ||
}, | ||
@@ -26,0 +26,0 @@ "repository": { |
@@ -133,4 +133,4 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] | ||
// You can also inspect the original `req` | ||
reallyDeatailedFunction: function(args, cb, headers, req) { | ||
console.log('SOAP `reallyDeatailedFunction` request from ' + req.connection.remoteAddress); | ||
reallyDetailedFunction: function(args, cb, headers, req) { | ||
console.log('SOAP `reallyDetailedFunction` request from ' + req.connection.remoteAddress); | ||
return { | ||
@@ -469,3 +469,4 @@ name: headers.Token | ||
//passwordType: 'PasswordDigest' or 'PasswordText' default is PasswordText | ||
//hasTimeStamp: true or false default is true | ||
//hasTimeStamp: true or false, default is true | ||
//hasTokenCreated: true or false, default is true | ||
client.setSecurity(wsSecurity); | ||
@@ -472,0 +473,0 @@ ``` |
Sorry, the diff of this file is too big to display
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
168174
3402
741