soap 0.20.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +23 -23
- package/.jshintrc +29 -29
- package/.travis.yml +22 -22
- package/CONTRIBUTING.md +52 -58
- package/History.md +52 -2
- package/LICENSE +7 -7
- package/PUBLISHING.md +28 -28
- package/Readme.md +1062 -931
- package/coverage/coverage.json +1 -0
- package/coverage/lcov-report/base.css +212 -0
- package/coverage/lcov-report/index.html +119 -0
- package/coverage/lcov-report/node-soap/index.html +93 -0
- package/coverage/lcov-report/node-soap/index.js.html +74 -0
- package/coverage/lcov-report/node-soap/lib/client.js.html +1001 -0
- package/coverage/lcov-report/node-soap/lib/http.js.html +416 -0
- package/coverage/lcov-report/node-soap/lib/index.html +171 -0
- package/coverage/lcov-report/node-soap/lib/nscontext.js.html +734 -0
- package/coverage/lcov-report/node-soap/lib/security/BasicAuthSecurity.js.html +137 -0
- package/coverage/lcov-report/node-soap/lib/security/BearerSecurity.js.html +134 -0
- package/coverage/lcov-report/node-soap/lib/security/ClientSSLSecurity.js.html +296 -0
- package/coverage/lcov-report/node-soap/lib/security/ClientSSLSecurityPFX.js.html +218 -0
- package/coverage/lcov-report/node-soap/lib/security/WSSecurity.js.html +278 -0
- package/coverage/lcov-report/node-soap/lib/security/index.html +158 -0
- package/coverage/lcov-report/node-soap/lib/security/index.js.html +92 -0
- package/coverage/lcov-report/node-soap/lib/server.js.html +1139 -0
- package/coverage/lcov-report/node-soap/lib/soap.js.html +314 -0
- package/coverage/lcov-report/node-soap/lib/utils.js.html +161 -0
- package/coverage/lcov-report/node-soap/lib/wsdl.js.html +6275 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +1 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +158 -0
- package/coverage/lcov.info +3325 -0
- package/index.js +3 -3
- package/lib/client.js +434 -425
- package/lib/http.js +129 -129
- package/lib/nscontext.js +223 -223
- package/lib/security/BasicAuthSecurity.js +24 -24
- package/lib/security/BearerSecurity.js +23 -23
- package/lib/security/ClientSSLSecurity.js +82 -65
- package/lib/security/ClientSSLSecurityPFX.js +51 -51
- package/lib/security/WSSecurity.js +90 -90
- package/lib/security/WSSecurityCert.js +78 -78
- package/lib/security/index.js +10 -10
- package/lib/security/templates/wsse-security-header.ejs +12 -12
- package/lib/security/templates/wsse-security-token.ejs +3 -3
- package/lib/server.js +474 -444
- package/lib/soap.d.ts +220 -0
- package/lib/soap.js +110 -110
- package/lib/utils.js +30 -30
- package/lib/wsdl.js +2272 -2234
- package/package.json +8 -8
- package/soap-stub.js +148 -148
- package/.npmignore +0 -2
package/lib/nscontext.js
CHANGED
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = NamespaceContext;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Scope for XML namespaces
|
|
7
|
-
* @param {NamespaceScope} [parent] Parent scope
|
|
8
|
-
* @returns {NamespaceScope}
|
|
9
|
-
* @constructor
|
|
10
|
-
*/
|
|
11
|
-
function NamespaceScope(parent) {
|
|
12
|
-
if (!(this instanceof NamespaceScope)) {
|
|
13
|
-
return new NamespaceScope(parent);
|
|
14
|
-
}
|
|
15
|
-
this.parent = parent;
|
|
16
|
-
this.namespaces = {};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Namespace context that manages hierarchical scopes
|
|
21
|
-
* @returns {NamespaceContext}
|
|
22
|
-
* @constructor
|
|
23
|
-
*/
|
|
24
|
-
function NamespaceContext() {
|
|
25
|
-
if (!(this instanceof NamespaceContext)) {
|
|
26
|
-
return new NamespaceContext();
|
|
27
|
-
}
|
|
28
|
-
this.scopes = [];
|
|
29
|
-
this.pushContext();
|
|
30
|
-
this.prefixCount = 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Look up the namespace URI by prefix
|
|
35
|
-
* @param {String} prefix Namespace prefix
|
|
36
|
-
* @param {Boolean} [localOnly] Search current scope only
|
|
37
|
-
* @returns {String} Namespace URI
|
|
38
|
-
*/
|
|
39
|
-
NamespaceScope.prototype.getNamespaceURI = function(prefix, localOnly) {
|
|
40
|
-
switch (prefix) {
|
|
41
|
-
case 'xml':
|
|
42
|
-
return 'http://www.w3.org/XML/1998/namespace';
|
|
43
|
-
case 'xmlns':
|
|
44
|
-
return 'http://www.w3.org/2000/xmlns/';
|
|
45
|
-
default:
|
|
46
|
-
var nsUri = this.namespaces[prefix];
|
|
47
|
-
/*jshint -W116 */
|
|
48
|
-
if (nsUri != null) {
|
|
49
|
-
return nsUri.uri;
|
|
50
|
-
} else if (!localOnly && this.parent) {
|
|
51
|
-
return this.parent.getNamespaceURI(prefix);
|
|
52
|
-
} else {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
NamespaceScope.prototype.getNamespaceMapping = function(prefix) {
|
|
59
|
-
switch (prefix) {
|
|
60
|
-
case 'xml':
|
|
61
|
-
return {
|
|
62
|
-
uri: 'http://www.w3.org/XML/1998/namespace',
|
|
63
|
-
prefix: 'xml',
|
|
64
|
-
declared: true
|
|
65
|
-
};
|
|
66
|
-
case 'xmlns':
|
|
67
|
-
return {
|
|
68
|
-
uri: 'http://www.w3.org/2000/xmlns/',
|
|
69
|
-
prefix: 'xmlns',
|
|
70
|
-
declared: true
|
|
71
|
-
};
|
|
72
|
-
default:
|
|
73
|
-
var mapping = this.namespaces[prefix];
|
|
74
|
-
/*jshint -W116 */
|
|
75
|
-
if (mapping != null) {
|
|
76
|
-
return mapping;
|
|
77
|
-
} else if (this.parent) {
|
|
78
|
-
return this.parent.getNamespaceMapping(prefix);
|
|
79
|
-
} else {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Look up the namespace prefix by URI
|
|
87
|
-
* @param {String} nsUri Namespace URI
|
|
88
|
-
* @param {Boolean} [localOnly] Search current scope only
|
|
89
|
-
* @returns {String} Namespace prefix
|
|
90
|
-
*/
|
|
91
|
-
NamespaceScope.prototype.getPrefix = function(nsUri, localOnly) {
|
|
92
|
-
switch (nsUri) {
|
|
93
|
-
case 'http://www.w3.org/XML/1998/namespace':
|
|
94
|
-
return 'xml';
|
|
95
|
-
case 'http://www.w3.org/2000/xmlns/':
|
|
96
|
-
return 'xmlns';
|
|
97
|
-
default:
|
|
98
|
-
for (var p in this.namespaces) {
|
|
99
|
-
if (this.namespaces[p].uri === nsUri) {
|
|
100
|
-
return p;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (!localOnly && this.parent) {
|
|
104
|
-
return this.parent.getPrefix(nsUri);
|
|
105
|
-
} else {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Add a prefix/URI namespace mapping
|
|
113
|
-
* @param {String} prefix Namespace prefix
|
|
114
|
-
* @param {String} nsUri Namespace URI
|
|
115
|
-
* @param {Boolean} [localOnly] Search current scope only
|
|
116
|
-
* @returns {boolean} true if the mapping is added or false if the mapping
|
|
117
|
-
* already exists
|
|
118
|
-
*/
|
|
119
|
-
NamespaceContext.prototype.addNamespace = function(prefix, nsUri, localOnly) {
|
|
120
|
-
if (this.getNamespaceURI(prefix, localOnly) === nsUri) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
if (this.currentScope) {
|
|
124
|
-
this.currentScope.namespaces[prefix] = {
|
|
125
|
-
uri: nsUri,
|
|
126
|
-
prefix: prefix,
|
|
127
|
-
declared: false
|
|
128
|
-
};
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
return false;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Push a scope into the context
|
|
136
|
-
* @returns {NamespaceScope} The current scope
|
|
137
|
-
*/
|
|
138
|
-
NamespaceContext.prototype.pushContext = function() {
|
|
139
|
-
var scope = new NamespaceScope(this.currentScope);
|
|
140
|
-
this.scopes.push(scope);
|
|
141
|
-
this.currentScope = scope;
|
|
142
|
-
return scope;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Pop a scope out of the context
|
|
147
|
-
* @returns {NamespaceScope} The removed scope
|
|
148
|
-
*/
|
|
149
|
-
NamespaceContext.prototype.popContext = function() {
|
|
150
|
-
var scope = this.scopes.pop();
|
|
151
|
-
if (scope) {
|
|
152
|
-
this.currentScope = scope.parent;
|
|
153
|
-
} else {
|
|
154
|
-
this.currentScope = null;
|
|
155
|
-
}
|
|
156
|
-
return scope;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Look up the namespace URI by prefix
|
|
161
|
-
* @param {String} prefix Namespace prefix
|
|
162
|
-
* @param {Boolean} [localOnly] Search current scope only
|
|
163
|
-
* @returns {String} Namespace URI
|
|
164
|
-
*/
|
|
165
|
-
NamespaceContext.prototype.getNamespaceURI = function(prefix, localOnly) {
|
|
166
|
-
return this.currentScope && this.currentScope.getNamespaceURI(prefix, localOnly);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Look up the namespace prefix by URI
|
|
171
|
-
* @param {String} nsURI Namespace URI
|
|
172
|
-
* @param {Boolean} [localOnly] Search current scope only
|
|
173
|
-
* @returns {String} Namespace prefix
|
|
174
|
-
*/
|
|
175
|
-
NamespaceContext.prototype.getPrefix = function(nsUri, localOnly) {
|
|
176
|
-
return this.currentScope && this.currentScope.getPrefix(nsUri, localOnly);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Register a namespace
|
|
181
|
-
* @param {String} nsUri Namespace URI
|
|
182
|
-
* @returns {String} The matching or generated namespace prefix
|
|
183
|
-
*/
|
|
184
|
-
NamespaceContext.prototype.registerNamespace = function(nsUri) {
|
|
185
|
-
var prefix = this.getPrefix(nsUri);
|
|
186
|
-
if (prefix) {
|
|
187
|
-
// If the namespace has already mapped to a prefix
|
|
188
|
-
return prefix;
|
|
189
|
-
} else {
|
|
190
|
-
// Try to generate a unique namespace
|
|
191
|
-
while (true) {
|
|
192
|
-
prefix = 'ns' + (++this.prefixCount);
|
|
193
|
-
if (!this.getNamespaceURI(prefix)) {
|
|
194
|
-
// The prefix is not used
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
this.addNamespace(prefix, nsUri, true);
|
|
200
|
-
return prefix;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Declare a namespace prefix/uri mapping
|
|
205
|
-
* @param {String} prefix Namespace prefix
|
|
206
|
-
* @param {String} nsUri Namespace URI
|
|
207
|
-
* @returns {Boolean} true if the declaration is created
|
|
208
|
-
*/
|
|
209
|
-
NamespaceContext.prototype.declareNamespace = function(prefix, nsUri) {
|
|
210
|
-
if (this.currentScope) {
|
|
211
|
-
var mapping = this.currentScope.getNamespaceMapping(prefix);
|
|
212
|
-
if (mapping && mapping.uri === nsUri && mapping.declared) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
this.currentScope.namespaces[prefix] = {
|
|
216
|
-
uri: nsUri,
|
|
217
|
-
prefix: prefix,
|
|
218
|
-
declared: true
|
|
219
|
-
};
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
return false;
|
|
223
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = NamespaceContext;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Scope for XML namespaces
|
|
7
|
+
* @param {NamespaceScope} [parent] Parent scope
|
|
8
|
+
* @returns {NamespaceScope}
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
function NamespaceScope(parent) {
|
|
12
|
+
if (!(this instanceof NamespaceScope)) {
|
|
13
|
+
return new NamespaceScope(parent);
|
|
14
|
+
}
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
this.namespaces = {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Namespace context that manages hierarchical scopes
|
|
21
|
+
* @returns {NamespaceContext}
|
|
22
|
+
* @constructor
|
|
23
|
+
*/
|
|
24
|
+
function NamespaceContext() {
|
|
25
|
+
if (!(this instanceof NamespaceContext)) {
|
|
26
|
+
return new NamespaceContext();
|
|
27
|
+
}
|
|
28
|
+
this.scopes = [];
|
|
29
|
+
this.pushContext();
|
|
30
|
+
this.prefixCount = 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Look up the namespace URI by prefix
|
|
35
|
+
* @param {String} prefix Namespace prefix
|
|
36
|
+
* @param {Boolean} [localOnly] Search current scope only
|
|
37
|
+
* @returns {String} Namespace URI
|
|
38
|
+
*/
|
|
39
|
+
NamespaceScope.prototype.getNamespaceURI = function(prefix, localOnly) {
|
|
40
|
+
switch (prefix) {
|
|
41
|
+
case 'xml':
|
|
42
|
+
return 'http://www.w3.org/XML/1998/namespace';
|
|
43
|
+
case 'xmlns':
|
|
44
|
+
return 'http://www.w3.org/2000/xmlns/';
|
|
45
|
+
default:
|
|
46
|
+
var nsUri = this.namespaces[prefix];
|
|
47
|
+
/*jshint -W116 */
|
|
48
|
+
if (nsUri != null) {
|
|
49
|
+
return nsUri.uri;
|
|
50
|
+
} else if (!localOnly && this.parent) {
|
|
51
|
+
return this.parent.getNamespaceURI(prefix);
|
|
52
|
+
} else {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
NamespaceScope.prototype.getNamespaceMapping = function(prefix) {
|
|
59
|
+
switch (prefix) {
|
|
60
|
+
case 'xml':
|
|
61
|
+
return {
|
|
62
|
+
uri: 'http://www.w3.org/XML/1998/namespace',
|
|
63
|
+
prefix: 'xml',
|
|
64
|
+
declared: true
|
|
65
|
+
};
|
|
66
|
+
case 'xmlns':
|
|
67
|
+
return {
|
|
68
|
+
uri: 'http://www.w3.org/2000/xmlns/',
|
|
69
|
+
prefix: 'xmlns',
|
|
70
|
+
declared: true
|
|
71
|
+
};
|
|
72
|
+
default:
|
|
73
|
+
var mapping = this.namespaces[prefix];
|
|
74
|
+
/*jshint -W116 */
|
|
75
|
+
if (mapping != null) {
|
|
76
|
+
return mapping;
|
|
77
|
+
} else if (this.parent) {
|
|
78
|
+
return this.parent.getNamespaceMapping(prefix);
|
|
79
|
+
} else {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Look up the namespace prefix by URI
|
|
87
|
+
* @param {String} nsUri Namespace URI
|
|
88
|
+
* @param {Boolean} [localOnly] Search current scope only
|
|
89
|
+
* @returns {String} Namespace prefix
|
|
90
|
+
*/
|
|
91
|
+
NamespaceScope.prototype.getPrefix = function(nsUri, localOnly) {
|
|
92
|
+
switch (nsUri) {
|
|
93
|
+
case 'http://www.w3.org/XML/1998/namespace':
|
|
94
|
+
return 'xml';
|
|
95
|
+
case 'http://www.w3.org/2000/xmlns/':
|
|
96
|
+
return 'xmlns';
|
|
97
|
+
default:
|
|
98
|
+
for (var p in this.namespaces) {
|
|
99
|
+
if (this.namespaces[p].uri === nsUri) {
|
|
100
|
+
return p;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!localOnly && this.parent) {
|
|
104
|
+
return this.parent.getPrefix(nsUri);
|
|
105
|
+
} else {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Add a prefix/URI namespace mapping
|
|
113
|
+
* @param {String} prefix Namespace prefix
|
|
114
|
+
* @param {String} nsUri Namespace URI
|
|
115
|
+
* @param {Boolean} [localOnly] Search current scope only
|
|
116
|
+
* @returns {boolean} true if the mapping is added or false if the mapping
|
|
117
|
+
* already exists
|
|
118
|
+
*/
|
|
119
|
+
NamespaceContext.prototype.addNamespace = function(prefix, nsUri, localOnly) {
|
|
120
|
+
if (this.getNamespaceURI(prefix, localOnly) === nsUri) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (this.currentScope) {
|
|
124
|
+
this.currentScope.namespaces[prefix] = {
|
|
125
|
+
uri: nsUri,
|
|
126
|
+
prefix: prefix,
|
|
127
|
+
declared: false
|
|
128
|
+
};
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Push a scope into the context
|
|
136
|
+
* @returns {NamespaceScope} The current scope
|
|
137
|
+
*/
|
|
138
|
+
NamespaceContext.prototype.pushContext = function() {
|
|
139
|
+
var scope = new NamespaceScope(this.currentScope);
|
|
140
|
+
this.scopes.push(scope);
|
|
141
|
+
this.currentScope = scope;
|
|
142
|
+
return scope;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Pop a scope out of the context
|
|
147
|
+
* @returns {NamespaceScope} The removed scope
|
|
148
|
+
*/
|
|
149
|
+
NamespaceContext.prototype.popContext = function() {
|
|
150
|
+
var scope = this.scopes.pop();
|
|
151
|
+
if (scope) {
|
|
152
|
+
this.currentScope = scope.parent;
|
|
153
|
+
} else {
|
|
154
|
+
this.currentScope = null;
|
|
155
|
+
}
|
|
156
|
+
return scope;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Look up the namespace URI by prefix
|
|
161
|
+
* @param {String} prefix Namespace prefix
|
|
162
|
+
* @param {Boolean} [localOnly] Search current scope only
|
|
163
|
+
* @returns {String} Namespace URI
|
|
164
|
+
*/
|
|
165
|
+
NamespaceContext.prototype.getNamespaceURI = function(prefix, localOnly) {
|
|
166
|
+
return this.currentScope && this.currentScope.getNamespaceURI(prefix, localOnly);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Look up the namespace prefix by URI
|
|
171
|
+
* @param {String} nsURI Namespace URI
|
|
172
|
+
* @param {Boolean} [localOnly] Search current scope only
|
|
173
|
+
* @returns {String} Namespace prefix
|
|
174
|
+
*/
|
|
175
|
+
NamespaceContext.prototype.getPrefix = function(nsUri, localOnly) {
|
|
176
|
+
return this.currentScope && this.currentScope.getPrefix(nsUri, localOnly);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Register a namespace
|
|
181
|
+
* @param {String} nsUri Namespace URI
|
|
182
|
+
* @returns {String} The matching or generated namespace prefix
|
|
183
|
+
*/
|
|
184
|
+
NamespaceContext.prototype.registerNamespace = function(nsUri) {
|
|
185
|
+
var prefix = this.getPrefix(nsUri);
|
|
186
|
+
if (prefix) {
|
|
187
|
+
// If the namespace has already mapped to a prefix
|
|
188
|
+
return prefix;
|
|
189
|
+
} else {
|
|
190
|
+
// Try to generate a unique namespace
|
|
191
|
+
while (true) {
|
|
192
|
+
prefix = 'ns' + (++this.prefixCount);
|
|
193
|
+
if (!this.getNamespaceURI(prefix)) {
|
|
194
|
+
// The prefix is not used
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.addNamespace(prefix, nsUri, true);
|
|
200
|
+
return prefix;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Declare a namespace prefix/uri mapping
|
|
205
|
+
* @param {String} prefix Namespace prefix
|
|
206
|
+
* @param {String} nsUri Namespace URI
|
|
207
|
+
* @returns {Boolean} true if the declaration is created
|
|
208
|
+
*/
|
|
209
|
+
NamespaceContext.prototype.declareNamespace = function(prefix, nsUri) {
|
|
210
|
+
if (this.currentScope) {
|
|
211
|
+
var mapping = this.currentScope.getNamespaceMapping(prefix);
|
|
212
|
+
if (mapping && mapping.uri === nsUri && mapping.declared) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
this.currentScope.namespaces[prefix] = {
|
|
216
|
+
uri: nsUri,
|
|
217
|
+
prefix: prefix,
|
|
218
|
+
declared: true
|
|
219
|
+
};
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
|
|
5
|
-
function BasicAuthSecurity(username, password, defaults) {
|
|
6
|
-
this._username = username;
|
|
7
|
-
this._password = password;
|
|
8
|
-
this.defaults = {};
|
|
9
|
-
_.merge(this.defaults, defaults);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
BasicAuthSecurity.prototype.addHeaders = function(headers) {
|
|
13
|
-
headers.Authorization = 'Basic ' + new Buffer((this._username + ':' + this._password) || '').toString('base64');
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
BasicAuthSecurity.prototype.toXML = function() {
|
|
17
|
-
return '';
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
BasicAuthSecurity.prototype.addOptions = function(options) {
|
|
21
|
-
_.merge(options, this.defaults);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
module.exports = BasicAuthSecurity;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
function BasicAuthSecurity(username, password, defaults) {
|
|
6
|
+
this._username = username;
|
|
7
|
+
this._password = password;
|
|
8
|
+
this.defaults = {};
|
|
9
|
+
_.merge(this.defaults, defaults);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
BasicAuthSecurity.prototype.addHeaders = function(headers) {
|
|
13
|
+
headers.Authorization = 'Basic ' + new Buffer((this._username + ':' + this._password) || '').toString('base64');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
BasicAuthSecurity.prototype.toXML = function() {
|
|
17
|
+
return '';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
BasicAuthSecurity.prototype.addOptions = function(options) {
|
|
21
|
+
_.merge(options, this.defaults);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
module.exports = BasicAuthSecurity;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
|
|
5
|
-
function BearerSecurity(token, defaults) {
|
|
6
|
-
this._token = token;
|
|
7
|
-
this.defaults = {};
|
|
8
|
-
_.merge(this.defaults, defaults);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
BearerSecurity.prototype.addHeaders = function(headers) {
|
|
12
|
-
headers.Authorization = "Bearer " + this._token;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
BearerSecurity.prototype.toXML = function() {
|
|
16
|
-
return '';
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
BearerSecurity.prototype.addOptions = function(options) {
|
|
20
|
-
_.merge(options, this.defaults);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
module.exports = BearerSecurity;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
function BearerSecurity(token, defaults) {
|
|
6
|
+
this._token = token;
|
|
7
|
+
this.defaults = {};
|
|
8
|
+
_.merge(this.defaults, defaults);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
BearerSecurity.prototype.addHeaders = function(headers) {
|
|
12
|
+
headers.Authorization = "Bearer " + this._token;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
BearerSecurity.prototype.toXML = function() {
|
|
16
|
+
return '';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
BearerSecurity.prototype.addOptions = function(options) {
|
|
20
|
+
_.merge(options, this.defaults);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = BearerSecurity;
|