@azure/msal-node 2.11.1 → 2.13.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.
Files changed (200) hide show
  1. package/dist/cache/ITokenCache.d.ts +15 -15
  2. package/dist/cache/NodeStorage.cjs +425 -423
  3. package/dist/cache/NodeStorage.cjs.map +1 -1
  4. package/dist/cache/NodeStorage.d.ts +193 -193
  5. package/dist/cache/NodeStorage.mjs +423 -423
  6. package/dist/cache/TokenCache.cjs +267 -265
  7. package/dist/cache/TokenCache.cjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts +90 -90
  9. package/dist/cache/TokenCache.mjs +265 -265
  10. package/dist/cache/distributed/DistributedCachePlugin.cjs +28 -26
  11. package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
  12. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  14. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  15. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  16. package/dist/cache/serializer/Deserializer.cjs +169 -167
  17. package/dist/cache/serializer/Deserializer.cjs.map +1 -1
  18. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  19. package/dist/cache/serializer/Deserializer.mjs +167 -167
  20. package/dist/cache/serializer/Serializer.cjs +139 -137
  21. package/dist/cache/serializer/Serializer.cjs.map +1 -1
  22. package/dist/cache/serializer/Serializer.d.ts +39 -39
  23. package/dist/cache/serializer/Serializer.mjs +137 -137
  24. package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
  25. package/dist/client/ClientApplication.cjs +336 -334
  26. package/dist/client/ClientApplication.cjs.map +1 -1
  27. package/dist/client/ClientApplication.d.ts +143 -143
  28. package/dist/client/ClientApplication.mjs +334 -334
  29. package/dist/client/ClientAssertion.cjs +149 -143
  30. package/dist/client/ClientAssertion.cjs.map +1 -1
  31. package/dist/client/ClientAssertion.d.ts +55 -55
  32. package/dist/client/ClientAssertion.mjs +143 -143
  33. package/dist/client/ClientCredentialClient.cjs +196 -194
  34. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  35. package/dist/client/ClientCredentialClient.d.ts +33 -33
  36. package/dist/client/ClientCredentialClient.mjs +194 -194
  37. package/dist/client/ConfidentialClientApplication.cjs +170 -169
  38. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  39. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  40. package/dist/client/ConfidentialClientApplication.mjs +168 -169
  41. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  42. package/dist/client/DeviceCodeClient.cjs +209 -207
  43. package/dist/client/DeviceCodeClient.cjs.map +1 -1
  44. package/dist/client/DeviceCodeClient.d.ts +53 -53
  45. package/dist/client/DeviceCodeClient.mjs +207 -207
  46. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  47. package/dist/client/IPublicClientApplication.d.ts +42 -42
  48. package/dist/client/ManagedIdentityApplication.cjs +86 -84
  49. package/dist/client/ManagedIdentityApplication.cjs.map +1 -1
  50. package/dist/client/ManagedIdentityApplication.d.ts +30 -30
  51. package/dist/client/ManagedIdentityApplication.mjs +84 -84
  52. package/dist/client/ManagedIdentityClient.cjs +62 -60
  53. package/dist/client/ManagedIdentityClient.cjs.map +1 -1
  54. package/dist/client/ManagedIdentityClient.d.ts +27 -27
  55. package/dist/client/ManagedIdentityClient.mjs +60 -60
  56. package/dist/client/ManagedIdentitySources/AppService.cjs +47 -45
  57. package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -1
  58. package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -17
  59. package/dist/client/ManagedIdentitySources/AppService.mjs +46 -46
  60. package/dist/client/ManagedIdentitySources/AzureArc.cjs +161 -120
  61. package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +27 -23
  63. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  64. package/dist/client/ManagedIdentitySources/AzureArc.mjs +155 -122
  65. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  66. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +124 -122
  67. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
  68. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -30
  69. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +122 -122
  70. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  71. package/dist/client/ManagedIdentitySources/CloudShell.cjs +40 -38
  72. package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +1 -1
  73. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +16 -16
  74. package/dist/client/ManagedIdentitySources/CloudShell.mjs +39 -39
  75. package/dist/client/ManagedIdentitySources/Imds.cjs +45 -43
  76. package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -1
  77. package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
  78. package/dist/client/ManagedIdentitySources/Imds.mjs +44 -44
  79. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +56 -54
  80. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +1 -1
  81. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +17 -17
  82. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +55 -55
  83. package/dist/client/OnBehalfOfClient.cjs +204 -202
  84. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  85. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  86. package/dist/client/OnBehalfOfClient.mjs +202 -202
  87. package/dist/client/PublicClientApplication.cjs +240 -229
  88. package/dist/client/PublicClientApplication.cjs.map +1 -1
  89. package/dist/client/PublicClientApplication.d.ts +72 -71
  90. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  91. package/dist/client/PublicClientApplication.mjs +240 -231
  92. package/dist/client/PublicClientApplication.mjs.map +1 -1
  93. package/dist/client/UsernamePasswordClient.cjs +97 -95
  94. package/dist/client/UsernamePasswordClient.cjs.map +1 -1
  95. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  96. package/dist/client/UsernamePasswordClient.mjs +95 -95
  97. package/dist/config/Configuration.cjs +108 -106
  98. package/dist/config/Configuration.cjs.map +1 -1
  99. package/dist/config/Configuration.d.ts +131 -131
  100. package/dist/config/Configuration.mjs +106 -106
  101. package/dist/config/ManagedIdentityId.cjs +50 -48
  102. package/dist/config/ManagedIdentityId.cjs.map +1 -1
  103. package/dist/config/ManagedIdentityId.d.ts +11 -11
  104. package/dist/config/ManagedIdentityId.mjs +48 -48
  105. package/dist/config/ManagedIdentityRequestParameters.cjs +30 -28
  106. package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -1
  107. package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
  108. package/dist/config/ManagedIdentityRequestParameters.mjs +28 -28
  109. package/dist/crypto/CryptoProvider.cjs +91 -89
  110. package/dist/crypto/CryptoProvider.cjs.map +1 -1
  111. package/dist/crypto/CryptoProvider.d.ts +62 -62
  112. package/dist/crypto/CryptoProvider.mjs +89 -89
  113. package/dist/crypto/GuidGenerator.cjs +24 -22
  114. package/dist/crypto/GuidGenerator.cjs.map +1 -1
  115. package/dist/crypto/GuidGenerator.d.ts +14 -14
  116. package/dist/crypto/GuidGenerator.mjs +22 -22
  117. package/dist/crypto/HashUtils.cjs +19 -13
  118. package/dist/crypto/HashUtils.cjs.map +1 -1
  119. package/dist/crypto/HashUtils.d.ts +8 -8
  120. package/dist/crypto/HashUtils.mjs +13 -13
  121. package/dist/crypto/PkceGenerator.cjs +55 -49
  122. package/dist/crypto/PkceGenerator.cjs.map +1 -1
  123. package/dist/crypto/PkceGenerator.d.ts +22 -22
  124. package/dist/crypto/PkceGenerator.mjs +49 -49
  125. package/dist/error/ManagedIdentityError.cjs +43 -41
  126. package/dist/error/ManagedIdentityError.cjs.map +1 -1
  127. package/dist/error/ManagedIdentityError.d.ts +30 -30
  128. package/dist/error/ManagedIdentityError.mjs +41 -41
  129. package/dist/error/ManagedIdentityErrorCodes.cjs +26 -24
  130. package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
  131. package/dist/error/ManagedIdentityErrorCodes.d.ts +22 -22
  132. package/dist/error/ManagedIdentityErrorCodes.mjs +24 -24
  133. package/dist/error/NodeAuthError.cjs +97 -95
  134. package/dist/error/NodeAuthError.cjs.map +1 -1
  135. package/dist/error/NodeAuthError.d.ts +73 -73
  136. package/dist/error/NodeAuthError.mjs +95 -95
  137. package/dist/index.cjs +3 -1
  138. package/dist/index.cjs.map +1 -1
  139. package/dist/index.d.ts +45 -45
  140. package/dist/index.mjs +1 -1
  141. package/dist/internals.cjs +6 -8
  142. package/dist/internals.cjs.map +1 -1
  143. package/dist/internals.d.ts +6 -6
  144. package/dist/internals.mjs +4 -8
  145. package/dist/internals.mjs.map +1 -1
  146. package/dist/network/HttpClient.cjs +288 -281
  147. package/dist/network/HttpClient.cjs.map +1 -1
  148. package/dist/network/HttpClient.d.ts +25 -25
  149. package/dist/network/HttpClient.mjs +281 -281
  150. package/dist/network/HttpClientWithRetries.cjs +36 -34
  151. package/dist/network/HttpClientWithRetries.cjs.map +1 -1
  152. package/dist/network/HttpClientWithRetries.d.ts +11 -11
  153. package/dist/network/HttpClientWithRetries.mjs +34 -34
  154. package/dist/network/ILoopbackClient.d.ts +10 -10
  155. package/dist/network/LoopbackClient.cjs +87 -77
  156. package/dist/network/LoopbackClient.cjs.map +1 -1
  157. package/dist/network/LoopbackClient.d.ts +21 -21
  158. package/dist/network/LoopbackClient.d.ts.map +1 -1
  159. package/dist/network/LoopbackClient.mjs +81 -77
  160. package/dist/network/LoopbackClient.mjs.map +1 -1
  161. package/dist/packageMetadata.cjs +6 -4
  162. package/dist/packageMetadata.cjs.map +1 -1
  163. package/dist/packageMetadata.d.ts +2 -2
  164. package/dist/packageMetadata.mjs +4 -4
  165. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  166. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  167. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  168. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  169. package/dist/request/InteractiveRequest.d.ts +22 -22
  170. package/dist/request/ManagedIdentityRequest.d.ts +8 -8
  171. package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
  172. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  173. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  174. package/dist/request/SignOutRequest.d.ts +5 -5
  175. package/dist/request/SilentFlowRequest.d.ts +16 -16
  176. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  177. package/dist/response/ManagedIdentityTokenResponse.d.ts +34 -34
  178. package/dist/retry/IHttpRetryPolicy.d.ts +5 -5
  179. package/dist/retry/LinearRetryPolicy.cjs +42 -40
  180. package/dist/retry/LinearRetryPolicy.cjs.map +1 -1
  181. package/dist/retry/LinearRetryPolicy.d.ts +11 -11
  182. package/dist/retry/LinearRetryPolicy.mjs +40 -40
  183. package/dist/utils/Constants.cjs +138 -136
  184. package/dist/utils/Constants.cjs.map +1 -1
  185. package/dist/utils/Constants.d.ts +141 -141
  186. package/dist/utils/Constants.mjs +136 -136
  187. package/dist/utils/EncodingUtils.cjs +46 -44
  188. package/dist/utils/EncodingUtils.cjs.map +1 -1
  189. package/dist/utils/EncodingUtils.d.ts +26 -26
  190. package/dist/utils/EncodingUtils.mjs +44 -44
  191. package/dist/utils/NetworkUtils.cjs +40 -38
  192. package/dist/utils/NetworkUtils.cjs.map +1 -1
  193. package/dist/utils/NetworkUtils.d.ts +5 -5
  194. package/dist/utils/NetworkUtils.mjs +38 -38
  195. package/package.json +2 -2
  196. package/src/client/ConfidentialClientApplication.ts +3 -3
  197. package/src/client/ManagedIdentitySources/AzureArc.ts +80 -25
  198. package/src/client/PublicClientApplication.ts +13 -1
  199. package/src/network/LoopbackClient.ts +6 -0
  200. package/src/packageMetadata.ts +1 -1
@@ -1,27 +1,27 @@
1
- /// <reference types="node" />
2
- export declare class EncodingUtils {
3
- /**
4
- * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
5
- * 'base64': Base64 encoding.
6
- *
7
- * @param str text
8
- */
9
- static base64Encode(str: string, encoding?: BufferEncoding): string;
10
- /**
11
- * encode a URL
12
- * @param str
13
- */
14
- static base64EncodeUrl(str: string, encoding?: BufferEncoding): string;
15
- /**
16
- * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
17
- * 'base64': Base64 encoding.
18
- *
19
- * @param base64Str Base64 encoded text
20
- */
21
- static base64Decode(base64Str: string): string;
22
- /**
23
- * @param base64Str Base64 encoded Url
24
- */
25
- static base64DecodeUrl(base64Str: string): string;
26
- }
1
+ /// <reference types="node" />
2
+ export declare class EncodingUtils {
3
+ /**
4
+ * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
5
+ * 'base64': Base64 encoding.
6
+ *
7
+ * @param str text
8
+ */
9
+ static base64Encode(str: string, encoding?: BufferEncoding): string;
10
+ /**
11
+ * encode a URL
12
+ * @param str
13
+ */
14
+ static base64EncodeUrl(str: string, encoding?: BufferEncoding): string;
15
+ /**
16
+ * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
17
+ * 'base64': Base64 encoding.
18
+ *
19
+ * @param base64Str Base64 encoded text
20
+ */
21
+ static base64Decode(base64Str: string): string;
22
+ /**
23
+ * @param base64Str Base64 encoded Url
24
+ */
25
+ static base64DecodeUrl(base64Str: string): string;
26
+ }
27
27
  //# sourceMappingURL=EncodingUtils.d.ts.map
@@ -1,50 +1,50 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  import { Constants } from '@azure/msal-common';
4
4
 
5
- /*
6
- * Copyright (c) Microsoft Corporation. All rights reserved.
7
- * Licensed under the MIT License.
8
- */
9
- class EncodingUtils {
10
- /**
11
- * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
12
- * 'base64': Base64 encoding.
13
- *
14
- * @param str text
15
- */
16
- static base64Encode(str, encoding) {
17
- return Buffer.from(str, encoding).toString("base64");
18
- }
19
- /**
20
- * encode a URL
21
- * @param str
22
- */
23
- static base64EncodeUrl(str, encoding) {
24
- return EncodingUtils.base64Encode(str, encoding)
25
- .replace(/=/g, Constants.EMPTY_STRING)
26
- .replace(/\+/g, "-")
27
- .replace(/\//g, "_");
28
- }
29
- /**
30
- * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
31
- * 'base64': Base64 encoding.
32
- *
33
- * @param base64Str Base64 encoded text
34
- */
35
- static base64Decode(base64Str) {
36
- return Buffer.from(base64Str, "base64").toString("utf8");
37
- }
38
- /**
39
- * @param base64Str Base64 encoded Url
40
- */
41
- static base64DecodeUrl(base64Str) {
42
- let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
43
- while (str.length % 4) {
44
- str += "=";
45
- }
46
- return EncodingUtils.base64Decode(str);
47
- }
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ class EncodingUtils {
10
+ /**
11
+ * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
12
+ * 'base64': Base64 encoding.
13
+ *
14
+ * @param str text
15
+ */
16
+ static base64Encode(str, encoding) {
17
+ return Buffer.from(str, encoding).toString("base64");
18
+ }
19
+ /**
20
+ * encode a URL
21
+ * @param str
22
+ */
23
+ static base64EncodeUrl(str, encoding) {
24
+ return EncodingUtils.base64Encode(str, encoding)
25
+ .replace(/=/g, Constants.EMPTY_STRING)
26
+ .replace(/\+/g, "-")
27
+ .replace(/\//g, "_");
28
+ }
29
+ /**
30
+ * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
31
+ * 'base64': Base64 encoding.
32
+ *
33
+ * @param base64Str Base64 encoded text
34
+ */
35
+ static base64Decode(base64Str) {
36
+ return Buffer.from(base64Str, "base64").toString("utf8");
37
+ }
38
+ /**
39
+ * @param base64Str Base64 encoded Url
40
+ */
41
+ static base64DecodeUrl(base64Str) {
42
+ let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
43
+ while (str.length % 4) {
44
+ str += "=";
45
+ }
46
+ return EncodingUtils.base64Decode(str);
47
+ }
48
48
  }
49
49
 
50
50
  export { EncodingUtils };
@@ -1,44 +1,46 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*
6
- * Copyright (c) Microsoft Corporation. All rights reserved.
7
- * Licensed under the MIT License.
8
- */
9
- class NetworkUtils {
10
- static getNetworkResponse(headers, body, statusCode) {
11
- return {
12
- headers: headers,
13
- body: body,
14
- status: statusCode,
15
- };
16
- }
17
- /*
18
- * Utility function that converts a URL object into an ordinary options object as expected by the
19
- * http.request and https.request APIs.
20
- * https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
21
- */
22
- static urlToHttpOptions(url) {
23
- const options = {
24
- protocol: url.protocol,
25
- hostname: url.hostname && url.hostname.startsWith("[")
26
- ? url.hostname.slice(1, -1)
27
- : url.hostname,
28
- hash: url.hash,
29
- search: url.search,
30
- pathname: url.pathname,
31
- path: `${url.pathname || ""}${url.search || ""}`,
32
- href: url.href,
33
- };
34
- if (url.port !== "") {
35
- options.port = Number(url.port);
36
- }
37
- if (url.username || url.password) {
38
- options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
39
- }
40
- return options;
41
- }
5
+ Object.defineProperty(exports, '__esModule', { value: true });
6
+
7
+ /*
8
+ * Copyright (c) Microsoft Corporation. All rights reserved.
9
+ * Licensed under the MIT License.
10
+ */
11
+ class NetworkUtils {
12
+ static getNetworkResponse(headers, body, statusCode) {
13
+ return {
14
+ headers: headers,
15
+ body: body,
16
+ status: statusCode,
17
+ };
18
+ }
19
+ /*
20
+ * Utility function that converts a URL object into an ordinary options object as expected by the
21
+ * http.request and https.request APIs.
22
+ * https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
23
+ */
24
+ static urlToHttpOptions(url) {
25
+ const options = {
26
+ protocol: url.protocol,
27
+ hostname: url.hostname && url.hostname.startsWith("[")
28
+ ? url.hostname.slice(1, -1)
29
+ : url.hostname,
30
+ hash: url.hash,
31
+ search: url.search,
32
+ pathname: url.pathname,
33
+ path: `${url.pathname || ""}${url.search || ""}`,
34
+ href: url.href,
35
+ };
36
+ if (url.port !== "") {
37
+ options.port = Number(url.port);
38
+ }
39
+ if (url.username || url.password) {
40
+ options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
41
+ }
42
+ return options;
43
+ }
42
44
  }
43
45
 
44
46
  exports.NetworkUtils = NetworkUtils;
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkUtils.cjs","sources":["../../src/utils/NetworkUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;MAIU,YAAY,CAAA;AACrB,IAAA,OAAO,kBAAkB,CACrB,OAA+B,EAC/B,IAAO,EACP,UAAkB,EAAA;QAElB,OAAO;AACH,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,MAAM,EAAE,UAAU;SACrB,CAAC;KACL;AAED;;;;AAIG;IACH,OAAO,gBAAgB,CAAC,GAAQ,EAAA;AAC5B,QAAA,MAAM,OAAO,GAA4B;YACrC,QAAQ,EAAE,GAAG,CAAC,QAAQ;AACtB,YAAA,QAAQ,EACJ,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;kBACtC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;kBACzB,GAAG,CAAC,QAAQ;YACtB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;AACtB,YAAA,IAAI,EAAE,CAAA,EAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAA,EAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAE,CAAA;YAChD,IAAI,EAAE,GAAG,CAAC,IAAI;SACjB,CAAC;AACF,QAAA,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE;YACjB,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,SAAA;AACD,QAAA,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE;AAC9B,YAAA,OAAO,CAAC,IAAI,GAAG,GAAG,kBAAkB,CAChC,GAAG,CAAC,QAAQ,CACf,CAAA,CAAA,EAAI,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC3C,SAAA;AACD,QAAA,OAAO,OAAO,CAAC;KAClB;AACJ;;;;"}
1
+ {"version":3,"file":"NetworkUtils.cjs","sources":["../../src/utils/NetworkUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;AAGG;MAIU,YAAY,CAAA;AACrB,IAAA,OAAO,kBAAkB,CACrB,OAA+B,EAC/B,IAAO,EACP,UAAkB,EAAA;QAElB,OAAO;AACH,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,MAAM,EAAE,UAAU;SACrB,CAAC;KACL;AAED;;;;AAIG;IACH,OAAO,gBAAgB,CAAC,GAAQ,EAAA;AAC5B,QAAA,MAAM,OAAO,GAA4B;YACrC,QAAQ,EAAE,GAAG,CAAC,QAAQ;AACtB,YAAA,QAAQ,EACJ,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;kBACtC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;kBACzB,GAAG,CAAC,QAAQ;YACtB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;AACtB,YAAA,IAAI,EAAE,CAAA,EAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAA,EAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAE,CAAA;YAChD,IAAI,EAAE,GAAG,CAAC,IAAI;SACjB,CAAC;AACF,QAAA,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE;YACjB,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,SAAA;AACD,QAAA,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE;AAC9B,YAAA,OAAO,CAAC,IAAI,GAAG,GAAG,kBAAkB,CAChC,GAAG,CAAC,QAAQ,CACf,CAAA,CAAA,EAAI,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC3C,SAAA;AACD,QAAA,OAAO,OAAO,CAAC;KAClB;AACJ;;;;"}
@@ -1,6 +1,6 @@
1
- import { NetworkResponse, UrlToHttpRequestOptions } from "@azure/msal-common";
2
- export declare class NetworkUtils {
3
- static getNetworkResponse<T>(headers: Record<string, string>, body: T, statusCode: number): NetworkResponse<T>;
4
- static urlToHttpOptions(url: URL): UrlToHttpRequestOptions;
5
- }
1
+ import { NetworkResponse, UrlToHttpRequestOptions } from "@azure/msal-common";
2
+ export declare class NetworkUtils {
3
+ static getNetworkResponse<T>(headers: Record<string, string>, body: T, statusCode: number): NetworkResponse<T>;
4
+ static urlToHttpOptions(url: URL): UrlToHttpRequestOptions;
5
+ }
6
6
  //# sourceMappingURL=NetworkUtils.d.ts.map
@@ -1,42 +1,42 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
- /*
4
- * Copyright (c) Microsoft Corporation. All rights reserved.
5
- * Licensed under the MIT License.
6
- */
7
- class NetworkUtils {
8
- static getNetworkResponse(headers, body, statusCode) {
9
- return {
10
- headers: headers,
11
- body: body,
12
- status: statusCode,
13
- };
14
- }
15
- /*
16
- * Utility function that converts a URL object into an ordinary options object as expected by the
17
- * http.request and https.request APIs.
18
- * https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
19
- */
20
- static urlToHttpOptions(url) {
21
- const options = {
22
- protocol: url.protocol,
23
- hostname: url.hostname && url.hostname.startsWith("[")
24
- ? url.hostname.slice(1, -1)
25
- : url.hostname,
26
- hash: url.hash,
27
- search: url.search,
28
- pathname: url.pathname,
29
- path: `${url.pathname || ""}${url.search || ""}`,
30
- href: url.href,
31
- };
32
- if (url.port !== "") {
33
- options.port = Number(url.port);
34
- }
35
- if (url.username || url.password) {
36
- options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
37
- }
38
- return options;
39
- }
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ class NetworkUtils {
8
+ static getNetworkResponse(headers, body, statusCode) {
9
+ return {
10
+ headers: headers,
11
+ body: body,
12
+ status: statusCode,
13
+ };
14
+ }
15
+ /*
16
+ * Utility function that converts a URL object into an ordinary options object as expected by the
17
+ * http.request and https.request APIs.
18
+ * https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
19
+ */
20
+ static urlToHttpOptions(url) {
21
+ const options = {
22
+ protocol: url.protocol,
23
+ hostname: url.hostname && url.hostname.startsWith("[")
24
+ ? url.hostname.slice(1, -1)
25
+ : url.hostname,
26
+ hash: url.hash,
27
+ search: url.search,
28
+ pathname: url.pathname,
29
+ path: `${url.pathname || ""}${url.search || ""}`,
30
+ href: url.href,
31
+ };
32
+ if (url.port !== "") {
33
+ options.port = Number(url.port);
34
+ }
35
+ if (url.username || url.password) {
36
+ options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
37
+ }
38
+ return options;
39
+ }
40
40
  }
41
41
 
42
42
  export { NetworkUtils };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@azure/msal-node",
4
- "version": "2.11.1",
4
+ "version": "2.13.0",
5
5
  "author": {
6
6
  "name": "Microsoft",
7
7
  "email": "nugetaad@microsoft.com",
@@ -79,7 +79,7 @@
79
79
  "yargs": "^17.3.1"
80
80
  },
81
81
  "dependencies": {
82
- "@azure/msal-common": "14.13.1",
82
+ "@azure/msal-common": "14.14.1",
83
83
  "jsonwebtoken": "^9.0.0",
84
84
  "uuid": "^8.3.0"
85
85
  },
@@ -221,9 +221,9 @@ export class ConfidentialClientApplication
221
221
  const clientSecretNotEmpty = !!this.config.auth.clientSecret;
222
222
  const clientAssertionNotEmpty = !!this.config.auth.clientAssertion;
223
223
  const certificateNotEmpty =
224
- (!!this.config.auth.clientCertificate.thumbprint ||
225
- !!this.config.auth.clientCertificate.thumbprintSha256) &&
226
- !!this.config.auth.clientCertificate.privateKey;
224
+ (!!this.config.auth.clientCertificate?.thumbprint ||
225
+ !!this.config.auth.clientCertificate?.thumbprintSha256) &&
226
+ !!this.config.auth.clientCertificate?.privateKey;
227
227
 
228
228
  /*
229
229
  * If app developer configures this callback, they don't need a credential
@@ -33,18 +33,36 @@ import {
33
33
  RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
34
34
  } from "../../utils/Constants";
35
35
  import { NodeStorage } from "../../cache/NodeStorage";
36
- import { readFileSync, statSync } from "fs";
36
+ import {
37
+ accessSync,
38
+ constants as fsConstants,
39
+ readFileSync,
40
+ statSync,
41
+ } from "fs";
37
42
  import { ManagedIdentityTokenResponse } from "../../response/ManagedIdentityTokenResponse";
38
43
  import { ManagedIdentityId } from "../../config/ManagedIdentityId";
39
44
  import path from "path";
40
45
 
41
46
  export const ARC_API_VERSION: string = "2019-11-01";
47
+ export const DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT: string =
48
+ "http://127.0.0.1:40342/metadata/identity/oauth2/token";
49
+ const HIMDS_EXECUTABLE_HELPER_STRING = "N/A: himds executable exists";
50
+
51
+ type FilePathMap = {
52
+ win32: string;
53
+ linux: string;
54
+ };
42
55
 
43
- export const SUPPORTED_AZURE_ARC_PLATFORMS = {
56
+ export const SUPPORTED_AZURE_ARC_PLATFORMS: FilePathMap = {
44
57
  win32: `${process.env["ProgramData"]}\\AzureConnectedMachineAgent\\Tokens\\`,
45
58
  linux: "/var/opt/azcmagent/tokens/",
46
59
  };
47
60
 
61
+ export const AZURE_ARC_FILE_DETECTION: FilePathMap = {
62
+ win32: `${process.env["ProgramFiles"]}\\AzureConnectedMachineAgent\\himds.exe`,
63
+ linux: "/opt/azcmagent/bin/himds",
64
+ };
65
+
48
66
  /**
49
67
  * Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/AzureArcManagedIdentitySource.cs
50
68
  */
@@ -64,13 +82,38 @@ export class AzureArc extends BaseManagedIdentitySource {
64
82
  }
65
83
 
66
84
  public static getEnvironmentVariables(): Array<string | undefined> {
67
- const identityEndpoint: string | undefined =
85
+ let identityEndpoint: string | undefined =
68
86
  process.env[
69
87
  ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT
70
88
  ];
71
- const imdsEndpoint: string | undefined =
89
+ let imdsEndpoint: string | undefined =
72
90
  process.env[ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT];
73
91
 
92
+ // if either of the identity or imds endpoints are undefined, check if the himds executable exists
93
+ if (!identityEndpoint || !imdsEndpoint) {
94
+ // get the expected Windows or Linux file path of the himds executable
95
+ const fileDetectionPath: string =
96
+ AZURE_ARC_FILE_DETECTION[process.platform as keyof FilePathMap];
97
+ try {
98
+ /*
99
+ * check if the himds executable exists and its permissions allow it to be read
100
+ * returns undefined if true, throws an error otherwise
101
+ */
102
+ accessSync(
103
+ fileDetectionPath,
104
+ fsConstants.F_OK | fsConstants.R_OK
105
+ );
106
+
107
+ identityEndpoint = DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT;
108
+ imdsEndpoint = HIMDS_EXECUTABLE_HELPER_STRING;
109
+ } catch (err) {
110
+ /*
111
+ * do nothing
112
+ * accessSync returns undefined on success, and throws an error on failure
113
+ */
114
+ }
115
+ }
116
+
74
117
  return [identityEndpoint, imdsEndpoint];
75
118
  }
76
119
 
@@ -84,36 +127,46 @@ export class AzureArc extends BaseManagedIdentitySource {
84
127
  const [identityEndpoint, imdsEndpoint] =
85
128
  AzureArc.getEnvironmentVariables();
86
129
 
87
- // if either of the identity or imds endpoints are undefined, this MSI provider is unavailable.
130
+ // if either of the identity or imds endpoints are undefined (even after himds file detection)
88
131
  if (!identityEndpoint || !imdsEndpoint) {
89
132
  logger.info(
90
- `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' environment variables are not defined.`
133
+ `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection.`
91
134
  );
135
+
92
136
  return null;
93
137
  }
94
138
 
95
- const validatedIdentityEndpoint: string =
139
+ // check if the imds endpoint is set to the default for file detection
140
+ if (imdsEndpoint === HIMDS_EXECUTABLE_HELPER_STRING) {
141
+ logger.info(
142
+ `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
143
+ );
144
+ } else {
145
+ // otherwise, both the identity and imds endpoints are defined without file detection; validate them
146
+
147
+ const validatedIdentityEndpoint: string =
148
+ AzureArc.getValidatedEnvVariableUrlString(
149
+ ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT,
150
+ identityEndpoint,
151
+ ManagedIdentitySourceNames.AZURE_ARC,
152
+ logger
153
+ );
154
+ // remove trailing slash
155
+ validatedIdentityEndpoint.endsWith("/")
156
+ ? validatedIdentityEndpoint.slice(0, -1)
157
+ : validatedIdentityEndpoint;
158
+
96
159
  AzureArc.getValidatedEnvVariableUrlString(
97
- ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT,
98
- identityEndpoint,
160
+ ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT,
161
+ imdsEndpoint,
99
162
  ManagedIdentitySourceNames.AZURE_ARC,
100
163
  logger
101
164
  );
102
- // remove trailing slash
103
- validatedIdentityEndpoint.endsWith("/")
104
- ? validatedIdentityEndpoint.slice(0, -1)
105
- : validatedIdentityEndpoint;
106
-
107
- AzureArc.getValidatedEnvVariableUrlString(
108
- ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT,
109
- imdsEndpoint,
110
- ManagedIdentitySourceNames.AZURE_ARC,
111
- logger
112
- );
113
165
 
114
- logger.info(
115
- `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
116
- );
166
+ logger.info(
167
+ `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
168
+ );
169
+ }
117
170
 
118
171
  if (
119
172
  managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
@@ -186,9 +239,11 @@ export class AzureArc extends BaseManagedIdentitySource {
186
239
  );
187
240
  }
188
241
 
189
- // get the expected Windows or Linux file path)
242
+ // get the expected Windows or Linux file path
190
243
  const expectedSecretFilePath: string =
191
- SUPPORTED_AZURE_ARC_PLATFORMS[process.platform as string];
244
+ SUPPORTED_AZURE_ARC_PLATFORMS[
245
+ process.platform as keyof FilePathMap
246
+ ];
192
247
 
193
248
  // throw an error if the file in the file path is not a .key file
194
249
  const fileName: string = path.basename(secretFilePath);
@@ -22,6 +22,8 @@ import {
22
22
  AccountInfo,
23
23
  INativeBrokerPlugin,
24
24
  ServerAuthorizationCodeResponse,
25
+ AADServerParamKeys,
26
+ ServerTelemetryManager,
25
27
  } from "@azure/msal-common";
26
28
  import { Configuration } from "../config/Configuration.js";
27
29
  import { ClientApplication } from "./ClientApplication.js";
@@ -36,6 +38,7 @@ import { SilentFlowRequest } from "../request/SilentFlowRequest.js";
36
38
  import { SignOutRequest } from "../request/SignOutRequest.js";
37
39
  import { ILoopbackClient } from "../network/ILoopbackClient.js";
38
40
  import { DeviceCodeClient } from "./DeviceCodeClient.js";
41
+ import { version } from "../packageMetadata";
39
42
 
40
43
  /**
41
44
  * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
@@ -47,6 +50,7 @@ export class PublicClientApplication
47
50
  implements IPublicClientApplication
48
51
  {
49
52
  private nativeBrokerPlugin?: INativeBrokerPlugin;
53
+ private readonly skus: string;
50
54
  /**
51
55
  * Important attributes in the Configuration object for auth are:
52
56
  * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
@@ -78,6 +82,10 @@ export class PublicClientApplication
78
82
  );
79
83
  }
80
84
  }
85
+ this.skus = ServerTelemetryManager.makeExtraSkuString({
86
+ libraryName: Constants.MSAL_SKU,
87
+ libraryVersion: version,
88
+ });
81
89
  }
82
90
 
83
91
  /**
@@ -156,6 +164,7 @@ export class PublicClientApplication
156
164
  extraParameters: {
157
165
  ...remainingProperties.extraQueryParameters,
158
166
  ...remainingProperties.tokenQueryParameters,
167
+ [AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
159
168
  },
160
169
  accountId: remainingProperties.account?.nativeAccountId,
161
170
  };
@@ -247,7 +256,10 @@ export class PublicClientApplication
247
256
  redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
248
257
  authority: request.authority || this.config.auth.authority,
249
258
  correlationId: correlationId,
250
- extraParameters: request.tokenQueryParameters,
259
+ extraParameters: {
260
+ ...request.tokenQueryParameters,
261
+ [AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
262
+ },
251
263
  accountId: request.account.nativeAccountId,
252
264
  forceRefresh: request.forceRefresh || false,
253
265
  };
@@ -65,6 +65,12 @@ export class LoopbackClient implements ILoopbackClient {
65
65
  }); // Prevent auth code from being saved in the browser history
66
66
  res.end();
67
67
  }
68
+ if (authCodeResponse.error) {
69
+ res.end(
70
+ errorTemplate ||
71
+ `Error occurred: ${authCodeResponse.error}`
72
+ );
73
+ }
68
74
  resolve(authCodeResponse);
69
75
  }
70
76
  );
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "2.11.1";
3
+ export const version = "2.13.0";