@azure/msal-node 1.7.0 → 1.9.1
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/README.md +1 -1
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/config/Configuration.d.ts +8 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/crypto/CryptoProvider.d.ts +1 -0
- package/dist/crypto/CryptoProvider.d.ts.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts +4 -3
- package/dist/crypto/GuidGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +237 -70
- 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 +237 -70
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/EncodingUtils.d.ts.map +1 -1
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Any major MSAL Node release:
|
|
|
84
84
|
|
|
85
85
|
| MSAL Node version | MSAL support status | Supported Node versions |
|
|
86
86
|
|-------------------|-------------------------|-------------------------|
|
|
87
|
-
| 1.x.x | Active development | 10, 12, 14, 16
|
|
87
|
+
| 1.x.x | Active development | 10, 12, 14, 16, 18 |
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
## Usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB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AiB7B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,EAMvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,8BAA8B;IAE1G;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAKxC;;OAEG;IACU,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+BnH;;;;;;;;;;OAUG;IACU,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyBrG,OAAO,CAAC,mBAAmB;CAkC9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions } from "@azure/msal-common";
|
|
1
|
+
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions, ApplicationTelemetry } from "@azure/msal-common";
|
|
2
2
|
/**
|
|
3
3
|
* - clientId - Client id of the application.
|
|
4
4
|
* - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
|
|
@@ -47,6 +47,9 @@ export declare type NodeSystemOptions = {
|
|
|
47
47
|
networkClient?: INetworkModule;
|
|
48
48
|
proxyUrl?: string;
|
|
49
49
|
};
|
|
50
|
+
export declare type NodeTelemetryOptions = {
|
|
51
|
+
application?: ApplicationTelemetry;
|
|
52
|
+
};
|
|
50
53
|
/**
|
|
51
54
|
* Use the configuration object to configure MSAL and initialize the client application object
|
|
52
55
|
*
|
|
@@ -59,11 +62,13 @@ export declare type Configuration = {
|
|
|
59
62
|
auth: NodeAuthOptions;
|
|
60
63
|
cache?: CacheOptions;
|
|
61
64
|
system?: NodeSystemOptions;
|
|
65
|
+
telemetry?: NodeTelemetryOptions;
|
|
62
66
|
};
|
|
63
67
|
export declare type NodeConfiguration = {
|
|
64
68
|
auth: Required<NodeAuthOptions>;
|
|
65
69
|
cache: CacheOptions;
|
|
66
70
|
system: Required<NodeSystemOptions>;
|
|
71
|
+
telemetry: Required<NodeTelemetryOptions>;
|
|
67
72
|
};
|
|
68
73
|
/**
|
|
69
74
|
* Sets the default options when not explicitly configured from app developer
|
|
@@ -71,9 +76,10 @@ export declare type NodeConfiguration = {
|
|
|
71
76
|
* @param auth - Authentication options
|
|
72
77
|
* @param cache - Cache options
|
|
73
78
|
* @param system - System options
|
|
79
|
+
* @param telemetry - Telemetry options
|
|
74
80
|
*
|
|
75
81
|
* @returns Configuration
|
|
76
82
|
* @public
|
|
77
83
|
*/
|
|
78
|
-
export declare function buildAppConfiguration({ auth, cache, system, }: Configuration): NodeConfiguration;
|
|
84
|
+
export declare function buildAppConfiguration({ auth, cache, system, telemetry }: Configuration): NodeConfiguration;
|
|
79
85
|
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EAGZ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EAGZ,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;GASG;AACH,oBAAY,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAC,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAA;KACf,CAAC;IACF,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,YAAY,GAAG;IACvB,WAAW,CAAC,EAAE,YAAY,CAAC;CAC9B,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,iBAAiB,GAAG;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IAC/B,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC;AAEF;;;;;;;GAOG;AACH,oBAAY,aAAa,GAAG;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,oBAAoB,CAAC;CACpC,CAAC;AA8CF,oBAAY,iBAAiB,GAAG;IAC5B,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACpC,SAAS,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACZ,EAAE,aAAa,GAAG,iBAAiB,CAQnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoProvider.d.ts","sourceRoot":"","sources":["../src/crypto/CryptoProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMxD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC1C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAY;;
|
|
1
|
+
{"version":3,"file":"CryptoProvider.d.ts","sourceRoot":"","sources":["../src/crypto/CryptoProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMxD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC1C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAY;;IAS7B;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC;IAIvC;;OAEG;IACH,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIzC;;;OAGG;IACH,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1B;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMvD"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { IGuidGenerator } from "@azure/msal-common";
|
|
2
|
+
export declare class GuidGenerator implements IGuidGenerator {
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
5
6
|
* uuidv4 generates guids from cryprtographically-string random
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
generateGuid(): string;
|
|
8
9
|
/**
|
|
9
10
|
* verifies if a string is GUID
|
|
10
11
|
* @param guid
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
isGuid(guid: string): boolean;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=GuidGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuidGenerator.d.ts","sourceRoot":"","sources":["../src/crypto/GuidGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GuidGenerator.d.ts","sourceRoot":"","sources":["../src/crypto/GuidGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,qBAAa,aAAc,YAAW,cAAc;IAChD;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAIhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkceGenerator.d.ts","sourceRoot":"","sources":["../src/crypto/PkceGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"PkceGenerator.d.ts","sourceRoot":"","sources":["../src/crypto/PkceGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM1D;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,SAAS,CAAY;;IAK7B;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC;IAM7C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACH,OAAO,CAAC,iCAAiC;CAO5C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,6 @@ export type { OnBehalfOfRequest } from "./request/OnBehalfOfRequest";
|
|
|
25
25
|
export type { UsernamePasswordRequest } from "./request/UsernamePasswordRequest";
|
|
26
26
|
export type { RefreshTokenRequest } from "./request/RefreshTokenRequest";
|
|
27
27
|
export type { SilentFlowRequest } from "./request/SilentFlowRequest";
|
|
28
|
-
export { PromptValue, ResponseMode, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache, AzureCloudInstance, AzureCloudOptions } from "@azure/msal-common";
|
|
28
|
+
export { PromptValue, ResponseMode, AuthorizationCodePayload, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache, AzureCloudInstance, AzureCloudOptions } from "@azure/msal-common";
|
|
29
29
|
export { version } from "./packageMetadata";
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,2BAA2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MAAM,mBAAmB,CAAC"}
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var msalCommon = require('@azure/msal-common');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var http = _interopDefault(require('http'));
|
|
9
|
+
var https = _interopDefault(require('https'));
|
|
10
10
|
var uuid = require('uuid');
|
|
11
11
|
var crypto = _interopDefault(require('crypto'));
|
|
12
12
|
var jsonwebtoken = require('jsonwebtoken');
|
|
@@ -56,7 +56,8 @@ const CharSet = {
|
|
|
56
56
|
|
|
57
57
|
const Constants = {
|
|
58
58
|
MSAL_SKU: "msal.js.node",
|
|
59
|
-
JWT_BEARER_ASSERTION_TYPE: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
|
|
59
|
+
JWT_BEARER_ASSERTION_TYPE: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
|
|
60
|
+
AUTHORIZATION_PENDING: "authorization_pending"
|
|
60
61
|
};
|
|
61
62
|
/**
|
|
62
63
|
* API Codes for Telemetry purposes.
|
|
@@ -109,29 +110,11 @@ class HttpClient {
|
|
|
109
110
|
* @param options
|
|
110
111
|
*/
|
|
111
112
|
async sendGetRequestAsync(url, options) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/* istanbul ignore next */
|
|
117
|
-
headers: options && options.headers,
|
|
118
|
-
|
|
119
|
-
/* istanbul ignore next */
|
|
120
|
-
validateStatus: () => true
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if (options && options.proxyUrl) {
|
|
124
|
-
// for axios, this has to be disabled
|
|
125
|
-
request.proxy = false;
|
|
126
|
-
request.httpsAgent = createHttpsProxyAgent(options.proxyUrl);
|
|
113
|
+
if (options != null && options.proxyUrl) {
|
|
114
|
+
return networkRequestViaProxy(url, HttpMethod.GET, options);
|
|
115
|
+
} else {
|
|
116
|
+
return networkRequestViaHttps(url, HttpMethod.GET, options);
|
|
127
117
|
}
|
|
128
|
-
|
|
129
|
-
const response = await axios(request);
|
|
130
|
-
return {
|
|
131
|
-
headers: response.headers,
|
|
132
|
-
body: response.data,
|
|
133
|
-
status: response.status
|
|
134
|
-
};
|
|
135
118
|
}
|
|
136
119
|
/**
|
|
137
120
|
* Http Post request
|
|
@@ -141,36 +124,207 @@ class HttpClient {
|
|
|
141
124
|
|
|
142
125
|
|
|
143
126
|
async sendPostRequestAsync(url, options, cancellationToken) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
127
|
+
if (options != null && options.proxyUrl) {
|
|
128
|
+
return networkRequestViaProxy(url, HttpMethod.POST, options, cancellationToken);
|
|
129
|
+
} else {
|
|
130
|
+
return networkRequestViaHttps(url, HttpMethod.POST, options, cancellationToken);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
137
|
+
const headers = (options == null ? void 0 : options.headers) || {};
|
|
138
|
+
const proxyUrl = new URL((options == null ? void 0 : options.proxyUrl) || "");
|
|
139
|
+
const destinationUrl = new URL(url); // "method: connect" must be used to establish a connection to the proxy
|
|
140
|
+
|
|
141
|
+
const tunnelRequestOptions = {
|
|
142
|
+
host: proxyUrl.hostname,
|
|
143
|
+
port: proxyUrl.port,
|
|
144
|
+
method: "CONNECT",
|
|
145
|
+
path: destinationUrl.hostname,
|
|
146
|
+
headers: headers
|
|
147
|
+
};
|
|
147
148
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
if (timeout) {
|
|
150
|
+
tunnelRequestOptions.timeout = timeout;
|
|
151
|
+
} // compose a request string for the socket
|
|
151
152
|
|
|
152
|
-
/* istanbul ignore next */
|
|
153
|
-
headers: options && options.headers,
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
validateStatus: () => true
|
|
157
|
-
};
|
|
154
|
+
let postRequestStringContent = "";
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
if (httpMethod === HttpMethod.POST) {
|
|
157
|
+
const body = (options == null ? void 0 : options.body) || "";
|
|
158
|
+
postRequestStringContent = "Content-Type: application/x-www-form-urlencoded\r\n" + `Content-Length: ${body.length}\r\n` + `\r\n${body}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const outgoingRequestString = `${httpMethod.toUpperCase()} ${destinationUrl.href} HTTP/1.1\r\n` + `Host: ${destinationUrl.host}\r\n` + "Connection: close\r\n" + postRequestStringContent + "\r\n";
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
const request = http.request(tunnelRequestOptions);
|
|
164
|
+
|
|
165
|
+
if (tunnelRequestOptions.timeout) {
|
|
166
|
+
request.on("timeout", () => {
|
|
167
|
+
request.destroy();
|
|
168
|
+
reject(new Error("Request time out"));
|
|
169
|
+
});
|
|
163
170
|
}
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
request.end(); // establish connection to the proxy
|
|
173
|
+
|
|
174
|
+
request.on("connect", (response, socket) => {
|
|
175
|
+
const statusCode = (response == null ? void 0 : response.statusCode) || 500;
|
|
176
|
+
|
|
177
|
+
if (statusCode < 200 || statusCode > 299) {
|
|
178
|
+
request.destroy();
|
|
179
|
+
socket.destroy();
|
|
180
|
+
reject(new Error(`HTTP status code ${statusCode}`));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (tunnelRequestOptions.timeout) {
|
|
184
|
+
socket.setTimeout(tunnelRequestOptions.timeout);
|
|
185
|
+
socket.on("timeout", () => {
|
|
186
|
+
request.destroy();
|
|
187
|
+
socket.destroy();
|
|
188
|
+
reject(new Error("Request time out"));
|
|
189
|
+
});
|
|
190
|
+
} // make a request over an HTTP tunnel
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
socket.write(outgoingRequestString);
|
|
194
|
+
const data = [];
|
|
195
|
+
socket.on("data", chunk => {
|
|
196
|
+
data.push(chunk);
|
|
197
|
+
});
|
|
198
|
+
socket.on("end", () => {
|
|
199
|
+
// combine all received buffer streams into one buffer, and then into a string
|
|
200
|
+
const dataString = Buffer.concat([...data]).toString(); // separate each line into it's own entry in an arry
|
|
201
|
+
|
|
202
|
+
const dataStringArray = dataString.split("\r\n"); // the first entry will contain the statusCode
|
|
203
|
+
|
|
204
|
+
const statusCode = parseInt(dataStringArray[0].split(" ")[1]); // the last entry will contain the body
|
|
205
|
+
|
|
206
|
+
const body = dataStringArray[dataStringArray.length - 1]; // everything in between the first and last entries are the headers
|
|
207
|
+
|
|
208
|
+
const headersArray = dataStringArray.slice(1, dataStringArray.length - 2); // build an object out of all the headers
|
|
209
|
+
|
|
210
|
+
const entries = new Map();
|
|
211
|
+
headersArray.forEach(header => {
|
|
212
|
+
/**
|
|
213
|
+
* the header might look like "Content-Length: 1531", but that is just a string
|
|
214
|
+
* it needs to be converted to a key/value pair
|
|
215
|
+
* split the string at the first instance of ":"
|
|
216
|
+
* there may be more than one ":" if the value of the header is supposed to be a JSON object
|
|
217
|
+
*/
|
|
218
|
+
const headerKeyValue = header.split(new RegExp(/:\s(.*)/s));
|
|
219
|
+
const headerKey = headerKeyValue[0];
|
|
220
|
+
let headerValue = headerKeyValue[1]; // check if the value of the header is supposed to be a JSON object
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
const object = JSON.parse(headerValue); // if it is, then convert it from a string to a JSON object
|
|
224
|
+
|
|
225
|
+
if (object && typeof object === "object") {
|
|
226
|
+
headerValue = object;
|
|
227
|
+
}
|
|
228
|
+
} catch (e) {// otherwise, leave it as a string
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
entries.set(headerKey, headerValue);
|
|
232
|
+
});
|
|
233
|
+
const headers = Object.fromEntries(entries);
|
|
234
|
+
const networkResponse = {
|
|
235
|
+
headers: headers,
|
|
236
|
+
body: JSON.parse(body),
|
|
237
|
+
status: statusCode
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
if ((statusCode < 200 || statusCode > 299) && // do not destroy the request for the device code flow
|
|
241
|
+
networkResponse.body["error"] !== Constants.AUTHORIZATION_PENDING) {
|
|
242
|
+
request.destroy();
|
|
243
|
+
socket.destroy();
|
|
244
|
+
reject(new Error(`HTTP status code ${statusCode}`));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
resolve(networkResponse);
|
|
248
|
+
});
|
|
249
|
+
socket.on("error", chunk => {
|
|
250
|
+
request.destroy();
|
|
251
|
+
socket.destroy();
|
|
252
|
+
reject(new Error(chunk.toString()));
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
request.on("error", chunk => {
|
|
256
|
+
request.destroy();
|
|
257
|
+
reject(new Error(chunk.toString()));
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const networkRequestViaHttps = (url, httpMethod, options, timeout) => {
|
|
263
|
+
const isPostRequest = httpMethod === HttpMethod.POST;
|
|
264
|
+
const body = (options == null ? void 0 : options.body) || "";
|
|
265
|
+
const emptyHeaders = {};
|
|
266
|
+
const customOptions = {
|
|
267
|
+
method: httpMethod,
|
|
268
|
+
headers: (options == null ? void 0 : options.headers) || emptyHeaders
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
if (timeout) {
|
|
272
|
+
customOptions.timeout = timeout;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (isPostRequest) {
|
|
276
|
+
// needed for post request to work
|
|
277
|
+
customOptions.headers = { ...customOptions.headers,
|
|
278
|
+
"Content-Length": body.length
|
|
170
279
|
};
|
|
171
280
|
}
|
|
172
281
|
|
|
173
|
-
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
283
|
+
const request = https.request(url, customOptions);
|
|
284
|
+
|
|
285
|
+
if (timeout) {
|
|
286
|
+
request.on("timeout", () => {
|
|
287
|
+
request.destroy();
|
|
288
|
+
reject(new Error("Request time out"));
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (isPostRequest) {
|
|
293
|
+
request.write(body);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
request.end();
|
|
297
|
+
request.on("response", response => {
|
|
298
|
+
const headers = response.headers;
|
|
299
|
+
const statusCode = response.statusCode;
|
|
300
|
+
const data = [];
|
|
301
|
+
response.on("data", chunk => {
|
|
302
|
+
data.push(chunk);
|
|
303
|
+
});
|
|
304
|
+
response.on("end", () => {
|
|
305
|
+
// combine all received buffer streams into one buffer, and then into a string
|
|
306
|
+
const body = Buffer.concat([...data]).toString();
|
|
307
|
+
const networkResponse = {
|
|
308
|
+
headers: headers,
|
|
309
|
+
body: JSON.parse(body),
|
|
310
|
+
status: statusCode
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
if ((statusCode < 200 || statusCode > 299) && // do not destroy the request for the device code flow
|
|
314
|
+
networkResponse.body["error"] !== Constants.AUTHORIZATION_PENDING) {
|
|
315
|
+
request.destroy();
|
|
316
|
+
reject(new Error(`HTTP status code ${statusCode}`));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
resolve(networkResponse);
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
request.on("error", chunk => {
|
|
323
|
+
request.destroy();
|
|
324
|
+
reject(new Error(chunk.toString()));
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
};
|
|
174
328
|
|
|
175
329
|
/*
|
|
176
330
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -191,23 +345,23 @@ class NetworkUtils {
|
|
|
191
345
|
* Licensed under the MIT License.
|
|
192
346
|
*/
|
|
193
347
|
const DEFAULT_AUTH_OPTIONS = {
|
|
194
|
-
clientId:
|
|
348
|
+
clientId: msalCommon.Constants.EMPTY_STRING,
|
|
195
349
|
authority: msalCommon.Constants.DEFAULT_AUTHORITY,
|
|
196
|
-
clientSecret:
|
|
197
|
-
clientAssertion:
|
|
350
|
+
clientSecret: msalCommon.Constants.EMPTY_STRING,
|
|
351
|
+
clientAssertion: msalCommon.Constants.EMPTY_STRING,
|
|
198
352
|
clientCertificate: {
|
|
199
|
-
thumbprint:
|
|
200
|
-
privateKey:
|
|
201
|
-
x5c:
|
|
353
|
+
thumbprint: msalCommon.Constants.EMPTY_STRING,
|
|
354
|
+
privateKey: msalCommon.Constants.EMPTY_STRING,
|
|
355
|
+
x5c: msalCommon.Constants.EMPTY_STRING
|
|
202
356
|
},
|
|
203
357
|
knownAuthorities: [],
|
|
204
|
-
cloudDiscoveryMetadata:
|
|
205
|
-
authorityMetadata:
|
|
358
|
+
cloudDiscoveryMetadata: msalCommon.Constants.EMPTY_STRING,
|
|
359
|
+
authorityMetadata: msalCommon.Constants.EMPTY_STRING,
|
|
206
360
|
clientCapabilities: [],
|
|
207
361
|
protocolMode: msalCommon.ProtocolMode.AAD,
|
|
208
362
|
azureCloudOptions: {
|
|
209
363
|
azureCloudInstance: msalCommon.AzureCloudInstance.None,
|
|
210
|
-
tenant:
|
|
364
|
+
tenant: msalCommon.Constants.EMPTY_STRING
|
|
211
365
|
}
|
|
212
366
|
};
|
|
213
367
|
const DEFAULT_CACHE_OPTIONS = {};
|
|
@@ -220,7 +374,13 @@ const DEFAULT_LOGGER_OPTIONS = {
|
|
|
220
374
|
const DEFAULT_SYSTEM_OPTIONS = {
|
|
221
375
|
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
222
376
|
networkClient: /*#__PURE__*/NetworkUtils.getNetworkClient(),
|
|
223
|
-
proxyUrl:
|
|
377
|
+
proxyUrl: msalCommon.Constants.EMPTY_STRING
|
|
378
|
+
};
|
|
379
|
+
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
380
|
+
application: {
|
|
381
|
+
appName: msalCommon.Constants.EMPTY_STRING,
|
|
382
|
+
appVersion: msalCommon.Constants.EMPTY_STRING
|
|
383
|
+
}
|
|
224
384
|
};
|
|
225
385
|
/**
|
|
226
386
|
* Sets the default options when not explicitly configured from app developer
|
|
@@ -228,6 +388,7 @@ const DEFAULT_SYSTEM_OPTIONS = {
|
|
|
228
388
|
* @param auth - Authentication options
|
|
229
389
|
* @param cache - Cache options
|
|
230
390
|
* @param system - System options
|
|
391
|
+
* @param telemetry - Telemetry options
|
|
231
392
|
*
|
|
232
393
|
* @returns Configuration
|
|
233
394
|
* @public
|
|
@@ -236,7 +397,8 @@ const DEFAULT_SYSTEM_OPTIONS = {
|
|
|
236
397
|
function buildAppConfiguration({
|
|
237
398
|
auth,
|
|
238
399
|
cache,
|
|
239
|
-
system
|
|
400
|
+
system,
|
|
401
|
+
telemetry
|
|
240
402
|
}) {
|
|
241
403
|
return {
|
|
242
404
|
auth: { ...DEFAULT_AUTH_OPTIONS,
|
|
@@ -247,6 +409,9 @@ function buildAppConfiguration({
|
|
|
247
409
|
},
|
|
248
410
|
system: { ...DEFAULT_SYSTEM_OPTIONS,
|
|
249
411
|
...system
|
|
412
|
+
},
|
|
413
|
+
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS,
|
|
414
|
+
...telemetry
|
|
250
415
|
}
|
|
251
416
|
};
|
|
252
417
|
}
|
|
@@ -261,7 +426,7 @@ class GuidGenerator {
|
|
|
261
426
|
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
262
427
|
* uuidv4 generates guids from cryprtographically-string random
|
|
263
428
|
*/
|
|
264
|
-
|
|
429
|
+
generateGuid() {
|
|
265
430
|
return uuid.v4();
|
|
266
431
|
}
|
|
267
432
|
/**
|
|
@@ -270,7 +435,7 @@ class GuidGenerator {
|
|
|
270
435
|
*/
|
|
271
436
|
|
|
272
437
|
|
|
273
|
-
|
|
438
|
+
isGuid(guid) {
|
|
274
439
|
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
275
440
|
return regexGuid.test(guid);
|
|
276
441
|
}
|
|
@@ -298,7 +463,7 @@ class EncodingUtils {
|
|
|
298
463
|
|
|
299
464
|
|
|
300
465
|
static base64EncodeUrl(str, encoding) {
|
|
301
|
-
return EncodingUtils.base64Encode(str, encoding).replace(/=/g,
|
|
466
|
+
return EncodingUtils.base64Encode(str, encoding).replace(/=/g, msalCommon.Constants.EMPTY_STRING).replace(/\+/g, "-").replace(/\//g, "_");
|
|
302
467
|
}
|
|
303
468
|
/**
|
|
304
469
|
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
@@ -393,7 +558,7 @@ class PkceGenerator {
|
|
|
393
558
|
charArr.push(CharSet.CV_CHARSET[index]);
|
|
394
559
|
}
|
|
395
560
|
|
|
396
|
-
const verifier = charArr.join(
|
|
561
|
+
const verifier = charArr.join(msalCommon.Constants.EMPTY_STRING);
|
|
397
562
|
return EncodingUtils.base64EncodeUrl(verifier);
|
|
398
563
|
}
|
|
399
564
|
/**
|
|
@@ -422,6 +587,7 @@ class CryptoProvider {
|
|
|
422
587
|
constructor() {
|
|
423
588
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
424
589
|
this.pkceGenerator = new PkceGenerator();
|
|
590
|
+
this.guidGenerator = new GuidGenerator();
|
|
425
591
|
this.hashUtils = new HashUtils();
|
|
426
592
|
}
|
|
427
593
|
/**
|
|
@@ -431,7 +597,7 @@ class CryptoProvider {
|
|
|
431
597
|
|
|
432
598
|
|
|
433
599
|
createNewGuid() {
|
|
434
|
-
return
|
|
600
|
+
return this.guidGenerator.generateGuid();
|
|
435
601
|
}
|
|
436
602
|
/**
|
|
437
603
|
* Encodes input string to base64.
|
|
@@ -1591,7 +1757,7 @@ class TokenCache {
|
|
|
1591
1757
|
|
|
1592
1758
|
/* eslint-disable header/header */
|
|
1593
1759
|
const name = "@azure/msal-node";
|
|
1594
|
-
const version = "1.
|
|
1760
|
+
const version = "1.9.1";
|
|
1595
1761
|
|
|
1596
1762
|
/*
|
|
1597
1763
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1830,9 +1996,10 @@ class ClientApplication {
|
|
|
1830
1996
|
libraryInfo: {
|
|
1831
1997
|
sku: Constants.MSAL_SKU,
|
|
1832
1998
|
version: version,
|
|
1833
|
-
cpu: process.arch ||
|
|
1834
|
-
os: process.platform ||
|
|
1999
|
+
cpu: process.arch || msalCommon.Constants.EMPTY_STRING,
|
|
2000
|
+
os: process.platform || msalCommon.Constants.EMPTY_STRING
|
|
1835
2001
|
},
|
|
2002
|
+
telemetry: this.config.telemetry,
|
|
1836
2003
|
persistencePlugin: this.config.cache.cachePlugin,
|
|
1837
2004
|
serializableCache: this.tokenCache
|
|
1838
2005
|
};
|
|
@@ -1904,7 +2071,7 @@ class ClientApplication {
|
|
|
1904
2071
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
1905
2072
|
azureRegionConfiguration
|
|
1906
2073
|
};
|
|
1907
|
-
return await msalCommon.AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
|
|
2074
|
+
return await msalCommon.AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.config.system.proxyUrl);
|
|
1908
2075
|
}
|
|
1909
2076
|
/**
|
|
1910
2077
|
* Clear the cache
|
|
@@ -2104,13 +2271,13 @@ class ClientAssertion {
|
|
|
2104
2271
|
* "." means any string character, "+" means match 1 or more times, and "?" means the shortest match.
|
|
2105
2272
|
* The "g" at the end of the regex means search the string globally, and the "s" enables the "." to match newlines.
|
|
2106
2273
|
*/
|
|
2107
|
-
const regexToFindCerts = /-----BEGIN CERTIFICATE-----\n(.+?)\n-----END CERTIFICATE-----/gs;
|
|
2274
|
+
const regexToFindCerts = /-----BEGIN CERTIFICATE-----\r*\n(.+?)\r*\n-----END CERTIFICATE-----/gs;
|
|
2108
2275
|
const certs = [];
|
|
2109
2276
|
let matches;
|
|
2110
2277
|
|
|
2111
2278
|
while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
|
|
2112
2279
|
// matches[1] represents the first parens capture group in the regex.
|
|
2113
|
-
certs.push(matches[1].replace(/\n
|
|
2280
|
+
certs.push(matches[1].replace(/\r*\n/g, msalCommon.Constants.EMPTY_STRING));
|
|
2114
2281
|
}
|
|
2115
2282
|
|
|
2116
2283
|
return certs;
|
|
@@ -2219,8 +2386,8 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2219
2386
|
const clientSecretNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientSecret);
|
|
2220
2387
|
const clientAssertionNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientAssertion);
|
|
2221
2388
|
const certificate = configuration.auth.clientCertificate || {
|
|
2222
|
-
thumbprint:
|
|
2223
|
-
privateKey:
|
|
2389
|
+
thumbprint: msalCommon.Constants.EMPTY_STRING,
|
|
2390
|
+
privateKey: msalCommon.Constants.EMPTY_STRING
|
|
2224
2391
|
};
|
|
2225
2392
|
const certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) || !msalCommon.StringUtils.isEmpty(certificate.privateKey); // Check that at most one credential is set on the application
|
|
2226
2393
|
|