@azure/msal-node 1.14.6 → 1.15.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/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +28 -19
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +28 -19
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/network/HttpClient.d.ts +6 -0
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/ClientCredentialRequest.d.ts +1 -0
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/DeviceCodeRequest.d.ts +1 -0
- package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
- package/dist/request/OnBehalfOfRequest.d.ts +1 -0
- package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/SilentFlowRequest.d.ts +1 -1
- package/dist/request/UsernamePasswordRequest.d.ts +1 -0
- package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/msal-node.esm.js
CHANGED
|
@@ -122,16 +122,20 @@ class NetworkUtils {
|
|
|
122
122
|
* This class implements the API for network requests.
|
|
123
123
|
*/
|
|
124
124
|
class HttpClient {
|
|
125
|
+
constructor(proxyUrl, customAgentOptions) {
|
|
126
|
+
this.proxyUrl = proxyUrl || "";
|
|
127
|
+
this.customAgentOptions = customAgentOptions || {};
|
|
128
|
+
}
|
|
125
129
|
/**
|
|
126
130
|
* Http Get request
|
|
127
131
|
* @param url
|
|
128
132
|
* @param options
|
|
129
133
|
*/
|
|
130
134
|
async sendGetRequestAsync(url, options) {
|
|
131
|
-
if (
|
|
132
|
-
return networkRequestViaProxy(url, HttpMethod.GET, options);
|
|
135
|
+
if (this.proxyUrl) {
|
|
136
|
+
return networkRequestViaProxy(url, this.proxyUrl, HttpMethod.GET, options, this.customAgentOptions);
|
|
133
137
|
} else {
|
|
134
|
-
return networkRequestViaHttps(url, HttpMethod.GET, options);
|
|
138
|
+
return networkRequestViaHttps(url, HttpMethod.GET, options, this.customAgentOptions);
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
141
|
/**
|
|
@@ -140,16 +144,16 @@ class HttpClient {
|
|
|
140
144
|
* @param options
|
|
141
145
|
*/
|
|
142
146
|
async sendPostRequestAsync(url, options, cancellationToken) {
|
|
143
|
-
if (
|
|
144
|
-
return networkRequestViaProxy(url, HttpMethod.POST, options, cancellationToken);
|
|
147
|
+
if (this.proxyUrl) {
|
|
148
|
+
return networkRequestViaProxy(url, this.proxyUrl, HttpMethod.POST, options, this.customAgentOptions, cancellationToken);
|
|
145
149
|
} else {
|
|
146
|
-
return networkRequestViaHttps(url, HttpMethod.POST, options, cancellationToken);
|
|
150
|
+
return networkRequestViaHttps(url, HttpMethod.POST, options, this.customAgentOptions, cancellationToken);
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
|
-
const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
154
|
+
const networkRequestViaProxy = (url, proxyUrlString, httpMethod, options, agentOptions, timeout) => {
|
|
151
155
|
const headers = (options == null ? void 0 : options.headers) || {};
|
|
152
|
-
const proxyUrl = new URL(
|
|
156
|
+
const proxyUrl = new URL(proxyUrlString);
|
|
153
157
|
const destinationUrl = new URL(url);
|
|
154
158
|
// "method: connect" must be used to establish a connection to the proxy
|
|
155
159
|
const tunnelRequestOptions = {
|
|
@@ -162,6 +166,9 @@ const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
|
162
166
|
if (timeout) {
|
|
163
167
|
tunnelRequestOptions.timeout = timeout;
|
|
164
168
|
}
|
|
169
|
+
if (agentOptions && Object.keys(agentOptions).length) {
|
|
170
|
+
tunnelRequestOptions.agent = new http.Agent(agentOptions);
|
|
171
|
+
}
|
|
165
172
|
// compose a request string for the socket
|
|
166
173
|
let postRequestStringContent = "";
|
|
167
174
|
if (httpMethod === HttpMethod.POST) {
|
|
@@ -259,7 +266,7 @@ const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
|
259
266
|
});
|
|
260
267
|
});
|
|
261
268
|
};
|
|
262
|
-
const networkRequestViaHttps = (url, httpMethod, options, timeout) => {
|
|
269
|
+
const networkRequestViaHttps = (url, httpMethod, options, agentOptions, timeout) => {
|
|
263
270
|
const isPostRequest = httpMethod === HttpMethod.POST;
|
|
264
271
|
const body = (options == null ? void 0 : options.body) || "";
|
|
265
272
|
const emptyHeaders = {};
|
|
@@ -270,6 +277,9 @@ const networkRequestViaHttps = (url, httpMethod, options, timeout) => {
|
|
|
270
277
|
if (timeout) {
|
|
271
278
|
customOptions.timeout = timeout;
|
|
272
279
|
}
|
|
280
|
+
if (agentOptions && Object.keys(agentOptions).length) {
|
|
281
|
+
customOptions.agent = new https.Agent(agentOptions);
|
|
282
|
+
}
|
|
273
283
|
if (isPostRequest) {
|
|
274
284
|
// needed for post request to work
|
|
275
285
|
customOptions.headers = {
|
|
@@ -392,7 +402,8 @@ const DEFAULT_LOGGER_OPTIONS = {
|
|
|
392
402
|
const DEFAULT_SYSTEM_OPTIONS = {
|
|
393
403
|
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
394
404
|
networkClient: /*#__PURE__*/new HttpClient(),
|
|
395
|
-
proxyUrl: Constants$1.EMPTY_STRING
|
|
405
|
+
proxyUrl: Constants$1.EMPTY_STRING,
|
|
406
|
+
customAgentOptions: {}
|
|
396
407
|
};
|
|
397
408
|
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
398
409
|
application: {
|
|
@@ -417,8 +428,9 @@ function buildAppConfiguration({
|
|
|
417
428
|
system,
|
|
418
429
|
telemetry
|
|
419
430
|
}) {
|
|
420
|
-
const
|
|
421
|
-
...
|
|
431
|
+
const systemOptions = {
|
|
432
|
+
...DEFAULT_SYSTEM_OPTIONS,
|
|
433
|
+
networkClient: new HttpClient(system == null ? void 0 : system.proxyUrl, system == null ? void 0 : system.customAgentOptions),
|
|
422
434
|
loggerOptions: (system == null ? void 0 : system.loggerOptions) || DEFAULT_LOGGER_OPTIONS
|
|
423
435
|
};
|
|
424
436
|
return {
|
|
@@ -431,8 +443,8 @@ function buildAppConfiguration({
|
|
|
431
443
|
...cache
|
|
432
444
|
},
|
|
433
445
|
system: {
|
|
434
|
-
...
|
|
435
|
-
...
|
|
446
|
+
...systemOptions,
|
|
447
|
+
...system
|
|
436
448
|
},
|
|
437
449
|
telemetry: {
|
|
438
450
|
...DEFAULT_TELEMETRY_OPTIONS,
|
|
@@ -1575,7 +1587,7 @@ class TokenCache {
|
|
|
1575
1587
|
|
|
1576
1588
|
/* eslint-disable header/header */
|
|
1577
1589
|
const name = "@azure/msal-node";
|
|
1578
|
-
const version = "1.
|
|
1590
|
+
const version = "1.15.0";
|
|
1579
1591
|
|
|
1580
1592
|
/*
|
|
1581
1593
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1884,9 +1896,6 @@ class ClientApplication {
|
|
|
1884
1896
|
authority: discoveredAuthority,
|
|
1885
1897
|
clientCapabilities: this.config.auth.clientCapabilities
|
|
1886
1898
|
},
|
|
1887
|
-
systemOptions: {
|
|
1888
|
-
proxyUrl: this.config.system.proxyUrl
|
|
1889
|
-
},
|
|
1890
1899
|
loggerOptions: {
|
|
1891
1900
|
logLevel: this.config.system.loggerOptions.logLevel,
|
|
1892
1901
|
loggerCallback: this.config.system.loggerOptions.loggerCallback,
|
|
@@ -1973,7 +1982,7 @@ class ClientApplication {
|
|
|
1973
1982
|
azureRegionConfiguration,
|
|
1974
1983
|
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache
|
|
1975
1984
|
};
|
|
1976
|
-
return await AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger
|
|
1985
|
+
return await AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger);
|
|
1977
1986
|
}
|
|
1978
1987
|
/**
|
|
1979
1988
|
* Clear the cache
|