Comparing version 0.9.4 to 0.9.5
@@ -0,11 +1,17 @@ | ||
0.9.5 / 2015-10-15 | ||
================= | ||
* [FIX] Allow circular XSD files to be loaded. (#745) | ||
* [ENHANCEMENT] Timestamp is now optional. (#735) | ||
* [DOC] Formatting History.md 0.9.4 notes. | ||
0.9.4 / 2015-09-28 | ||
================= | ||
[MAINTENANCE] Adding node v4.0 to .travis.yml. (#729) | ||
[MAINTENANCE] Increasing mocha test timeout to 10 seconds. (#732) | ||
[FIX] Resolve element references when other types are referenced. (#725) | ||
[DOC] Update Readme.md | ||
[ENHANCEMENT] New Ignorebasenamespaces option. (#716) | ||
[ENHANCEMENT] Add optional statusCode on soap fault. (#715) | ||
[FIX] Fix for wsdl retrieval using soap.createClient with special options.httpClient. Before this, the specified client was not used when fetching the wsdl file. This fix will force the wsdl to use the specified httpClient. (#714) | ||
[FIX] Allow WSDL to be loaded from HTTPS sites. (#694) | ||
* [MAINTENANCE] Adding node v4.0 to .travis.yml. (#729) | ||
* [MAINTENANCE] Increasing mocha test timeout to 10 seconds. (#732) | ||
* [FIX] Resolve element references when other types are referenced. (#725) | ||
* [DOC] Update Readme.md | ||
* [ENHANCEMENT] New Ignorebasenamespaces option. (#716) | ||
* [ENHANCEMENT] Add optional statusCode on soap fault. (#715) | ||
* [FIX] Fix for wsdl retrieval using soap.createClient with special options.httpClient. Before this, the specified client was not used when fetching the wsdl file. This fix will force the wsdl to use the specified httpClient. (#714) | ||
* [FIX] Allow WSDL to be loaded from HTTPS sites. (#694) | ||
@@ -12,0 +18,0 @@ 0.9.3 / 2015-09-08 |
"use strict"; | ||
var crypto = require('crypto') | ||
, passwordDigest = require('../utils').passwordDigest; | ||
var crypto = require('crypto'); | ||
var passwordDigest = require('../utils').passwordDigest; | ||
var validPasswordTypes = ['PasswordDigest', 'PasswordText']; | ||
function WSSecurity(username, password, passwordType) { | ||
function WSSecurity(username, password, options) { | ||
options = options || {}; | ||
this._username = username; | ||
this._password = password; | ||
this._passwordType = passwordType || 'PasswordText'; | ||
//must account for backward compatibility for passwordType String param as well as object options defaults: passwordType = 'PasswordText', hasTimeStamp = true | ||
if (typeof options === 'string') { | ||
this._passwordType = options ? options : 'PasswordText'; | ||
} else { | ||
this._passwordType = options.passwordType ? options.passwordType : 'PasswordText'; | ||
} | ||
if (validPasswordTypes.indexOf(this._passwordType) === -1) { | ||
this._passwordType = 'PasswordText'; | ||
} | ||
this._hasTimeStamp = options.hasTimeStamp || typeof options.hasTimeStamp === 'boolean' ? !!options.hasTimeStamp : true; | ||
} | ||
@@ -27,3 +40,10 @@ | ||
var created = getDate(now); | ||
var expires = getDate(new Date(now.getTime() + (1000 * 600))); | ||
var timeStampXml = ''; | ||
if (this._hasTimeStamp) { | ||
var expires = getDate( new Date(now.getTime() + (1000 * 600)) ); | ||
timeStampXml = "<wsu:Timestamp wsu:Id=\"Timestamp-"+created+"\">" + | ||
"<wsu:Created>"+created+"</wsu:Created>" + | ||
"<wsu:Expires>"+expires+"</wsu:Expires>" + | ||
"</wsu:Timestamp>"; | ||
} | ||
@@ -43,6 +63,3 @@ var password; | ||
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\">" + | ||
"<wsu:Timestamp wsu:Id=\"Timestamp-" + created + "\">" + | ||
"<wsu:Created>" + created + "</wsu:Created>" + | ||
"<wsu:Expires>" + expires + "</wsu:Expires>" + | ||
"</wsu:Timestamp>" + | ||
timeStampXml + | ||
"<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"SecurityToken-" + created + "\">" + | ||
@@ -49,0 +66,0 @@ "<wsse:Username>" + this._username + "</wsse:Username>" + |
@@ -1133,3 +1133,3 @@ /* | ||
open_wsdl(includePath, this.options, function(err, wsdl) { | ||
open_wsdl_recursive(includePath, this.options, function(err, wsdl) { | ||
if (err) { | ||
@@ -1879,3 +1879,43 @@ return callback(err); | ||
var WSDL_CACHE = { }; | ||
/* | ||
Have another function to load previous WSDLs as we | ||
don't want this to be invoked externally (expect for tests) | ||
This will attempt to fix circular dependencies with XSD files, | ||
Given | ||
file.wsdl | ||
xs:import namespace="A" schemaLocation: A.xsd | ||
A.xsd | ||
xs:import namespace="B" schemaLocation: B.xsd | ||
B.xsd | ||
xs:import namespace="A" schemaLocation: A.xsd | ||
file.wsdl will start loading, import A, then A will import B, which will then import A | ||
Because A has already started to load previously it will be returned right away and | ||
have an internal circular reference | ||
B would then complete loading, then A, then file.wsdl | ||
By the time file A starts processing its includes its definitions will be already loaded, | ||
this is the only thing that B will depend on when "opening" A | ||
*/ | ||
function open_wsdl_recursive(uri, options, callback) { | ||
var fromCache; | ||
if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
if (fromCache = WSDL_CACHE[ uri ]) { | ||
return callback.call(fromCache, null, fromCache); | ||
} | ||
return open_wsdl(uri, options, callback); | ||
} | ||
function open_wsdl(uri, options, callback) { | ||
if (typeof options === 'function') { | ||
@@ -1898,2 +1938,3 @@ callback = options; | ||
wsdl = new WSDL(definition, uri, options); | ||
WSDL_CACHE[ uri ] = wsdl; | ||
wsdl.onReady(callback); | ||
@@ -1911,2 +1952,3 @@ } | ||
wsdl = new WSDL(definition, uri, options); | ||
WSDL_CACHE[ uri ] = wsdl; | ||
wsdl.onReady(callback); | ||
@@ -1913,0 +1955,0 @@ } else { |
{ | ||
"name": "soap", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -327,4 +327,6 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
``` javascript | ||
new WSSecurity(username, password, passwordType) | ||
//'PasswordDigest' or 'PasswordText' default is PasswordText | ||
new WSSecurity(username, password, options) | ||
//the 'options' object is optional and contains properties: | ||
//passwordType: 'PasswordDigest' or 'PasswordText' default is PasswordText | ||
//hasTimeStamp: true or false default is true | ||
``` | ||
@@ -331,0 +333,0 @@ |
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
126399
2624
510