@azure/msal-node 2.15.0 → 2.16.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.
Files changed (160) hide show
  1. package/dist/cache/NodeStorage.d.ts +3 -3
  2. package/dist/cache/NodeStorage.d.ts.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +4 -4
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +2 -2
  6. package/dist/cache/TokenCache.mjs.map +1 -1
  7. package/dist/cache/distributed/DistributedCachePlugin.d.ts +12 -0
  8. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  9. package/dist/cache/distributed/DistributedCachePlugin.mjs +13 -1
  10. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  11. package/dist/cache/distributed/ICacheClient.d.ts +7 -3
  12. package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
  13. package/dist/cache/distributed/IPartitionManager.d.ts +5 -1
  14. package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
  15. package/dist/cache/serializer/Deserializer.d.ts +9 -8
  16. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  17. package/dist/cache/serializer/Deserializer.mjs +10 -9
  18. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  19. package/dist/cache/serializer/Serializer.d.ts +11 -7
  20. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  21. package/dist/cache/serializer/Serializer.mjs +12 -8
  22. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  23. package/dist/client/ClientApplication.d.ts +3 -3
  24. package/dist/client/ClientApplication.d.ts.map +1 -1
  25. package/dist/client/ClientApplication.mjs +11 -10
  26. package/dist/client/ClientApplication.mjs.map +1 -1
  27. package/dist/client/ClientAssertion.mjs +1 -1
  28. package/dist/client/ClientCredentialClient.d.ts +5 -4
  29. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  30. package/dist/client/ClientCredentialClient.mjs +6 -5
  31. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  32. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  33. package/dist/client/ConfidentialClientApplication.mjs +19 -5
  34. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  35. package/dist/client/DeviceCodeClient.d.ts +19 -15
  36. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  37. package/dist/client/DeviceCodeClient.mjs +24 -20
  38. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  39. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  40. package/dist/client/ManagedIdentityClient.mjs +1 -1
  41. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  42. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  43. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  44. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  45. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  46. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  47. package/dist/client/OnBehalfOfClient.d.ts +9 -9
  48. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  49. package/dist/client/OnBehalfOfClient.mjs +10 -10
  50. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  51. package/dist/client/PublicClientApplication.d.ts +3 -3
  52. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  53. package/dist/client/PublicClientApplication.mjs +5 -5
  54. package/dist/client/PublicClientApplication.mjs.map +1 -1
  55. package/dist/client/UsernamePasswordClient.d.ts +5 -4
  56. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  57. package/dist/client/UsernamePasswordClient.mjs +6 -5
  58. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  59. package/dist/config/Configuration.d.ts +4 -0
  60. package/dist/config/Configuration.d.ts.map +1 -1
  61. package/dist/config/Configuration.mjs +1 -1
  62. package/dist/config/Configuration.mjs.map +1 -1
  63. package/dist/config/ManagedIdentityId.mjs +1 -1
  64. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  65. package/dist/crypto/CryptoProvider.d.ts +2 -2
  66. package/dist/crypto/CryptoProvider.mjs +3 -3
  67. package/dist/crypto/GuidGenerator.mjs +1 -1
  68. package/dist/crypto/HashUtils.mjs +1 -1
  69. package/dist/crypto/PkceGenerator.mjs +1 -1
  70. package/dist/error/ManagedIdentityError.mjs +1 -1
  71. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  72. package/dist/error/NodeAuthError.mjs +1 -1
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.mjs +1 -2
  76. package/dist/index.mjs.map +1 -1
  77. package/dist/internals.mjs +1 -1
  78. package/dist/network/HttpClient.mjs +1 -1
  79. package/dist/network/HttpClientWithRetries.mjs +1 -1
  80. package/dist/network/LoopbackClient.mjs +1 -1
  81. package/dist/packageMetadata.d.ts +1 -1
  82. package/dist/packageMetadata.mjs +2 -2
  83. package/dist/request/ManagedIdentityRequestParams.d.ts +2 -1
  84. package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -1
  85. package/dist/request/SignOutRequest.d.ts +1 -0
  86. package/dist/request/SignOutRequest.d.ts.map +1 -1
  87. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  88. package/dist/utils/Constants.d.ts +1 -0
  89. package/dist/utils/Constants.d.ts.map +1 -1
  90. package/dist/utils/Constants.mjs +3 -2
  91. package/dist/utils/Constants.mjs.map +1 -1
  92. package/dist/utils/EncodingUtils.mjs +1 -1
  93. package/dist/utils/NetworkUtils.d.ts +12 -1
  94. package/dist/utils/NetworkUtils.d.ts.map +1 -1
  95. package/dist/utils/NetworkUtils.mjs +1 -1
  96. package/dist/utils/NetworkUtils.mjs.map +1 -1
  97. package/lib/msal-node.cjs +422 -313
  98. package/lib/msal-node.cjs.map +1 -1
  99. package/lib/types/cache/NodeStorage.d.ts +3 -3
  100. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  101. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts +12 -0
  102. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  103. package/lib/types/cache/distributed/ICacheClient.d.ts +7 -3
  104. package/lib/types/cache/distributed/ICacheClient.d.ts.map +1 -1
  105. package/lib/types/cache/distributed/IPartitionManager.d.ts +5 -1
  106. package/lib/types/cache/distributed/IPartitionManager.d.ts.map +1 -1
  107. package/lib/types/cache/serializer/Deserializer.d.ts +9 -8
  108. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  109. package/lib/types/cache/serializer/Serializer.d.ts +11 -7
  110. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  111. package/lib/types/client/ClientApplication.d.ts +3 -3
  112. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  113. package/lib/types/client/ClientCredentialClient.d.ts +5 -4
  114. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  115. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  116. package/lib/types/client/DeviceCodeClient.d.ts +19 -15
  117. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  118. package/lib/types/client/OnBehalfOfClient.d.ts +9 -9
  119. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  120. package/lib/types/client/PublicClientApplication.d.ts +3 -3
  121. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  122. package/lib/types/client/UsernamePasswordClient.d.ts +5 -4
  123. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  124. package/lib/types/config/Configuration.d.ts +4 -0
  125. package/lib/types/config/Configuration.d.ts.map +1 -1
  126. package/lib/types/crypto/CryptoProvider.d.ts +2 -2
  127. package/lib/types/index.d.ts +1 -1
  128. package/lib/types/index.d.ts.map +1 -1
  129. package/lib/types/packageMetadata.d.ts +1 -1
  130. package/lib/types/request/ManagedIdentityRequestParams.d.ts +2 -1
  131. package/lib/types/request/ManagedIdentityRequestParams.d.ts.map +1 -1
  132. package/lib/types/request/SignOutRequest.d.ts +1 -0
  133. package/lib/types/request/SignOutRequest.d.ts.map +1 -1
  134. package/lib/types/utils/Constants.d.ts +1 -0
  135. package/lib/types/utils/Constants.d.ts.map +1 -1
  136. package/lib/types/utils/NetworkUtils.d.ts +12 -1
  137. package/lib/types/utils/NetworkUtils.d.ts.map +1 -1
  138. package/package.json +3 -3
  139. package/src/cache/NodeStorage.ts +3 -3
  140. package/src/cache/TokenCache.ts +1 -1
  141. package/src/cache/distributed/DistributedCachePlugin.ts +12 -0
  142. package/src/cache/distributed/ICacheClient.ts +7 -3
  143. package/src/cache/distributed/IPartitionManager.ts +5 -1
  144. package/src/cache/serializer/Deserializer.ts +9 -8
  145. package/src/cache/serializer/Serializer.ts +11 -7
  146. package/src/client/ClientApplication.ts +10 -3
  147. package/src/client/ClientCredentialClient.ts +5 -4
  148. package/src/client/ConfidentialClientApplication.ts +21 -1
  149. package/src/client/DeviceCodeClient.ts +29 -20
  150. package/src/client/OnBehalfOfClient.ts +9 -9
  151. package/src/client/PublicClientApplication.ts +4 -3
  152. package/src/client/UsernamePasswordClient.ts +5 -4
  153. package/src/config/Configuration.ts +4 -0
  154. package/src/crypto/CryptoProvider.ts +2 -2
  155. package/src/index.ts +0 -1
  156. package/src/packageMetadata.ts +1 -1
  157. package/src/request/ManagedIdentityRequestParams.ts +2 -1
  158. package/src/request/SignOutRequest.ts +1 -0
  159. package/src/utils/Constants.ts +1 -0
  160. package/src/utils/NetworkUtils.ts +13 -4
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.15.0 2024-10-03 */
1
+ /*! @azure/msal-node v2.16.1 2024-11-12 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -14,17 +14,21 @@ var path = require('path');
14
14
  * Copyright (c) Microsoft Corporation. All rights reserved.
15
15
  * Licensed under the MIT License.
16
16
  */
17
+ /**
18
+ * This class serializes cache entities to be saved into in-memory object types defined internally
19
+ * @internal
20
+ */
17
21
  class Serializer {
18
22
  /**
19
23
  * serialize the JSON blob
20
- * @param data
24
+ * @param data - JSON blob cache
21
25
  */
22
26
  static serializeJSONBlob(data) {
23
27
  return JSON.stringify(data);
24
28
  }
25
29
  /**
26
30
  * Serialize Accounts
27
- * @param accCache
31
+ * @param accCache - cache of accounts
28
32
  */
29
33
  static serializeAccounts(accCache) {
30
34
  const accounts = {};
@@ -50,7 +54,7 @@ class Serializer {
50
54
  }
51
55
  /**
52
56
  * Serialize IdTokens
53
- * @param idTCache
57
+ * @param idTCache - cache of ID tokens
54
58
  */
55
59
  static serializeIdTokens(idTCache) {
56
60
  const idTokens = {};
@@ -69,7 +73,7 @@ class Serializer {
69
73
  }
70
74
  /**
71
75
  * Serializes AccessTokens
72
- * @param atCache
76
+ * @param atCache - cache of access tokens
73
77
  */
74
78
  static serializeAccessTokens(atCache) {
75
79
  const accessTokens = {};
@@ -98,7 +102,7 @@ class Serializer {
98
102
  }
99
103
  /**
100
104
  * Serialize refreshTokens
101
- * @param rtCache
105
+ * @param rtCache - cache of refresh tokens
102
106
  */
103
107
  static serializeRefreshTokens(rtCache) {
104
108
  const refreshTokens = {};
@@ -119,7 +123,7 @@ class Serializer {
119
123
  }
120
124
  /**
121
125
  * Serialize amdtCache
122
- * @param amdtCache
126
+ * @param amdtCache - cache of app metadata
123
127
  */
124
128
  static serializeAppMetadata(amdtCache) {
125
129
  const appMetadata = {};
@@ -135,7 +139,7 @@ class Serializer {
135
139
  }
136
140
  /**
137
141
  * Serialize the cache
138
- * @param jsonContent
142
+ * @param inMemCache - itemised cache read from the JSON
139
143
  */
140
144
  static serializeAllCache(inMemCache) {
141
145
  return {
@@ -148,7 +152,7 @@ class Serializer {
148
152
  }
149
153
  }
150
154
 
151
- /*! @azure/msal-common v14.15.0 2024-10-03 */
155
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
152
156
  /*
153
157
  * Copyright (c) Microsoft Corporation. All rights reserved.
154
158
  * Licensed under the MIT License.
@@ -243,6 +247,7 @@ const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants$1.EMAIL_SCOPE];
243
247
  */
244
248
  const HeaderNames = {
245
249
  CONTENT_TYPE: "Content-Type",
250
+ CONTENT_LENGTH: "Content-Length",
246
251
  RETRY_AFTER: "Retry-After",
247
252
  CCS_HEADER: "X-AnchorMailbox",
248
253
  WWWAuthenticate: "WWW-Authenticate",
@@ -440,7 +445,7 @@ const CacheOutcome = {
440
445
  // Token renewal offset default in seconds
441
446
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
442
447
 
443
- /*! @azure/msal-common v14.15.0 2024-10-03 */
448
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
444
449
  /*
445
450
  * Copyright (c) Microsoft Corporation. All rights reserved.
446
451
  * Licensed under the MIT License.
@@ -457,7 +462,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
457
462
  unexpectedError: unexpectedError
458
463
  });
459
464
 
460
- /*! @azure/msal-common v14.15.0 2024-10-03 */
465
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
461
466
 
462
467
  /*
463
468
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -506,7 +511,7 @@ function createAuthError(code, additionalMessage) {
506
511
  : AuthErrorMessages[code]);
507
512
  }
508
513
 
509
- /*! @azure/msal-common v14.15.0 2024-10-03 */
514
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
510
515
  /*
511
516
  * Copyright (c) Microsoft Corporation. All rights reserved.
512
517
  * Licensed under the MIT License.
@@ -604,7 +609,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
604
609
  userTimeoutReached: userTimeoutReached
605
610
  });
606
611
 
607
- /*! @azure/msal-common v14.15.0 2024-10-03 */
612
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
608
613
 
609
614
  /*
610
615
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -856,7 +861,7 @@ function createClientAuthError(errorCode, additionalMessage) {
856
861
  return new ClientAuthError(errorCode, additionalMessage);
857
862
  }
858
863
 
859
- /*! @azure/msal-common v14.15.0 2024-10-03 */
864
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
860
865
 
861
866
  /*
862
867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -895,7 +900,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
895
900
  },
896
901
  };
897
902
 
898
- /*! @azure/msal-common v14.15.0 2024-10-03 */
903
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
899
904
 
900
905
  /*
901
906
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1086,12 +1091,12 @@ class Logger {
1086
1091
  }
1087
1092
  }
1088
1093
 
1089
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1094
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1090
1095
  /* eslint-disable header/header */
1091
1096
  const name$1 = "@azure/msal-common";
1092
- const version$1 = "14.15.0";
1097
+ const version$1 = "14.16.0";
1093
1098
 
1094
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1099
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1095
1100
  /*
1096
1101
  * Copyright (c) Microsoft Corporation. All rights reserved.
1097
1102
  * Licensed under the MIT License.
@@ -1111,7 +1116,7 @@ const AzureCloudInstance = {
1111
1116
  AzureUsGovernment: "https://login.microsoftonline.us",
1112
1117
  };
1113
1118
 
1114
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1119
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1115
1120
 
1116
1121
  /*
1117
1122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1172,7 +1177,7 @@ function checkMaxAge(authTime, maxAge) {
1172
1177
  }
1173
1178
  }
1174
1179
 
1175
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1180
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1176
1181
  /*
1177
1182
  * Copyright (c) Microsoft Corporation. All rights reserved.
1178
1183
  * Licensed under the MIT License.
@@ -1217,7 +1222,7 @@ function delay(t, value) {
1217
1222
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1218
1223
  }
1219
1224
 
1220
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1225
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1221
1226
 
1222
1227
  /*
1223
1228
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1544,7 +1549,7 @@ function isAuthorityMetadataExpired(metadata) {
1544
1549
  return metadata.expiresAt <= nowSeconds();
1545
1550
  }
1546
1551
 
1547
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1552
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1548
1553
  /*
1549
1554
  * Copyright (c) Microsoft Corporation. All rights reserved.
1550
1555
  * Licensed under the MIT License.
@@ -1598,7 +1603,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1598
1603
  urlParseError: urlParseError
1599
1604
  });
1600
1605
 
1601
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1606
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1602
1607
 
1603
1608
  /*
1604
1609
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1736,7 +1741,7 @@ function createClientConfigurationError(errorCode) {
1736
1741
  return new ClientConfigurationError(errorCode);
1737
1742
  }
1738
1743
 
1739
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1744
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1740
1745
  /*
1741
1746
  * Copyright (c) Microsoft Corporation. All rights reserved.
1742
1747
  * Licensed under the MIT License.
@@ -1833,7 +1838,7 @@ class StringUtils {
1833
1838
  }
1834
1839
  }
1835
1840
 
1836
- /*! @azure/msal-common v14.15.0 2024-10-03 */
1841
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
1837
1842
 
1838
1843
  /*
1839
1844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2033,7 +2038,7 @@ class ScopeSet {
2033
2038
  }
2034
2039
  }
2035
2040
 
2036
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2041
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2037
2042
 
2038
2043
  /*
2039
2044
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2073,7 +2078,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2073
2078
  };
2074
2079
  }
2075
2080
 
2076
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2081
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2077
2082
  /*
2078
2083
  * Copyright (c) Microsoft Corporation. All rights reserved.
2079
2084
  * Licensed under the MIT License.
@@ -2152,7 +2157,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2152
2157
  return updatedAccountInfo;
2153
2158
  }
2154
2159
 
2155
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2160
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2156
2161
  /*
2157
2162
  * Copyright (c) Microsoft Corporation. All rights reserved.
2158
2163
  * Licensed under the MIT License.
@@ -2167,7 +2172,7 @@ const AuthorityType = {
2167
2172
  Ciam: 3,
2168
2173
  };
2169
2174
 
2170
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2175
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2171
2176
  /*
2172
2177
  * Copyright (c) Microsoft Corporation. All rights reserved.
2173
2178
  * Licensed under the MIT License.
@@ -2189,7 +2194,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2189
2194
  return null;
2190
2195
  }
2191
2196
 
2192
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2197
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2193
2198
  /*
2194
2199
  * Copyright (c) Microsoft Corporation. All rights reserved.
2195
2200
  * Licensed under the MIT License.
@@ -2202,7 +2207,7 @@ const ProtocolMode = {
2202
2207
  OIDC: "OIDC",
2203
2208
  };
2204
2209
 
2205
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2210
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2206
2211
 
2207
2212
  /*
2208
2213
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2445,7 +2450,7 @@ class AccountEntity {
2445
2450
  }
2446
2451
  }
2447
2452
 
2448
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2453
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2449
2454
 
2450
2455
  /*
2451
2456
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2492,7 +2497,7 @@ function getDeserializedResponse(responseString) {
2492
2497
  return null;
2493
2498
  }
2494
2499
 
2495
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2500
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2496
2501
 
2497
2502
  /*
2498
2503
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2656,7 +2661,7 @@ class UrlString {
2656
2661
  }
2657
2662
  }
2658
2663
 
2659
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2664
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2660
2665
 
2661
2666
  /*
2662
2667
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2796,7 +2801,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2796
2801
  return null;
2797
2802
  }
2798
2803
 
2799
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2804
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2800
2805
  /*
2801
2806
  * Copyright (c) Microsoft Corporation. All rights reserved.
2802
2807
  * Licensed under the MIT License.
@@ -2804,7 +2809,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2804
2809
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2805
2810
  const cacheUnknownErrorCode = "cache_error_unknown";
2806
2811
 
2807
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2812
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2808
2813
 
2809
2814
  /*
2810
2815
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2831,7 +2836,7 @@ class CacheError extends Error {
2831
2836
  }
2832
2837
  }
2833
2838
 
2834
- /*! @azure/msal-common v14.15.0 2024-10-03 */
2839
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
2835
2840
 
2836
2841
  /*
2837
2842
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4072,9 +4077,6 @@ class DefaultStorageClass extends CacheManager {
4072
4077
  getTokenKeys() {
4073
4078
  throw createClientAuthError(methodNotImplemented);
4074
4079
  }
4075
- async clear() {
4076
- throw createClientAuthError(methodNotImplemented);
4077
- }
4078
4080
  updateCredentialCacheKey() {
4079
4081
  throw createClientAuthError(methodNotImplemented);
4080
4082
  }
@@ -4083,7 +4085,7 @@ class DefaultStorageClass extends CacheManager {
4083
4085
  }
4084
4086
  }
4085
4087
 
4086
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4088
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4087
4089
 
4088
4090
  /*
4089
4091
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4182,161 +4184,7 @@ function isOidcProtocolMode(config) {
4182
4184
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4183
4185
  }
4184
4186
 
4185
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4186
-
4187
- /*
4188
- * Copyright (c) Microsoft Corporation. All rights reserved.
4189
- * Licensed under the MIT License.
4190
- */
4191
- /**
4192
- * Error thrown when there is an error with the server code, for example, unavailability.
4193
- */
4194
- class ServerError extends AuthError {
4195
- constructor(errorCode, errorMessage, subError, errorNo, status) {
4196
- super(errorCode, errorMessage, subError);
4197
- this.name = "ServerError";
4198
- this.errorNo = errorNo;
4199
- this.status = status;
4200
- Object.setPrototypeOf(this, ServerError.prototype);
4201
- }
4202
- }
4203
-
4204
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4205
-
4206
- /*
4207
- * Copyright (c) Microsoft Corporation. All rights reserved.
4208
- * Licensed under the MIT License.
4209
- */
4210
- /** @internal */
4211
- class ThrottlingUtils {
4212
- /**
4213
- * Prepares a RequestThumbprint to be stored as a key.
4214
- * @param thumbprint
4215
- */
4216
- static generateThrottlingStorageKey(thumbprint) {
4217
- return `${ThrottlingConstants.THROTTLING_PREFIX}.${JSON.stringify(thumbprint)}`;
4218
- }
4219
- /**
4220
- * Performs necessary throttling checks before a network request.
4221
- * @param cacheManager
4222
- * @param thumbprint
4223
- */
4224
- static preProcess(cacheManager, thumbprint) {
4225
- const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
4226
- const value = cacheManager.getThrottlingCache(key);
4227
- if (value) {
4228
- if (value.throttleTime < Date.now()) {
4229
- cacheManager.removeItem(key);
4230
- return;
4231
- }
4232
- throw new ServerError(value.errorCodes?.join(" ") || Constants$1.EMPTY_STRING, value.errorMessage, value.subError);
4233
- }
4234
- }
4235
- /**
4236
- * Performs necessary throttling checks after a network request.
4237
- * @param cacheManager
4238
- * @param thumbprint
4239
- * @param response
4240
- */
4241
- static postProcess(cacheManager, thumbprint, response) {
4242
- if (ThrottlingUtils.checkResponseStatus(response) ||
4243
- ThrottlingUtils.checkResponseForRetryAfter(response)) {
4244
- const thumbprintValue = {
4245
- throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
4246
- error: response.body.error,
4247
- errorCodes: response.body.error_codes,
4248
- errorMessage: response.body.error_description,
4249
- subError: response.body.suberror,
4250
- };
4251
- cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
4252
- }
4253
- }
4254
- /**
4255
- * Checks a NetworkResponse object's status codes against 429 or 5xx
4256
- * @param response
4257
- */
4258
- static checkResponseStatus(response) {
4259
- return (response.status === 429 ||
4260
- (response.status >= 500 && response.status < 600));
4261
- }
4262
- /**
4263
- * Checks a NetworkResponse object's RetryAfter header
4264
- * @param response
4265
- */
4266
- static checkResponseForRetryAfter(response) {
4267
- if (response.headers) {
4268
- return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
4269
- (response.status < 200 || response.status >= 300));
4270
- }
4271
- return false;
4272
- }
4273
- /**
4274
- * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
4275
- * @param throttleTime
4276
- */
4277
- static calculateThrottleTime(throttleTime) {
4278
- const time = throttleTime <= 0 ? 0 : throttleTime;
4279
- const currentSeconds = Date.now() / 1000;
4280
- return Math.floor(Math.min(currentSeconds +
4281
- (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds +
4282
- ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);
4283
- }
4284
- static removeThrottle(cacheManager, clientId, request, homeAccountIdentifier) {
4285
- const thumbprint = {
4286
- clientId: clientId,
4287
- authority: request.authority,
4288
- scopes: request.scopes,
4289
- homeAccountIdentifier: homeAccountIdentifier,
4290
- claims: request.claims,
4291
- authenticationScheme: request.authenticationScheme,
4292
- resourceRequestMethod: request.resourceRequestMethod,
4293
- resourceRequestUri: request.resourceRequestUri,
4294
- shrClaims: request.shrClaims,
4295
- sshKid: request.sshKid,
4296
- };
4297
- const key = this.generateThrottlingStorageKey(thumbprint);
4298
- cacheManager.removeItem(key);
4299
- }
4300
- }
4301
-
4302
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4303
-
4304
- /*
4305
- * Copyright (c) Microsoft Corporation. All rights reserved.
4306
- * Licensed under the MIT License.
4307
- */
4308
- /** @internal */
4309
- class NetworkManager {
4310
- constructor(networkClient, cacheManager) {
4311
- this.networkClient = networkClient;
4312
- this.cacheManager = cacheManager;
4313
- }
4314
- /**
4315
- * Wraps sendPostRequestAsync with necessary preflight and postflight logic
4316
- * @param thumbprint
4317
- * @param tokenEndpoint
4318
- * @param options
4319
- */
4320
- async sendPostRequest(thumbprint, tokenEndpoint, options) {
4321
- ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
4322
- let response;
4323
- try {
4324
- response = await this.networkClient.sendPostRequestAsync(tokenEndpoint, options);
4325
- }
4326
- catch (e) {
4327
- if (e instanceof AuthError) {
4328
- throw e;
4329
- }
4330
- else {
4331
- throw createClientAuthError(networkError);
4332
- }
4333
- }
4334
- ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
4335
- return response;
4336
- }
4337
- }
4338
-
4339
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4187
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4340
4188
  /*
4341
4189
  * Copyright (c) Microsoft Corporation. All rights reserved.
4342
4190
  * Licensed under the MIT License.
@@ -4346,7 +4194,7 @@ const CcsCredentialType = {
4346
4194
  UPN: "UPN",
4347
4195
  };
4348
4196
 
4349
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4197
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4350
4198
  /*
4351
4199
  * Copyright (c) Microsoft Corporation. All rights reserved.
4352
4200
  * Licensed under the MIT License.
@@ -4393,9 +4241,11 @@ const LOGOUT_HINT = "logout_hint";
4393
4241
  const SID = "sid";
4394
4242
  const LOGIN_HINT = "login_hint";
4395
4243
  const DOMAIN_HINT = "domain_hint";
4396
- const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4244
+ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4245
+ const BROKER_CLIENT_ID = "brk_client_id";
4246
+ const BROKER_REDIRECT_URI = "brk_redirect_uri";
4397
4247
 
4398
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4248
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4399
4249
 
4400
4250
  /*
4401
4251
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4462,16 +4312,30 @@ class RequestValidator {
4462
4312
  }
4463
4313
  }
4464
4314
 
4465
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4315
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4466
4316
 
4467
4317
  /*
4468
4318
  * Copyright (c) Microsoft Corporation. All rights reserved.
4469
4319
  * Licensed under the MIT License.
4470
4320
  */
4321
+ function instrumentBrokerParams(parameters, correlationId, performanceClient) {
4322
+ if (!correlationId) {
4323
+ return;
4324
+ }
4325
+ const clientId = parameters.get(CLIENT_ID);
4326
+ if (clientId && parameters.has(BROKER_CLIENT_ID)) {
4327
+ performanceClient?.addFields({
4328
+ embeddedClientId: clientId,
4329
+ embeddedRedirectUri: parameters.get(REDIRECT_URI),
4330
+ }, correlationId);
4331
+ }
4332
+ }
4471
4333
  /** @internal */
4472
4334
  class RequestParameterBuilder {
4473
- constructor() {
4335
+ constructor(correlationId, performanceClient) {
4474
4336
  this.parameters = new Map();
4337
+ this.performanceClient = performanceClient;
4338
+ this.correlationId = correlationId;
4475
4339
  }
4476
4340
  /**
4477
4341
  * add response_type = code
@@ -4835,6 +4699,14 @@ class RequestParameterBuilder {
4835
4699
  addLogoutHint(logoutHint) {
4836
4700
  this.parameters.set(LOGOUT_HINT, encodeURIComponent(logoutHint));
4837
4701
  }
4702
+ addBrokerParameters(params) {
4703
+ const brokerParams = {};
4704
+ brokerParams[BROKER_CLIENT_ID] =
4705
+ params.brokerClientId;
4706
+ brokerParams[BROKER_REDIRECT_URI] =
4707
+ params.brokerRedirectUri;
4708
+ this.addExtraQueryParameters(brokerParams);
4709
+ }
4838
4710
  /**
4839
4711
  * Utility to create a URL from the params map
4840
4712
  */
@@ -4843,11 +4715,12 @@ class RequestParameterBuilder {
4843
4715
  this.parameters.forEach((value, key) => {
4844
4716
  queryParameterArray.push(`${key}=${value}`);
4845
4717
  });
4718
+ instrumentBrokerParams(this.parameters, this.correlationId, this.performanceClient);
4846
4719
  return queryParameterArray.join("&");
4847
4720
  }
4848
4721
  }
4849
4722
 
4850
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4723
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4851
4724
  /*
4852
4725
  * Copyright (c) Microsoft Corporation. All rights reserved.
4853
4726
  * Licensed under the MIT License.
@@ -4859,7 +4732,7 @@ function isOpenIdConfigResponse(response) {
4859
4732
  response.hasOwnProperty("jwks_uri"));
4860
4733
  }
4861
4734
 
4862
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4735
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4863
4736
  /*
4864
4737
  * Copyright (c) Microsoft Corporation. All rights reserved.
4865
4738
  * Licensed under the MIT License.
@@ -4869,7 +4742,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4869
4742
  response.hasOwnProperty("metadata"));
4870
4743
  }
4871
4744
 
4872
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4745
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4873
4746
  /*
4874
4747
  * Copyright (c) Microsoft Corporation. All rights reserved.
4875
4748
  * Licensed under the MIT License.
@@ -4879,7 +4752,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4879
4752
  response.hasOwnProperty("error_description"));
4880
4753
  }
4881
4754
 
4882
- /*! @azure/msal-common v14.15.0 2024-10-03 */
4755
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
4883
4756
  /*
4884
4757
  * Copyright (c) Microsoft Corporation. All rights reserved.
4885
4758
  * Licensed under the MIT License.
@@ -4981,6 +4854,7 @@ const PerformanceEvents = {
4981
4854
  /**
4982
4855
  * Time spent sending/waiting for the response of a request to the token endpoint
4983
4856
  */
4857
+ NetworkClientSendPostRequestAsync: "networkClientSendPostRequestAsync",
4984
4858
  RefreshTokenClientExecutePostToTokenEndpoint: "refreshTokenClientExecutePostToTokenEndpoint",
4985
4859
  AuthorizationCodeClientExecutePostToTokenEndpoint: "authorizationCodeClientExecutePostToTokenEndpoint",
4986
4860
  /**
@@ -5123,7 +4997,7 @@ const PerformanceEvents = {
5123
4997
  GetRandomValues: "getRandomValues",
5124
4998
  };
5125
4999
 
5126
- /*! @azure/msal-common v14.15.0 2024-10-03 */
5000
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
5127
5001
  /*
5128
5002
  * Copyright (c) Microsoft Corporation. All rights reserved.
5129
5003
  * Licensed under the MIT License.
@@ -5219,7 +5093,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5219
5093
  };
5220
5094
  };
5221
5095
 
5222
- /*! @azure/msal-common v14.15.0 2024-10-03 */
5096
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
5223
5097
 
5224
5098
  /*
5225
5099
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5328,7 +5202,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5328
5202
  },
5329
5203
  };
5330
5204
 
5331
- /*! @azure/msal-common v14.15.0 2024-10-03 */
5205
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
5332
5206
 
5333
5207
  /*
5334
5208
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6167,7 +6041,7 @@ function buildStaticAuthorityOptions(authOptions) {
6167
6041
  };
6168
6042
  }
6169
6043
 
6170
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6044
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6171
6045
 
6172
6046
  /*
6173
6047
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6198,7 +6072,144 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6198
6072
  }
6199
6073
  }
6200
6074
 
6201
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6075
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6076
+
6077
+ /*
6078
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6079
+ * Licensed under the MIT License.
6080
+ */
6081
+ /**
6082
+ * Error thrown when there is an error with the server code, for example, unavailability.
6083
+ */
6084
+ class ServerError extends AuthError {
6085
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
6086
+ super(errorCode, errorMessage, subError);
6087
+ this.name = "ServerError";
6088
+ this.errorNo = errorNo;
6089
+ this.status = status;
6090
+ Object.setPrototypeOf(this, ServerError.prototype);
6091
+ }
6092
+ }
6093
+
6094
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6095
+
6096
+ /*
6097
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6098
+ * Licensed under the MIT License.
6099
+ */
6100
+ /** @internal */
6101
+ class ThrottlingUtils {
6102
+ /**
6103
+ * Prepares a RequestThumbprint to be stored as a key.
6104
+ * @param thumbprint
6105
+ */
6106
+ static generateThrottlingStorageKey(thumbprint) {
6107
+ return `${ThrottlingConstants.THROTTLING_PREFIX}.${JSON.stringify(thumbprint)}`;
6108
+ }
6109
+ /**
6110
+ * Performs necessary throttling checks before a network request.
6111
+ * @param cacheManager
6112
+ * @param thumbprint
6113
+ */
6114
+ static preProcess(cacheManager, thumbprint) {
6115
+ const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
6116
+ const value = cacheManager.getThrottlingCache(key);
6117
+ if (value) {
6118
+ if (value.throttleTime < Date.now()) {
6119
+ cacheManager.removeItem(key);
6120
+ return;
6121
+ }
6122
+ throw new ServerError(value.errorCodes?.join(" ") || Constants$1.EMPTY_STRING, value.errorMessage, value.subError);
6123
+ }
6124
+ }
6125
+ /**
6126
+ * Performs necessary throttling checks after a network request.
6127
+ * @param cacheManager
6128
+ * @param thumbprint
6129
+ * @param response
6130
+ */
6131
+ static postProcess(cacheManager, thumbprint, response) {
6132
+ if (ThrottlingUtils.checkResponseStatus(response) ||
6133
+ ThrottlingUtils.checkResponseForRetryAfter(response)) {
6134
+ const thumbprintValue = {
6135
+ throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
6136
+ error: response.body.error,
6137
+ errorCodes: response.body.error_codes,
6138
+ errorMessage: response.body.error_description,
6139
+ subError: response.body.suberror,
6140
+ };
6141
+ cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
6142
+ }
6143
+ }
6144
+ /**
6145
+ * Checks a NetworkResponse object's status codes against 429 or 5xx
6146
+ * @param response
6147
+ */
6148
+ static checkResponseStatus(response) {
6149
+ return (response.status === 429 ||
6150
+ (response.status >= 500 && response.status < 600));
6151
+ }
6152
+ /**
6153
+ * Checks a NetworkResponse object's RetryAfter header
6154
+ * @param response
6155
+ */
6156
+ static checkResponseForRetryAfter(response) {
6157
+ if (response.headers) {
6158
+ return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
6159
+ (response.status < 200 || response.status >= 300));
6160
+ }
6161
+ return false;
6162
+ }
6163
+ /**
6164
+ * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
6165
+ * @param throttleTime
6166
+ */
6167
+ static calculateThrottleTime(throttleTime) {
6168
+ const time = throttleTime <= 0 ? 0 : throttleTime;
6169
+ const currentSeconds = Date.now() / 1000;
6170
+ return Math.floor(Math.min(currentSeconds +
6171
+ (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds +
6172
+ ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);
6173
+ }
6174
+ static removeThrottle(cacheManager, clientId, request, homeAccountIdentifier) {
6175
+ const thumbprint = {
6176
+ clientId: clientId,
6177
+ authority: request.authority,
6178
+ scopes: request.scopes,
6179
+ homeAccountIdentifier: homeAccountIdentifier,
6180
+ claims: request.claims,
6181
+ authenticationScheme: request.authenticationScheme,
6182
+ resourceRequestMethod: request.resourceRequestMethod,
6183
+ resourceRequestUri: request.resourceRequestUri,
6184
+ shrClaims: request.shrClaims,
6185
+ sshKid: request.sshKid,
6186
+ };
6187
+ const key = this.generateThrottlingStorageKey(thumbprint);
6188
+ cacheManager.removeItem(key);
6189
+ }
6190
+ }
6191
+
6192
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6193
+
6194
+ /*
6195
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6196
+ * Licensed under the MIT License.
6197
+ */
6198
+ /**
6199
+ * Represents network related errors
6200
+ */
6201
+ class NetworkError extends AuthError {
6202
+ constructor(error, httpStatus, responseHeaders) {
6203
+ super(error.errorCode, error.errorMessage, error.subError);
6204
+ Object.setPrototypeOf(this, NetworkError.prototype);
6205
+ this.name = "NetworkError";
6206
+ this.error = error;
6207
+ this.httpStatus = httpStatus;
6208
+ this.responseHeaders = responseHeaders;
6209
+ }
6210
+ }
6211
+
6212
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6202
6213
 
6203
6214
  /*
6204
6215
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6220,8 +6231,6 @@ class BaseClient {
6220
6231
  this.cacheManager = this.config.storageInterface;
6221
6232
  // Set the network interface
6222
6233
  this.networkClient = this.config.networkInterface;
6223
- // Set the NetworkManager
6224
- this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);
6225
6234
  // Set TelemetryManager
6226
6235
  this.serverTelemetryManager = this.config.serverTelemetryManager;
6227
6236
  // set Authority
@@ -6265,11 +6274,7 @@ class BaseClient {
6265
6274
  if (queuedEvent) {
6266
6275
  this.performanceClient?.addQueueMeasurement(queuedEvent, correlationId);
6267
6276
  }
6268
- const response = await this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers });
6269
- this.performanceClient?.addFields({
6270
- refreshTokenSize: response.body.refresh_token?.length || 0,
6271
- httpVerToken: response.headers?.[HeaderNames.X_MS_HTTP_VERSION] || "",
6272
- }, correlationId);
6277
+ const response = await this.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers }, correlationId);
6273
6278
  if (this.config.serverTelemetryManager &&
6274
6279
  response.status < 500 &&
6275
6280
  response.status !== 429) {
@@ -6278,6 +6283,52 @@ class BaseClient {
6278
6283
  }
6279
6284
  return response;
6280
6285
  }
6286
+ /**
6287
+ * Wraps sendPostRequestAsync with necessary preflight and postflight logic
6288
+ * @param thumbprint - Request thumbprint for throttling
6289
+ * @param tokenEndpoint - Endpoint to make the POST to
6290
+ * @param options - Body and Headers to include on the POST request
6291
+ * @param correlationId - CorrelationId for telemetry
6292
+ */
6293
+ async sendPostRequest(thumbprint, tokenEndpoint, options, correlationId) {
6294
+ ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
6295
+ let response;
6296
+ try {
6297
+ response = await invokeAsync((this.networkClient.sendPostRequestAsync.bind(this.networkClient)), PerformanceEvents.NetworkClientSendPostRequestAsync, this.logger, this.performanceClient, correlationId)(tokenEndpoint, options);
6298
+ const responseHeaders = response.headers || {};
6299
+ this.performanceClient?.addFields({
6300
+ refreshTokenSize: response.body.refresh_token?.length || 0,
6301
+ httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
6302
+ requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
6303
+ }, correlationId);
6304
+ }
6305
+ catch (e) {
6306
+ if (e instanceof NetworkError) {
6307
+ const responseHeaders = e.responseHeaders;
6308
+ if (responseHeaders) {
6309
+ this.performanceClient?.addFields({
6310
+ httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
6311
+ requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] ||
6312
+ "",
6313
+ contentTypeHeader: responseHeaders[HeaderNames.CONTENT_TYPE] ||
6314
+ undefined,
6315
+ contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] ||
6316
+ undefined,
6317
+ httpStatus: e.httpStatus,
6318
+ }, correlationId);
6319
+ }
6320
+ throw e.error;
6321
+ }
6322
+ if (e instanceof AuthError) {
6323
+ throw e;
6324
+ }
6325
+ else {
6326
+ throw createClientAuthError(networkError);
6327
+ }
6328
+ }
6329
+ ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
6330
+ return response;
6331
+ }
6281
6332
  /**
6282
6333
  * Updates the authority object of the client. Endpoint discovery must be completed.
6283
6334
  * @param updatedAuthority
@@ -6293,15 +6344,22 @@ class BaseClient {
6293
6344
  * @param request
6294
6345
  */
6295
6346
  createTokenQueryParameters(request) {
6296
- const parameterBuilder = new RequestParameterBuilder();
6347
+ const parameterBuilder = new RequestParameterBuilder(request.correlationId, this.performanceClient);
6348
+ if (request.embeddedClientId) {
6349
+ parameterBuilder.addBrokerParameters({
6350
+ brokerClientId: this.config.authOptions.clientId,
6351
+ brokerRedirectUri: this.config.authOptions.redirectUri,
6352
+ });
6353
+ }
6297
6354
  if (request.tokenQueryParameters) {
6298
6355
  parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
6299
6356
  }
6357
+ parameterBuilder.addCorrelationId(request.correlationId);
6300
6358
  return parameterBuilder.createQueryString();
6301
6359
  }
6302
6360
  }
6303
6361
 
6304
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6362
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6305
6363
  /*
6306
6364
  * Copyright (c) Microsoft Corporation. All rights reserved.
6307
6365
  * Licensed under the MIT License.
@@ -6327,7 +6385,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6327
6385
  refreshTokenExpired: refreshTokenExpired
6328
6386
  });
6329
6387
 
6330
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6388
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6331
6389
 
6332
6390
  /*
6333
6391
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6415,7 +6473,7 @@ function createInteractionRequiredAuthError(errorCode) {
6415
6473
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6416
6474
  }
6417
6475
 
6418
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6476
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6419
6477
 
6420
6478
  /*
6421
6479
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6487,7 +6545,7 @@ class ProtocolUtils {
6487
6545
  }
6488
6546
  }
6489
6547
 
6490
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6548
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6491
6549
 
6492
6550
  /*
6493
6551
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6571,7 +6629,7 @@ class PopTokenGenerator {
6571
6629
  }
6572
6630
  }
6573
6631
 
6574
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6632
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6575
6633
  /*
6576
6634
  * Copyright (c) Microsoft Corporation. All rights reserved.
6577
6635
  * Licensed under the MIT License.
@@ -6598,7 +6656,7 @@ class PopTokenGenerator {
6598
6656
  }
6599
6657
  }
6600
6658
 
6601
- /*! @azure/msal-common v14.15.0 2024-10-03 */
6659
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6602
6660
 
6603
6661
  /*
6604
6662
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6975,7 +7033,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6975
7033
  return baseAccount;
6976
7034
  }
6977
7035
 
6978
- /*! @azure/msal-common v14.15.0 2024-10-03 */
7036
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6979
7037
  /*
6980
7038
  * Copyright (c) Microsoft Corporation. All rights reserved.
6981
7039
  * Licensed under the MIT License.
@@ -6993,7 +7051,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
6993
7051
  }
6994
7052
  }
6995
7053
 
6996
- /*! @azure/msal-common v14.15.0 2024-10-03 */
7054
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
6997
7055
 
6998
7056
  /*
6999
7057
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7119,8 +7177,9 @@ class AuthorizationCodeClient extends BaseClient {
7119
7177
  */
7120
7178
  async createTokenRequestBody(request) {
7121
7179
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
7122
- const parameterBuilder = new RequestParameterBuilder();
7123
- parameterBuilder.addClientId(request.tokenBodyParameters?.[CLIENT_ID] ||
7180
+ const parameterBuilder = new RequestParameterBuilder(request.correlationId, this.performanceClient);
7181
+ parameterBuilder.addClientId(request.embeddedClientId ||
7182
+ request.tokenBodyParameters?.[CLIENT_ID] ||
7124
7183
  this.config.authOptions.clientId);
7125
7184
  /*
7126
7185
  * For hybrid spa flow, there will be a code but no verifier
@@ -7180,9 +7239,6 @@ class AuthorizationCodeClient extends BaseClient {
7180
7239
  throw createClientConfigurationError(missingSshJwk);
7181
7240
  }
7182
7241
  }
7183
- const correlationId = request.correlationId ||
7184
- this.config.cryptoInterface.createNewGuid();
7185
- parameterBuilder.addCorrelationId(correlationId);
7186
7242
  if (!StringUtils.isEmptyObj(request.claims) ||
7187
7243
  (this.config.authOptions.clientCapabilities &&
7188
7244
  this.config.authOptions.clientCapabilities.length > 0)) {
@@ -7222,6 +7278,12 @@ class AuthorizationCodeClient extends BaseClient {
7222
7278
  break;
7223
7279
  }
7224
7280
  }
7281
+ if (request.embeddedClientId) {
7282
+ parameterBuilder.addBrokerParameters({
7283
+ brokerClientId: this.config.authOptions.clientId,
7284
+ brokerRedirectUri: this.config.authOptions.redirectUri,
7285
+ });
7286
+ }
7225
7287
  if (request.tokenBodyParameters) {
7226
7288
  parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
7227
7289
  }
@@ -7240,9 +7302,13 @@ class AuthorizationCodeClient extends BaseClient {
7240
7302
  * @param request
7241
7303
  */
7242
7304
  async createAuthCodeUrlQueryString(request) {
7243
- this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
7244
- const parameterBuilder = new RequestParameterBuilder();
7245
- parameterBuilder.addClientId(request.extraQueryParameters?.[CLIENT_ID] ||
7305
+ // generate the correlationId if not set by the user and add
7306
+ const correlationId = request.correlationId ||
7307
+ this.config.cryptoInterface.createNewGuid();
7308
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, correlationId);
7309
+ const parameterBuilder = new RequestParameterBuilder(correlationId, this.performanceClient);
7310
+ parameterBuilder.addClientId(request.embeddedClientId ||
7311
+ request.extraQueryParameters?.[CLIENT_ID] ||
7246
7312
  this.config.authOptions.clientId);
7247
7313
  const requestScopes = [
7248
7314
  ...(request.scopes || []),
@@ -7251,9 +7317,6 @@ class AuthorizationCodeClient extends BaseClient {
7251
7317
  parameterBuilder.addScopes(requestScopes, true, this.oidcDefaultScopes);
7252
7318
  // validate the redirectUri (to be a non null value)
7253
7319
  parameterBuilder.addRedirectUri(request.redirectUri);
7254
- // generate the correlationId if not set by the user and add
7255
- const correlationId = request.correlationId ||
7256
- this.config.cryptoInterface.createNewGuid();
7257
7320
  parameterBuilder.addCorrelationId(correlationId);
7258
7321
  // add response_mode. If not passed in it defaults to query.
7259
7322
  parameterBuilder.addResponseMode(request.responseMode);
@@ -7355,6 +7418,12 @@ class AuthorizationCodeClient extends BaseClient {
7355
7418
  this.config.authOptions.clientCapabilities.length > 0)) {
7356
7419
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
7357
7420
  }
7421
+ if (request.embeddedClientId) {
7422
+ parameterBuilder.addBrokerParameters({
7423
+ brokerClientId: this.config.authOptions.clientId,
7424
+ brokerRedirectUri: this.config.authOptions.redirectUri,
7425
+ });
7426
+ }
7358
7427
  this.addExtraQueryParams(request, parameterBuilder);
7359
7428
  if (request.nativeBroker) {
7360
7429
  // signal ests that this is a WAM call
@@ -7381,7 +7450,7 @@ class AuthorizationCodeClient extends BaseClient {
7381
7450
  * @param request
7382
7451
  */
7383
7452
  createLogoutUrlQueryString(request) {
7384
- const parameterBuilder = new RequestParameterBuilder();
7453
+ const parameterBuilder = new RequestParameterBuilder(request.correlationId, this.performanceClient);
7385
7454
  if (request.postLogoutRedirectUri) {
7386
7455
  parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);
7387
7456
  }
@@ -7424,7 +7493,7 @@ class AuthorizationCodeClient extends BaseClient {
7424
7493
  }
7425
7494
  }
7426
7495
 
7427
- /*! @azure/msal-common v14.15.0 2024-10-03 */
7496
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
7428
7497
 
7429
7498
  /*
7430
7499
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7562,8 +7631,9 @@ class RefreshTokenClient extends BaseClient {
7562
7631
  async createTokenRequestBody(request) {
7563
7632
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
7564
7633
  const correlationId = request.correlationId;
7565
- const parameterBuilder = new RequestParameterBuilder();
7566
- parameterBuilder.addClientId(request.tokenBodyParameters?.[CLIENT_ID] ||
7634
+ const parameterBuilder = new RequestParameterBuilder(correlationId, this.performanceClient);
7635
+ parameterBuilder.addClientId(request.embeddedClientId ||
7636
+ request.tokenBodyParameters?.[CLIENT_ID] ||
7567
7637
  this.config.authOptions.clientId);
7568
7638
  if (request.redirectUri) {
7569
7639
  parameterBuilder.addRedirectUri(request.redirectUri);
@@ -7577,7 +7647,6 @@ class RefreshTokenClient extends BaseClient {
7577
7647
  if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {
7578
7648
  parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
7579
7649
  }
7580
- parameterBuilder.addCorrelationId(correlationId);
7581
7650
  parameterBuilder.addRefreshToken(request.refreshToken);
7582
7651
  if (this.config.clientCredentials.clientSecret) {
7583
7652
  parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
@@ -7631,6 +7700,12 @@ class RefreshTokenClient extends BaseClient {
7631
7700
  break;
7632
7701
  }
7633
7702
  }
7703
+ if (request.embeddedClientId) {
7704
+ parameterBuilder.addBrokerParameters({
7705
+ brokerClientId: this.config.authOptions.clientId,
7706
+ brokerRedirectUri: this.config.authOptions.redirectUri,
7707
+ });
7708
+ }
7634
7709
  if (request.tokenBodyParameters) {
7635
7710
  parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
7636
7711
  }
@@ -7638,7 +7713,7 @@ class RefreshTokenClient extends BaseClient {
7638
7713
  }
7639
7714
  }
7640
7715
 
7641
- /*! @azure/msal-common v14.15.0 2024-10-03 */
7716
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
7642
7717
 
7643
7718
  /*
7644
7719
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7774,7 +7849,7 @@ class SilentFlowClient extends BaseClient {
7774
7849
  }
7775
7850
  }
7776
7851
 
7777
- /*! @azure/msal-common v14.15.0 2024-10-03 */
7852
+ /*! @azure/msal-common v14.16.0 2024-11-12 */
7778
7853
 
7779
7854
  /*
7780
7855
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8042,12 +8117,13 @@ class ServerTelemetryManager {
8042
8117
  * Licensed under the MIT License.
8043
8118
  */
8044
8119
  /**
8045
- * This class deserializes cache entities read from the file into in memory object types defined internally
8120
+ * This class deserializes cache entities read from the file into in-memory object types defined internally
8121
+ * @internal
8046
8122
  */
8047
8123
  class Deserializer {
8048
8124
  /**
8049
8125
  * Parse the JSON blob in memory and deserialize the content
8050
- * @param cachedJson
8126
+ * @param cachedJson - JSON blob cache
8051
8127
  */
8052
8128
  static deserializeJSONBlob(jsonFile) {
8053
8129
  const deserializedCache = !jsonFile ? {} : JSON.parse(jsonFile);
@@ -8055,7 +8131,7 @@ class Deserializer {
8055
8131
  }
8056
8132
  /**
8057
8133
  * Deserializes accounts to AccountEntity objects
8058
- * @param accounts
8134
+ * @param accounts - accounts of type SerializedAccountEntity
8059
8135
  */
8060
8136
  static deserializeAccounts(accounts) {
8061
8137
  const accountObjects = {};
@@ -8086,7 +8162,7 @@ class Deserializer {
8086
8162
  }
8087
8163
  /**
8088
8164
  * Deserializes id tokens to IdTokenEntity objects
8089
- * @param idTokens
8165
+ * @param idTokens - credentials of type SerializedIdTokenEntity
8090
8166
  */
8091
8167
  static deserializeIdTokens(idTokens) {
8092
8168
  const idObjects = {};
@@ -8108,7 +8184,7 @@ class Deserializer {
8108
8184
  }
8109
8185
  /**
8110
8186
  * Deserializes access tokens to AccessTokenEntity objects
8111
- * @param accessTokens
8187
+ * @param accessTokens - access tokens of type SerializedAccessTokenEntity
8112
8188
  */
8113
8189
  static deserializeAccessTokens(accessTokens) {
8114
8190
  const atObjects = {};
@@ -8140,7 +8216,7 @@ class Deserializer {
8140
8216
  }
8141
8217
  /**
8142
8218
  * Deserializes refresh tokens to RefreshTokenEntity objects
8143
- * @param refreshTokens
8219
+ * @param refreshTokens - refresh tokens of type SerializedRefreshTokenEntity
8144
8220
  */
8145
8221
  static deserializeRefreshTokens(refreshTokens) {
8146
8222
  const rtObjects = {};
@@ -8164,7 +8240,7 @@ class Deserializer {
8164
8240
  }
8165
8241
  /**
8166
8242
  * Deserializes appMetadata to AppMetaData objects
8167
- * @param appMetadata
8243
+ * @param appMetadata - app metadata of type SerializedAppMetadataEntity
8168
8244
  */
8169
8245
  static deserializeAppMetadata(appMetadata) {
8170
8246
  const appMetadataObjects = {};
@@ -8182,7 +8258,7 @@ class Deserializer {
8182
8258
  }
8183
8259
  /**
8184
8260
  * Deserialize an inMemory Cache
8185
- * @param jsonCache
8261
+ * @param jsonCache - JSON blob cache
8186
8262
  */
8187
8263
  static deserializeAllCache(jsonCache) {
8188
8264
  return {
@@ -8283,6 +8359,7 @@ const ProxyStatus = {
8283
8359
  * Constants used for region discovery
8284
8360
  */
8285
8361
  const REGION_ENVIRONMENT_VARIABLE = "REGION_NAME";
8362
+ const MSAL_FORCE_REGION = "MSAL_FORCE_REGION";
8286
8363
  /**
8287
8364
  * Constant used for PKCE
8288
8365
  */
@@ -9229,7 +9306,7 @@ class CryptoProvider {
9229
9306
  }
9230
9307
  /**
9231
9308
  * Stringifies and base64Url encodes input public key
9232
- * @param inputKid
9309
+ * @param inputKid - public key id
9233
9310
  * @returns Base64Url encoded public key
9234
9311
  */
9235
9312
  encodeKid() {
@@ -9270,7 +9347,7 @@ class CryptoProvider {
9270
9347
  }
9271
9348
  /**
9272
9349
  * Removes cryptographic keypair from key store matching the keyId passed in
9273
- * @param kid
9350
+ * @param kid - public key id
9274
9351
  */
9275
9352
  removeTokenBindingKey() {
9276
9353
  throw new Error("Method not implemented.");
@@ -9466,7 +9543,7 @@ class NodeStorage extends CacheManager {
9466
9543
  }
9467
9544
  /**
9468
9545
  * Reads account from cache, builds it into an account entity and returns it.
9469
- * @param accountKey
9546
+ * @param accountKey - lookup key to fetch cache type AccountEntity
9470
9547
  * @returns
9471
9548
  */
9472
9549
  getCachedAccountEntity(accountKey) {
@@ -9650,7 +9727,7 @@ class NodeStorage extends CacheManager {
9650
9727
  }
9651
9728
  /**
9652
9729
  * Remove account entity from the platform cache if it's outdated
9653
- * @param accountKey
9730
+ * @param accountKey - lookup key to fetch cache type AccountEntity
9654
9731
  */
9655
9732
  removeOutdatedAccount(accountKey) {
9656
9733
  this.removeItem(accountKey);
@@ -9674,7 +9751,7 @@ class NodeStorage extends CacheManager {
9674
9751
  /**
9675
9752
  * Clears all cache entries created by MSAL (except tokens).
9676
9753
  */
9677
- async clear() {
9754
+ clear() {
9678
9755
  this.logger.trace("Clearing cache entries created by MSAL");
9679
9756
  // read inMemoryCache
9680
9757
  const cacheKeys = this.getKeys();
@@ -9797,7 +9874,7 @@ class TokenCache {
9797
9874
  let cacheContext;
9798
9875
  try {
9799
9876
  if (this.persistence) {
9800
- cacheContext = new TokenCacheContext(this, true);
9877
+ cacheContext = new TokenCacheContext(this, false);
9801
9878
  await this.persistence.beforeCacheAccess(cacheContext);
9802
9879
  }
9803
9880
  return this.storage.getAllAccounts();
@@ -10131,7 +10208,7 @@ class ClientAssertion {
10131
10208
 
10132
10209
  /* eslint-disable header/header */
10133
10210
  const name = "@azure/msal-node";
10134
- const version = "2.15.0";
10211
+ const version = "2.16.1";
10135
10212
 
10136
10213
  /*
10137
10214
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10140,6 +10217,7 @@ const version = "2.15.0";
10140
10217
  /**
10141
10218
  * Oauth2.0 Password grant client
10142
10219
  * Note: We are only supporting public clients for password grant and for purely testing purposes
10220
+ * @public
10143
10221
  */
10144
10222
  class UsernamePasswordClient extends BaseClient {
10145
10223
  constructor(configuration) {
@@ -10148,7 +10226,7 @@ class UsernamePasswordClient extends BaseClient {
10148
10226
  /**
10149
10227
  * API to acquire a token by passing the username and password to the service in exchage of credentials
10150
10228
  * password_grant
10151
- * @param request
10229
+ * @param request - CommonUsernamePasswordRequest
10152
10230
  */
10153
10231
  async acquireToken(request) {
10154
10232
  this.logger.info("in acquireToken call in username-password client");
@@ -10162,8 +10240,8 @@ class UsernamePasswordClient extends BaseClient {
10162
10240
  }
10163
10241
  /**
10164
10242
  * Executes POST request to token endpoint
10165
- * @param authority
10166
- * @param request
10243
+ * @param authority - authority object
10244
+ * @param request - CommonUsernamePasswordRequest provided by the developer
10167
10245
  */
10168
10246
  async executeTokenRequest(authority, request) {
10169
10247
  const queryParametersString = this.createTokenQueryParameters(request);
@@ -10188,7 +10266,7 @@ class UsernamePasswordClient extends BaseClient {
10188
10266
  }
10189
10267
  /**
10190
10268
  * Generates a map for all the params to be sent to the service
10191
- * @param request
10269
+ * @param request - CommonUsernamePasswordRequest provided by the developer
10192
10270
  */
10193
10271
  async createTokenRequestBody(request) {
10194
10272
  const parameterBuilder = new RequestParameterBuilder();
@@ -10265,7 +10343,7 @@ class ClientApplication {
10265
10343
  responseMode: request.responseMode || ResponseMode.QUERY,
10266
10344
  authenticationScheme: AuthenticationScheme.BEARER,
10267
10345
  };
10268
- const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
10346
+ const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, validRequest.redirectUri, undefined, undefined, request.azureCloudOptions);
10269
10347
  const authorizationCodeClient = new AuthorizationCodeClient(authClientConfig);
10270
10348
  this.logger.verbose("Auth code client created", validRequest.correlationId);
10271
10349
  return authorizationCodeClient.getAuthCodeUrl(validRequest);
@@ -10293,7 +10371,7 @@ class ClientApplication {
10293
10371
  };
10294
10372
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByCode, validRequest.correlationId);
10295
10373
  try {
10296
- const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
10374
+ const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, validRequest.redirectUri, serverTelemetryManager, undefined, request.azureCloudOptions);
10297
10375
  const authorizationCodeClient = new AuthorizationCodeClient(authClientConfig);
10298
10376
  this.logger.verbose("Auth code client created", validRequest.correlationId);
10299
10377
  return await authorizationCodeClient.acquireToken(validRequest, authCodePayLoad);
@@ -10322,7 +10400,7 @@ class ClientApplication {
10322
10400
  };
10323
10401
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByRefreshToken, validRequest.correlationId);
10324
10402
  try {
10325
- const refreshTokenClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
10403
+ const refreshTokenClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager, undefined, request.azureCloudOptions);
10326
10404
  const refreshTokenClient = new RefreshTokenClient(refreshTokenClientConfig);
10327
10405
  this.logger.verbose("Refresh token client created", validRequest.correlationId);
10328
10406
  return await refreshTokenClient.acquireToken(validRequest);
@@ -10351,7 +10429,7 @@ class ClientApplication {
10351
10429
  };
10352
10430
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
10353
10431
  try {
10354
- const silentFlowClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
10432
+ const silentFlowClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager, undefined, request.azureCloudOptions);
10355
10433
  const silentFlowClient = new SilentFlowClient(silentFlowClientConfig);
10356
10434
  this.logger.verbose("Silent flow client created", validRequest.correlationId);
10357
10435
  return await silentFlowClient.acquireToken(validRequest);
@@ -10382,7 +10460,7 @@ class ClientApplication {
10382
10460
  };
10383
10461
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByUsernamePassword, validRequest.correlationId);
10384
10462
  try {
10385
- const usernamePasswordClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
10463
+ const usernamePasswordClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, "", serverTelemetryManager, undefined, request.azureCloudOptions);
10386
10464
  const usernamePasswordClient = new UsernamePasswordClient(usernamePasswordClientConfig);
10387
10465
  this.logger.verbose("Username password client created", validRequest.correlationId);
10388
10466
  return await usernamePasswordClient.acquireToken(validRequest);
@@ -10408,8 +10486,8 @@ class ClientApplication {
10408
10486
  * This API is provided for scenarios where you would use OAuth2.0 state parameter to mitigate against
10409
10487
  * CSRF attacks.
10410
10488
  * For more information about state, visit https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
10411
- * @param state
10412
- * @param cachedState
10489
+ * @param state - Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow
10490
+ * @param cachedState - This string is sent back by the server with the authorization code
10413
10491
  */
10414
10492
  validateState(state, cachedState) {
10415
10493
  if (!state) {
@@ -10437,7 +10515,7 @@ class ClientApplication {
10437
10515
  * @param authority - user passed authority in configuration
10438
10516
  * @param serverTelemetryManager - initializes servertelemetry if passed
10439
10517
  */
10440
- async buildOauthClientConfiguration(authority, requestCorrelationId, serverTelemetryManager, azureRegionConfiguration, azureCloudOptions) {
10518
+ async buildOauthClientConfiguration(authority, requestCorrelationId, redirectUri, serverTelemetryManager, azureRegionConfiguration, azureCloudOptions) {
10441
10519
  this.logger.verbose("buildOauthClientConfiguration called", requestCorrelationId);
10442
10520
  // precedence - azureCloudInstance + tenant >> authority and request >> config
10443
10521
  const userAzureCloudOptions = azureCloudOptions
@@ -10452,6 +10530,7 @@ class ClientApplication {
10452
10530
  clientId: this.config.auth.clientId,
10453
10531
  authority: discoveredAuthority,
10454
10532
  clientCapabilities: this.config.auth.clientCapabilities,
10533
+ redirectUri,
10455
10534
  },
10456
10535
  loggerOptions: {
10457
10536
  logLevel: this.config.system.loggerOptions.logLevel,
@@ -10560,7 +10639,7 @@ class ClientApplication {
10560
10639
  * Clear the cache
10561
10640
  */
10562
10641
  clearCache() {
10563
- void this.storage.clear();
10642
+ this.storage.clear();
10564
10643
  }
10565
10644
  }
10566
10645
 
@@ -10652,6 +10731,7 @@ class LoopbackClient {
10652
10731
  */
10653
10732
  /**
10654
10733
  * OAuth2.0 Device code client
10734
+ * @public
10655
10735
  */
10656
10736
  class DeviceCodeClient extends BaseClient {
10657
10737
  constructor(configuration) {
@@ -10660,7 +10740,7 @@ class DeviceCodeClient extends BaseClient {
10660
10740
  /**
10661
10741
  * Gets device code from device code endpoint, calls back to with device code response, and
10662
10742
  * polls token endpoint to exchange device code for tokens
10663
- * @param request
10743
+ * @param request - developer provided CommonDeviceCodeRequest
10664
10744
  */
10665
10745
  async acquireToken(request) {
10666
10746
  const deviceCodeResponse = await this.getDeviceCode(request);
@@ -10674,7 +10754,7 @@ class DeviceCodeClient extends BaseClient {
10674
10754
  }
10675
10755
  /**
10676
10756
  * Creates device code request and executes http GET
10677
- * @param request
10757
+ * @param request - developer provided CommonDeviceCodeRequest
10678
10758
  */
10679
10759
  async getDeviceCode(request) {
10680
10760
  const queryParametersString = this.createExtraQueryParameters(request);
@@ -10692,11 +10772,11 @@ class DeviceCodeClient extends BaseClient {
10692
10772
  shrClaims: request.shrClaims,
10693
10773
  sshKid: request.sshKid,
10694
10774
  };
10695
- return this.executePostRequestToDeviceCodeEndpoint(endpoint, queryString, headers, thumbprint);
10775
+ return this.executePostRequestToDeviceCodeEndpoint(endpoint, queryString, headers, thumbprint, request.correlationId);
10696
10776
  }
10697
10777
  /**
10698
10778
  * Creates query string for the device code request
10699
- * @param request
10779
+ * @param request - developer provided CommonDeviceCodeRequest
10700
10780
  */
10701
10781
  createExtraQueryParameters(request) {
10702
10782
  const parameterBuilder = new RequestParameterBuilder();
@@ -10707,15 +10787,17 @@ class DeviceCodeClient extends BaseClient {
10707
10787
  }
10708
10788
  /**
10709
10789
  * Executes POST request to device code endpoint
10710
- * @param deviceCodeEndpoint
10711
- * @param queryString
10712
- * @param headers
10713
- */
10714
- async executePostRequestToDeviceCodeEndpoint(deviceCodeEndpoint, queryString, headers, thumbprint) {
10715
- const { body: { user_code: userCode, device_code: deviceCode, verification_uri: verificationUri, expires_in: expiresIn, interval, message, }, } = await this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {
10790
+ * @param deviceCodeEndpoint - token endpoint
10791
+ * @param queryString - string to be used in the body of the request
10792
+ * @param headers - headers for the request
10793
+ * @param thumbprint - unique request thumbprint
10794
+ * @param correlationId - correlation id to be used in the request
10795
+ */
10796
+ async executePostRequestToDeviceCodeEndpoint(deviceCodeEndpoint, queryString, headers, thumbprint, correlationId) {
10797
+ const { body: { user_code: userCode, device_code: deviceCode, verification_uri: verificationUri, expires_in: expiresIn, interval, message, }, } = await this.sendPostRequest(thumbprint, deviceCodeEndpoint, {
10716
10798
  body: queryString,
10717
10799
  headers: headers,
10718
- });
10800
+ }, correlationId);
10719
10801
  return {
10720
10802
  userCode,
10721
10803
  deviceCode,
@@ -10727,6 +10809,7 @@ class DeviceCodeClient extends BaseClient {
10727
10809
  }
10728
10810
  /**
10729
10811
  * Create device code endpoint query parameters and returns string
10812
+ * @param request - developer provided CommonDeviceCodeRequest
10730
10813
  */
10731
10814
  createQueryString(request) {
10732
10815
  const parameterBuilder = new RequestParameterBuilder();
@@ -10743,9 +10826,10 @@ class DeviceCodeClient extends BaseClient {
10743
10826
  return parameterBuilder.createQueryString();
10744
10827
  }
10745
10828
  /**
10746
- * Breaks the polling with specific conditions.
10747
- * @param request CommonDeviceCodeRequest
10748
- * @param deviceCodeResponse DeviceCodeResponse
10829
+ * Breaks the polling with specific conditions
10830
+ * @param deviceCodeExpirationTime - expiration time for the device code request
10831
+ * @param userSpecifiedTimeout - developer provided timeout, to be compared against deviceCodeExpirationTime
10832
+ * @param userSpecifiedCancelFlag - boolean indicating the developer would like to cancel the request
10749
10833
  */
10750
10834
  continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
10751
10835
  if (userSpecifiedCancelFlag) {
@@ -10768,10 +10852,9 @@ class DeviceCodeClient extends BaseClient {
10768
10852
  return true;
10769
10853
  }
10770
10854
  /**
10771
- * Creates token request with device code response and polls token endpoint at interval set by the device code
10772
- * response
10773
- * @param request
10774
- * @param deviceCodeResponse
10855
+ * Creates token request with device code response and polls token endpoint at interval set by the device code response
10856
+ * @param request - developer provided CommonDeviceCodeRequest
10857
+ * @param deviceCodeResponse - DeviceCodeResponse returned by the security token service device code endpoint
10775
10858
  */
10776
10859
  async acquireTokenWithDeviceCode(request, deviceCodeResponse) {
10777
10860
  const queryParametersString = this.createTokenQueryParameters(request);
@@ -10826,8 +10909,8 @@ class DeviceCodeClient extends BaseClient {
10826
10909
  }
10827
10910
  /**
10828
10911
  * Creates query parameters and converts to string.
10829
- * @param request
10830
- * @param deviceCodeResponse
10912
+ * @param request - developer provided CommonDeviceCodeRequest
10913
+ * @param deviceCodeResponse - DeviceCodeResponse returned by the security token service device code endpoint
10831
10914
  */
10832
10915
  createTokenRequestBody(request, deviceCodeResponse) {
10833
10916
  const requestParameters = new RequestParameterBuilder();
@@ -10911,7 +10994,7 @@ class PublicClientApplication extends ClientApplication {
10911
10994
  const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
10912
10995
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
10913
10996
  try {
10914
- const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
10997
+ const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, "", serverTelemetryManager, undefined, request.azureCloudOptions);
10915
10998
  const deviceCodeClient = new DeviceCodeClient(deviceCodeConfig);
10916
10999
  this.logger.verbose("Device code client created", validRequest.correlationId);
10917
11000
  return await deviceCodeClient.acquireToken(validRequest);
@@ -11000,7 +11083,7 @@ class PublicClientApplication extends ClientApplication {
11000
11083
  }
11001
11084
  /**
11002
11085
  * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
11003
- * @param request
11086
+ * @param request - developer provided SilentFlowRequest
11004
11087
  * @returns
11005
11088
  */
11006
11089
  async acquireTokenSilent(request) {
@@ -11027,7 +11110,7 @@ class PublicClientApplication extends ClientApplication {
11027
11110
  }
11028
11111
  /**
11029
11112
  * Removes cache artifacts associated with the given account
11030
- * @param request
11113
+ * @param request - developer provided SignOutRequest
11031
11114
  * @returns
11032
11115
  */
11033
11116
  async signOut(request) {
@@ -11055,7 +11138,7 @@ class PublicClientApplication extends ClientApplication {
11055
11138
  }
11056
11139
  /**
11057
11140
  * Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
11058
- * @param loopbackClient
11141
+ * @param loopbackClient - developer provided custom loopback server implementation
11059
11142
  * @returns
11060
11143
  */
11061
11144
  async waitForRedirectUri(loopbackClient) {
@@ -11098,6 +11181,7 @@ class PublicClientApplication extends ClientApplication {
11098
11181
  */
11099
11182
  /**
11100
11183
  * OAuth2.0 client credential grant
11184
+ * @public
11101
11185
  */
11102
11186
  class ClientCredentialClient extends BaseClient {
11103
11187
  constructor(configuration, appTokenProvider) {
@@ -11106,7 +11190,7 @@ class ClientCredentialClient extends BaseClient {
11106
11190
  }
11107
11191
  /**
11108
11192
  * Public API to acquire a token with ClientCredential Flow for Confidential clients
11109
- * @param request
11193
+ * @param request - CommonClientCredentialRequest provided by the developer
11110
11194
  */
11111
11195
  async acquireToken(request) {
11112
11196
  if (request.skipCache || request.claims) {
@@ -11200,8 +11284,8 @@ class ClientCredentialClient extends BaseClient {
11200
11284
  }
11201
11285
  /**
11202
11286
  * Makes a network call to request the token from the service
11203
- * @param request
11204
- * @param authority
11287
+ * @param request - CommonClientCredentialRequest provided by the developer
11288
+ * @param authority - authority object
11205
11289
  */
11206
11290
  async executeTokenRequest(request, authority, refreshAccessToken) {
11207
11291
  let serverTokenResponse;
@@ -11252,7 +11336,7 @@ class ClientCredentialClient extends BaseClient {
11252
11336
  }
11253
11337
  /**
11254
11338
  * generate the request to the server in the acceptable format
11255
- * @param request
11339
+ * @param request - CommonClientCredentialRequest provided by the developer
11256
11340
  */
11257
11341
  async createTokenRequestBody(request) {
11258
11342
  const parameterBuilder = new RequestParameterBuilder();
@@ -11293,6 +11377,7 @@ class ClientCredentialClient extends BaseClient {
11293
11377
  */
11294
11378
  /**
11295
11379
  * On-Behalf-Of client
11380
+ * @public
11296
11381
  */
11297
11382
  class OnBehalfOfClient extends BaseClient {
11298
11383
  constructor(configuration) {
@@ -11300,7 +11385,7 @@ class OnBehalfOfClient extends BaseClient {
11300
11385
  }
11301
11386
  /**
11302
11387
  * Public API to acquire tokens with on behalf of flow
11303
- * @param request
11388
+ * @param request - developer provided CommonOnBehalfOfRequest
11304
11389
  */
11305
11390
  async acquireToken(request) {
11306
11391
  this.scopeSet = new ScopeSet(request.scopes || []);
@@ -11323,7 +11408,7 @@ class OnBehalfOfClient extends BaseClient {
11323
11408
  * Find accessToken based on user assertion and account info in the cache
11324
11409
  * Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires
11325
11410
  * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
11326
- * @param request
11411
+ * @param request - developer provided CommonOnBehalfOfRequest
11327
11412
  */
11328
11413
  async getCachedAuthenticationResult(request) {
11329
11414
  // look in the cache for the access_token which matches the incoming_assertion
@@ -11371,7 +11456,7 @@ class OnBehalfOfClient extends BaseClient {
11371
11456
  /**
11372
11457
  * read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
11373
11458
  * Certain use cases of OBO flow do not expect an idToken in the cache/or from the service
11374
- * @param atHomeAccountId {string}
11459
+ * @param atHomeAccountId - account id
11375
11460
  */
11376
11461
  readIdTokenFromCacheForOBO(atHomeAccountId) {
11377
11462
  const idTokenFilter = {
@@ -11390,9 +11475,8 @@ class OnBehalfOfClient extends BaseClient {
11390
11475
  }
11391
11476
  /**
11392
11477
  * Fetches the cached access token based on incoming assertion
11393
- * @param clientId
11394
- * @param request
11395
- * @param userAssertionHash
11478
+ * @param clientId - client id
11479
+ * @param request - developer provided CommonOnBehalfOfRequest
11396
11480
  */
11397
11481
  readAccessTokenFromCacheForOBO(clientId, request) {
11398
11482
  const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
@@ -11426,8 +11510,8 @@ class OnBehalfOfClient extends BaseClient {
11426
11510
  }
11427
11511
  /**
11428
11512
  * Make a network call to the server requesting credentials
11429
- * @param request
11430
- * @param authority
11513
+ * @param request - developer provided CommonOnBehalfOfRequest
11514
+ * @param authority - authority object
11431
11515
  */
11432
11516
  async executeTokenRequest(request, authority, userAssertionHash) {
11433
11517
  const queryParametersString = this.createTokenQueryParameters(request);
@@ -11454,7 +11538,7 @@ class OnBehalfOfClient extends BaseClient {
11454
11538
  }
11455
11539
  /**
11456
11540
  * generate a server request in accepable format
11457
- * @param request
11541
+ * @param request - developer provided CommonOnBehalfOfRequest
11458
11542
  */
11459
11543
  async createTokenRequestBody(request) {
11460
11544
  const parameterBuilder = new RequestParameterBuilder();
@@ -11569,13 +11653,27 @@ class ConfidentialClientApplication extends ClientApplication {
11569
11653
  if (Object.values(AADAuthorityConstants).includes(tenantId)) {
11570
11654
  throw createClientAuthError(missingTenantIdError);
11571
11655
  }
11656
+ /*
11657
+ * if this env variable is set, and the developer provided region isn't defined and isn't "DisableMsalForceRegion",
11658
+ * MSAL shall opt-in to ESTS-R with the value of this variable
11659
+ */
11660
+ const ENV_MSAL_FORCE_REGION = process.env[MSAL_FORCE_REGION];
11661
+ let region;
11662
+ if (validRequest.azureRegion !== "DisableMsalForceRegion") {
11663
+ if (!validRequest.azureRegion && ENV_MSAL_FORCE_REGION) {
11664
+ region = ENV_MSAL_FORCE_REGION;
11665
+ }
11666
+ else {
11667
+ region = validRequest.azureRegion;
11668
+ }
11669
+ }
11572
11670
  const azureRegionConfiguration = {
11573
- azureRegion: validRequest.azureRegion,
11671
+ azureRegion: region,
11574
11672
  environmentRegion: process.env[REGION_ENVIRONMENT_VARIABLE],
11575
11673
  };
11576
11674
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
11577
11675
  try {
11578
- const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
11676
+ const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, "", serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
11579
11677
  const clientCredentialClient = new ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
11580
11678
  this.logger.verbose("Client credential client created", validRequest.correlationId);
11581
11679
  return await clientCredentialClient.acquireToken(validRequest);
@@ -11606,7 +11704,7 @@ class ConfidentialClientApplication extends ClientApplication {
11606
11704
  ...(await this.initializeBaseRequest(request)),
11607
11705
  };
11608
11706
  try {
11609
- const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
11707
+ const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, "", undefined, undefined, request.azureCloudOptions);
11610
11708
  const oboClient = new OnBehalfOfClient(onBehalfOfConfig);
11611
11709
  this.logger.verbose("On behalf of client created", validRequest.correlationId);
11612
11710
  return await oboClient.acquireToken(validRequest);
@@ -12301,16 +12399,28 @@ class ManagedIdentityApplication {
12301
12399
  * Copyright (c) Microsoft Corporation. All rights reserved.
12302
12400
  * Licensed under the MIT License.
12303
12401
  */
12402
+ /**
12403
+ * Cache plugin that serializes data to the cache and deserializes data from the cache
12404
+ * @public
12405
+ */
12304
12406
  class DistributedCachePlugin {
12305
12407
  constructor(client, partitionManager) {
12306
12408
  this.client = client;
12307
12409
  this.partitionManager = partitionManager;
12308
12410
  }
12411
+ /**
12412
+ * Deserializes the cache before accessing it
12413
+ * @param cacheContext - TokenCacheContext
12414
+ */
12309
12415
  async beforeCacheAccess(cacheContext) {
12310
12416
  const partitionKey = await this.partitionManager.getKey();
12311
12417
  const cacheData = await this.client.get(partitionKey);
12312
12418
  cacheContext.tokenCache.deserialize(cacheData);
12313
12419
  }
12420
+ /**
12421
+ * Serializes the cache after accessing it
12422
+ * @param cacheContext - TokenCacheContext
12423
+ */
12314
12424
  async afterCacheAccess(cacheContext) {
12315
12425
  if (cacheContext.cacheHasChanged) {
12316
12426
  const kvStore = cacheContext.tokenCache.getKVStore();
@@ -12357,7 +12467,6 @@ exports.ServerError = ServerError;
12357
12467
  exports.TokenCache = TokenCache;
12358
12468
  exports.TokenCacheContext = TokenCacheContext;
12359
12469
  exports.UsernamePasswordClient = UsernamePasswordClient;
12360
- exports.buildAppConfiguration = buildAppConfiguration;
12361
12470
  exports.internals = internals;
12362
12471
  exports.version = version;
12363
12472
  //# sourceMappingURL=msal-node.cjs.map