@azure/msal-node 2.16.2 → 3.1.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 (108) hide show
  1. package/dist/cache/NodeStorage.d.ts +5 -10
  2. package/dist/cache/NodeStorage.d.ts.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +6 -17
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +1 -1
  6. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  7. package/dist/cache/serializer/Deserializer.mjs +1 -1
  8. package/dist/cache/serializer/Serializer.mjs +1 -1
  9. package/dist/client/ClientApplication.mjs +1 -1
  10. package/dist/client/ClientAssertion.mjs +1 -1
  11. package/dist/client/ClientCredentialClient.mjs +1 -1
  12. package/dist/client/ConfidentialClientApplication.d.ts +0 -1
  13. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  14. package/dist/client/ConfidentialClientApplication.mjs +40 -43
  15. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  16. package/dist/client/DeviceCodeClient.mjs +1 -1
  17. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  18. package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
  19. package/dist/client/ManagedIdentityClient.mjs +10 -6
  20. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  21. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  22. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  23. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  24. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +3 -2
  25. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  26. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +7 -4
  27. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  28. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  29. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  30. package/dist/client/ManagedIdentitySources/Imds.mjs +3 -2
  31. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  32. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts +15 -0
  33. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -0
  34. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +51 -0
  35. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -0
  36. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  37. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +3 -4
  38. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  39. package/dist/client/OnBehalfOfClient.mjs +1 -1
  40. package/dist/client/PublicClientApplication.mjs +1 -1
  41. package/dist/client/UsernamePasswordClient.mjs +1 -1
  42. package/dist/config/Configuration.mjs +1 -1
  43. package/dist/config/ManagedIdentityId.mjs +1 -1
  44. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  45. package/dist/crypto/CryptoProvider.mjs +1 -1
  46. package/dist/crypto/GuidGenerator.mjs +1 -1
  47. package/dist/crypto/HashUtils.d.ts +1 -0
  48. package/dist/crypto/HashUtils.d.ts.map +1 -1
  49. package/dist/crypto/HashUtils.mjs +1 -1
  50. package/dist/crypto/PkceGenerator.mjs +1 -1
  51. package/dist/error/ManagedIdentityError.mjs +1 -1
  52. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  53. package/dist/error/NodeAuthError.mjs +1 -1
  54. package/dist/index.d.ts +0 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.mjs +1 -2
  57. package/dist/index.mjs.map +1 -1
  58. package/dist/internals.mjs +1 -1
  59. package/dist/network/HttpClient.mjs +1 -1
  60. package/dist/network/HttpClientWithRetries.mjs +1 -1
  61. package/dist/network/LoopbackClient.mjs +1 -1
  62. package/dist/packageMetadata.d.ts +1 -1
  63. package/dist/packageMetadata.d.ts.map +1 -1
  64. package/dist/packageMetadata.mjs +2 -2
  65. package/dist/request/InteractiveRequest.d.ts +1 -0
  66. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  67. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  68. package/dist/utils/Constants.d.ts +3 -1
  69. package/dist/utils/Constants.d.ts.map +1 -1
  70. package/dist/utils/Constants.mjs +5 -3
  71. package/dist/utils/Constants.mjs.map +1 -1
  72. package/dist/utils/EncodingUtils.mjs +1 -1
  73. package/dist/utils/NetworkUtils.mjs +1 -1
  74. package/dist/utils/NetworkUtils.mjs.map +1 -1
  75. package/lib/msal-node.cjs +201 -231
  76. package/lib/msal-node.cjs.map +1 -1
  77. package/lib/types/cache/NodeStorage.d.ts +5 -10
  78. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  79. package/lib/types/client/ConfidentialClientApplication.d.ts +0 -1
  80. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  81. package/lib/types/client/ManagedIdentityClient.d.ts.map +1 -1
  82. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +3 -2
  83. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  84. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  85. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts +15 -0
  86. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -0
  87. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  88. package/lib/types/crypto/HashUtils.d.ts +1 -0
  89. package/lib/types/crypto/HashUtils.d.ts.map +1 -1
  90. package/lib/types/index.d.ts +0 -1
  91. package/lib/types/index.d.ts.map +1 -1
  92. package/lib/types/packageMetadata.d.ts +1 -1
  93. package/lib/types/packageMetadata.d.ts.map +1 -1
  94. package/lib/types/request/InteractiveRequest.d.ts +1 -0
  95. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  96. package/lib/types/utils/Constants.d.ts +3 -1
  97. package/lib/types/utils/Constants.d.ts.map +1 -1
  98. package/package.json +2 -2
  99. package/src/cache/NodeStorage.ts +9 -17
  100. package/src/client/ConfidentialClientApplication.ts +57 -60
  101. package/src/client/ManagedIdentityClient.ts +11 -0
  102. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +7 -3
  103. package/src/client/ManagedIdentitySources/Imds.ts +2 -1
  104. package/src/client/ManagedIdentitySources/MachineLearning.ts +123 -0
  105. package/src/client/ManagedIdentitySources/ServiceFabric.ts +2 -3
  106. package/src/index.ts +0 -1
  107. package/src/packageMetadata.ts +1 -1
  108. package/src/utils/Constants.ts +3 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.16.2 2024-11-19 */
1
+ /*! @azure/msal-node v3.1.0 2025-01-22 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -152,7 +152,7 @@ class Serializer {
152
152
  }
153
153
  }
154
154
 
155
- /*! @azure/msal-common v14.16.0 2024-11-19 */
155
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
156
156
  /*
157
157
  * Copyright (c) Microsoft Corporation. All rights reserved.
158
158
  * Licensed under the MIT License.
@@ -445,7 +445,7 @@ const CacheOutcome = {
445
445
  // Token renewal offset default in seconds
446
446
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
447
447
 
448
- /*! @azure/msal-common v14.16.0 2024-11-19 */
448
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
449
449
  /*
450
450
  * Copyright (c) Microsoft Corporation. All rights reserved.
451
451
  * Licensed under the MIT License.
@@ -462,7 +462,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
462
462
  unexpectedError: unexpectedError
463
463
  });
464
464
 
465
- /*! @azure/msal-common v14.16.0 2024-11-19 */
465
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
466
466
 
467
467
  /*
468
468
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -511,7 +511,7 @@ function createAuthError(code, additionalMessage) {
511
511
  : AuthErrorMessages[code]);
512
512
  }
513
513
 
514
- /*! @azure/msal-common v14.16.0 2024-11-19 */
514
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
515
515
  /*
516
516
  * Copyright (c) Microsoft Corporation. All rights reserved.
517
517
  * Licensed under the MIT License.
@@ -609,7 +609,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
609
609
  userTimeoutReached: userTimeoutReached
610
610
  });
611
611
 
612
- /*! @azure/msal-common v14.16.0 2024-11-19 */
612
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
613
613
 
614
614
  /*
615
615
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -861,7 +861,7 @@ function createClientAuthError(errorCode, additionalMessage) {
861
861
  return new ClientAuthError(errorCode, additionalMessage);
862
862
  }
863
863
 
864
- /*! @azure/msal-common v14.16.0 2024-11-19 */
864
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
865
865
 
866
866
  /*
867
867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -900,7 +900,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
900
900
  },
901
901
  };
902
902
 
903
- /*! @azure/msal-common v14.16.0 2024-11-19 */
903
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
904
904
 
905
905
  /*
906
906
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1091,12 +1091,12 @@ class Logger {
1091
1091
  }
1092
1092
  }
1093
1093
 
1094
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1094
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1095
1095
  /* eslint-disable header/header */
1096
1096
  const name$1 = "@azure/msal-common";
1097
- const version$1 = "14.16.0";
1097
+ const version$1 = "15.0.2";
1098
1098
 
1099
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1099
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1100
1100
  /*
1101
1101
  * Copyright (c) Microsoft Corporation. All rights reserved.
1102
1102
  * Licensed under the MIT License.
@@ -1116,7 +1116,7 @@ const AzureCloudInstance = {
1116
1116
  AzureUsGovernment: "https://login.microsoftonline.us",
1117
1117
  };
1118
1118
 
1119
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1119
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1120
1120
 
1121
1121
  /*
1122
1122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1177,7 +1177,7 @@ function checkMaxAge(authTime, maxAge) {
1177
1177
  }
1178
1178
  }
1179
1179
 
1180
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1180
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1181
1181
  /*
1182
1182
  * Copyright (c) Microsoft Corporation. All rights reserved.
1183
1183
  * Licensed under the MIT License.
@@ -1222,7 +1222,7 @@ function delay(t, value) {
1222
1222
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1223
1223
  }
1224
1224
 
1225
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1225
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1226
1226
 
1227
1227
  /*
1228
1228
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1549,7 +1549,7 @@ function isAuthorityMetadataExpired(metadata) {
1549
1549
  return metadata.expiresAt <= nowSeconds();
1550
1550
  }
1551
1551
 
1552
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1552
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1553
1553
  /*
1554
1554
  * Copyright (c) Microsoft Corporation. All rights reserved.
1555
1555
  * Licensed under the MIT License.
@@ -1574,14 +1574,14 @@ const missingSshKid = "missing_ssh_kid";
1574
1574
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
1575
1575
  const invalidAuthenticationHeader = "invalid_authentication_header";
1576
1576
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
1577
- const cannotAllowNativeBroker = "cannot_allow_native_broker";
1577
+ const cannotAllowPlatformBroker = "cannot_allow_platform_broker";
1578
1578
  const authorityMismatch = "authority_mismatch";
1579
1579
 
1580
1580
  var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1581
1581
  __proto__: null,
1582
1582
  authorityMismatch: authorityMismatch,
1583
1583
  authorityUriInsecure: authorityUriInsecure,
1584
- cannotAllowNativeBroker: cannotAllowNativeBroker,
1584
+ cannotAllowPlatformBroker: cannotAllowPlatformBroker,
1585
1585
  cannotSetOIDCOptions: cannotSetOIDCOptions,
1586
1586
  claimsRequestParsingError: claimsRequestParsingError,
1587
1587
  emptyInputScopesError: emptyInputScopesError,
@@ -1603,7 +1603,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1603
1603
  urlParseError: urlParseError
1604
1604
  });
1605
1605
 
1606
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1606
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1607
1607
 
1608
1608
  /*
1609
1609
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1630,7 +1630,7 @@ const ClientConfigurationErrorMessages = {
1630
1630
  [missingNonceAuthenticationHeader]: "Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",
1631
1631
  [invalidAuthenticationHeader]: "Invalid authentication header provided",
1632
1632
  [cannotSetOIDCOptions]: "Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",
1633
- [cannotAllowNativeBroker]: "Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",
1633
+ [cannotAllowPlatformBroker]: "Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",
1634
1634
  [authorityMismatch]: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",
1635
1635
  };
1636
1636
  /**
@@ -1718,9 +1718,9 @@ const ClientConfigurationErrorMessage = {
1718
1718
  code: cannotSetOIDCOptions,
1719
1719
  desc: ClientConfigurationErrorMessages[cannotSetOIDCOptions],
1720
1720
  },
1721
- cannotAllowNativeBroker: {
1722
- code: cannotAllowNativeBroker,
1723
- desc: ClientConfigurationErrorMessages[cannotAllowNativeBroker],
1721
+ cannotAllowPlatformBroker: {
1722
+ code: cannotAllowPlatformBroker,
1723
+ desc: ClientConfigurationErrorMessages[cannotAllowPlatformBroker],
1724
1724
  },
1725
1725
  authorityMismatch: {
1726
1726
  code: authorityMismatch,
@@ -1741,7 +1741,7 @@ function createClientConfigurationError(errorCode) {
1741
1741
  return new ClientConfigurationError(errorCode);
1742
1742
  }
1743
1743
 
1744
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1744
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1745
1745
  /*
1746
1746
  * Copyright (c) Microsoft Corporation. All rights reserved.
1747
1747
  * Licensed under the MIT License.
@@ -1838,7 +1838,7 @@ class StringUtils {
1838
1838
  }
1839
1839
  }
1840
1840
 
1841
- /*! @azure/msal-common v14.16.0 2024-11-19 */
1841
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
1842
1842
 
1843
1843
  /*
1844
1844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1858,8 +1858,10 @@ class ScopeSet {
1858
1858
  const filteredInput = scopeArr
1859
1859
  ? StringUtils.removeEmptyStringsFromArray(scopeArr)
1860
1860
  : [];
1861
- // Validate and filter scopes (validate function throws if validation fails)
1862
- this.validateInputScopes(filteredInput);
1861
+ // Check if scopes array has at least one member
1862
+ if (!filteredInput || !filteredInput.length) {
1863
+ throw createClientConfigurationError(emptyInputScopesError);
1864
+ }
1863
1865
  this.scopes = new Set(); // Iterator in constructor not supported by IE11
1864
1866
  filteredInput.forEach((scope) => this.scopes.add(scope));
1865
1867
  }
@@ -1889,17 +1891,6 @@ class ScopeSet {
1889
1891
  }
1890
1892
  return scopeSet;
1891
1893
  }
1892
- /**
1893
- * Used to validate the scopes input parameter requested by the developer.
1894
- * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.
1895
- * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not
1896
- */
1897
- validateInputScopes(inputScopes) {
1898
- // Check if scopes are required but not given or is an empty array
1899
- if (!inputScopes || inputScopes.length < 1) {
1900
- throw createClientConfigurationError(emptyInputScopesError);
1901
- }
1902
- }
1903
1894
  /**
1904
1895
  * Check if a given scope is present in this set of scopes.
1905
1896
  * @param scope
@@ -2038,7 +2029,7 @@ class ScopeSet {
2038
2029
  }
2039
2030
  }
2040
2031
 
2041
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2032
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2042
2033
 
2043
2034
  /*
2044
2035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2078,7 +2069,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2078
2069
  };
2079
2070
  }
2080
2071
 
2081
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2072
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2082
2073
  /*
2083
2074
  * Copyright (c) Microsoft Corporation. All rights reserved.
2084
2075
  * Licensed under the MIT License.
@@ -2157,7 +2148,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2157
2148
  return updatedAccountInfo;
2158
2149
  }
2159
2150
 
2160
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2151
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2161
2152
  /*
2162
2153
  * Copyright (c) Microsoft Corporation. All rights reserved.
2163
2154
  * Licensed under the MIT License.
@@ -2172,7 +2163,7 @@ const AuthorityType = {
2172
2163
  Ciam: 3,
2173
2164
  };
2174
2165
 
2175
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2166
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2176
2167
  /*
2177
2168
  * Copyright (c) Microsoft Corporation. All rights reserved.
2178
2169
  * Licensed under the MIT License.
@@ -2194,7 +2185,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2194
2185
  return null;
2195
2186
  }
2196
2187
 
2197
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2188
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2198
2189
  /*
2199
2190
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2191
  * Licensed under the MIT License.
@@ -2207,7 +2198,7 @@ const ProtocolMode = {
2207
2198
  OIDC: "OIDC",
2208
2199
  };
2209
2200
 
2210
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2201
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2211
2202
 
2212
2203
  /*
2213
2204
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2450,7 +2441,7 @@ class AccountEntity {
2450
2441
  }
2451
2442
  }
2452
2443
 
2453
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2444
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2454
2445
 
2455
2446
  /*
2456
2447
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2497,7 +2488,7 @@ function getDeserializedResponse(responseString) {
2497
2488
  return null;
2498
2489
  }
2499
2490
 
2500
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2491
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2501
2492
 
2502
2493
  /*
2503
2494
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2661,7 +2652,7 @@ class UrlString {
2661
2652
  }
2662
2653
  }
2663
2654
 
2664
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2655
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2665
2656
 
2666
2657
  /*
2667
2658
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2801,7 +2792,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2801
2792
  return null;
2802
2793
  }
2803
2794
 
2804
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2795
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2805
2796
  /*
2806
2797
  * Copyright (c) Microsoft Corporation. All rights reserved.
2807
2798
  * Licensed under the MIT License.
@@ -2809,7 +2800,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2809
2800
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2810
2801
  const cacheUnknownErrorCode = "cache_error_unknown";
2811
2802
 
2812
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2803
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2813
2804
 
2814
2805
  /*
2815
2806
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2836,7 +2827,7 @@ class CacheError extends Error {
2836
2827
  }
2837
2828
  }
2838
2829
 
2839
- /*! @azure/msal-common v14.16.0 2024-11-19 */
2830
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
2840
2831
 
2841
2832
  /*
2842
2833
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3001,24 +2992,24 @@ class CacheManager {
3001
2992
  * @param storeInCache {?StoreInCache}
3002
2993
  * @param correlationId {?string} correlation id
3003
2994
  */
3004
- async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
2995
+ async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
3005
2996
  if (!cacheRecord) {
3006
2997
  throw createClientAuthError(invalidCacheRecord);
3007
2998
  }
3008
2999
  try {
3009
3000
  if (!!cacheRecord.account) {
3010
- this.setAccount(cacheRecord.account);
3001
+ await this.setAccount(cacheRecord.account, correlationId);
3011
3002
  }
3012
3003
  if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
3013
- this.setIdTokenCredential(cacheRecord.idToken);
3004
+ await this.setIdTokenCredential(cacheRecord.idToken, correlationId);
3014
3005
  }
3015
3006
  if (!!cacheRecord.accessToken &&
3016
3007
  storeInCache?.accessToken !== false) {
3017
- await this.saveAccessToken(cacheRecord.accessToken);
3008
+ await this.saveAccessToken(cacheRecord.accessToken, correlationId);
3018
3009
  }
3019
3010
  if (!!cacheRecord.refreshToken &&
3020
3011
  storeInCache?.refreshToken !== false) {
3021
- this.setRefreshTokenCredential(cacheRecord.refreshToken);
3012
+ await this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
3022
3013
  }
3023
3014
  if (!!cacheRecord.appMetadata) {
3024
3015
  this.setAppMetadata(cacheRecord.appMetadata);
@@ -3048,7 +3039,7 @@ class CacheManager {
3048
3039
  * saves access token credential
3049
3040
  * @param credential
3050
3041
  */
3051
- async saveAccessToken(credential) {
3042
+ async saveAccessToken(credential, correlationId) {
3052
3043
  const accessTokenFilter = {
3053
3044
  clientId: credential.clientId,
3054
3045
  credentialType: credential.credentialType,
@@ -3075,7 +3066,7 @@ class CacheManager {
3075
3066
  }
3076
3067
  });
3077
3068
  await Promise.all(removedAccessTokens);
3078
- this.setAccessTokenCredential(credential);
3069
+ await this.setAccessTokenCredential(credential, correlationId);
3079
3070
  }
3080
3071
  /**
3081
3072
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -3361,61 +3352,6 @@ class CacheManager {
3361
3352
  });
3362
3353
  await Promise.all(removedCredentials);
3363
3354
  }
3364
- /**
3365
- * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
3366
- * cache into a condensed multi-tenant account object with tenant profiles.
3367
- * @param accountKey
3368
- * @param accountEntity
3369
- * @param logger
3370
- * @returns
3371
- */
3372
- updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
3373
- // Only update if account entity is defined and has no tenantProfiles object (is outdated)
3374
- if (accountEntity && accountEntity.isSingleTenant()) {
3375
- this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
3376
- // Get keys of all accounts belonging to user
3377
- const matchingAccountKeys = this.getAccountKeys().filter((key) => {
3378
- return key.startsWith(accountEntity.homeAccountId);
3379
- });
3380
- // Get all account entities belonging to user
3381
- const accountsToMerge = [];
3382
- matchingAccountKeys.forEach((key) => {
3383
- const account = this.getCachedAccountEntity(key);
3384
- if (account) {
3385
- accountsToMerge.push(account);
3386
- }
3387
- });
3388
- // Set base account to home account if available, any account if not
3389
- const baseAccount = accountsToMerge.find((account) => {
3390
- return tenantIdMatchesHomeTenant(account.realm, account.homeAccountId);
3391
- }) || accountsToMerge[0];
3392
- // Populate tenant profiles built from each account entity belonging to the user
3393
- baseAccount.tenantProfiles = accountsToMerge.map((account) => {
3394
- return {
3395
- tenantId: account.realm,
3396
- localAccountId: account.localAccountId,
3397
- name: account.name,
3398
- isHomeTenant: tenantIdMatchesHomeTenant(account.realm, account.homeAccountId),
3399
- };
3400
- });
3401
- const updatedAccount = CacheManager.toObject(new AccountEntity(), {
3402
- ...baseAccount,
3403
- });
3404
- const newAccountKey = updatedAccount.generateAccountKey();
3405
- // Clear cache of legacy account objects that have been collpsed into tenant profiles
3406
- matchingAccountKeys.forEach((key) => {
3407
- if (key !== newAccountKey) {
3408
- this.removeOutdatedAccount(accountKey);
3409
- }
3410
- });
3411
- // Cache updated account object
3412
- this.setAccount(updatedAccount);
3413
- logger?.verbose("Updated an outdated account entity in the cache");
3414
- return updatedAccount;
3415
- }
3416
- // No update is necessary
3417
- return accountEntity;
3418
- }
3419
3355
  /**
3420
3356
  * returns a boolean if the given credential is removed
3421
3357
  * @param credential
@@ -3593,8 +3529,7 @@ class CacheManager {
3593
3529
  * Distinguish between Bearer and PoP/SSH token cache types
3594
3530
  * Cast to lowercase to handle "bearer" from ADFS
3595
3531
  */
3596
- const credentialType = authScheme &&
3597
- authScheme.toLowerCase() !==
3532
+ const credentialType = authScheme.toLowerCase() !==
3598
3533
  AuthenticationScheme.BEARER.toLowerCase()
3599
3534
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
3600
3535
  : CredentialType.ACCESS_TOKEN;
@@ -4011,28 +3946,25 @@ class CacheManager {
4011
3946
  }
4012
3947
  /** @internal */
4013
3948
  class DefaultStorageClass extends CacheManager {
4014
- setAccount() {
3949
+ async setAccount() {
4015
3950
  throw createClientAuthError(methodNotImplemented);
4016
3951
  }
4017
3952
  getAccount() {
4018
3953
  throw createClientAuthError(methodNotImplemented);
4019
3954
  }
4020
- getCachedAccountEntity() {
4021
- throw createClientAuthError(methodNotImplemented);
4022
- }
4023
- setIdTokenCredential() {
3955
+ async setIdTokenCredential() {
4024
3956
  throw createClientAuthError(methodNotImplemented);
4025
3957
  }
4026
3958
  getIdTokenCredential() {
4027
3959
  throw createClientAuthError(methodNotImplemented);
4028
3960
  }
4029
- setAccessTokenCredential() {
3961
+ async setAccessTokenCredential() {
4030
3962
  throw createClientAuthError(methodNotImplemented);
4031
3963
  }
4032
3964
  getAccessTokenCredential() {
4033
3965
  throw createClientAuthError(methodNotImplemented);
4034
3966
  }
4035
- setRefreshTokenCredential() {
3967
+ async setRefreshTokenCredential() {
4036
3968
  throw createClientAuthError(methodNotImplemented);
4037
3969
  }
4038
3970
  getRefreshTokenCredential() {
@@ -4077,15 +4009,9 @@ class DefaultStorageClass extends CacheManager {
4077
4009
  getTokenKeys() {
4078
4010
  throw createClientAuthError(methodNotImplemented);
4079
4011
  }
4080
- updateCredentialCacheKey() {
4081
- throw createClientAuthError(methodNotImplemented);
4082
- }
4083
- removeOutdatedAccount() {
4084
- throw createClientAuthError(methodNotImplemented);
4085
- }
4086
4012
  }
4087
4013
 
4088
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4014
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4089
4015
 
4090
4016
  /*
4091
4017
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4184,7 +4110,7 @@ function isOidcProtocolMode(config) {
4184
4110
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4185
4111
  }
4186
4112
 
4187
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4113
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4188
4114
  /*
4189
4115
  * Copyright (c) Microsoft Corporation. All rights reserved.
4190
4116
  * Licensed under the MIT License.
@@ -4194,7 +4120,7 @@ const CcsCredentialType = {
4194
4120
  UPN: "UPN",
4195
4121
  };
4196
4122
 
4197
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4123
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4198
4124
  /*
4199
4125
  * Copyright (c) Microsoft Corporation. All rights reserved.
4200
4126
  * Licensed under the MIT License.
@@ -4245,7 +4171,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4245
4171
  const BROKER_CLIENT_ID = "brk_client_id";
4246
4172
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4247
4173
 
4248
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4174
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4249
4175
 
4250
4176
  /*
4251
4177
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4312,7 +4238,7 @@ class RequestValidator {
4312
4238
  }
4313
4239
  }
4314
4240
 
4315
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4241
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4316
4242
 
4317
4243
  /*
4318
4244
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4720,7 +4646,7 @@ class RequestParameterBuilder {
4720
4646
  }
4721
4647
  }
4722
4648
 
4723
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4649
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4724
4650
  /*
4725
4651
  * Copyright (c) Microsoft Corporation. All rights reserved.
4726
4652
  * Licensed under the MIT License.
@@ -4732,7 +4658,7 @@ function isOpenIdConfigResponse(response) {
4732
4658
  response.hasOwnProperty("jwks_uri"));
4733
4659
  }
4734
4660
 
4735
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4661
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4736
4662
  /*
4737
4663
  * Copyright (c) Microsoft Corporation. All rights reserved.
4738
4664
  * Licensed under the MIT License.
@@ -4742,7 +4668,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4742
4668
  response.hasOwnProperty("metadata"));
4743
4669
  }
4744
4670
 
4745
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4671
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4746
4672
  /*
4747
4673
  * Copyright (c) Microsoft Corporation. All rights reserved.
4748
4674
  * Licensed under the MIT License.
@@ -4752,7 +4678,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4752
4678
  response.hasOwnProperty("error_description"));
4753
4679
  }
4754
4680
 
4755
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4681
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
4756
4682
  /*
4757
4683
  * Copyright (c) Microsoft Corporation. All rights reserved.
4758
4684
  * Licensed under the MIT License.
@@ -4910,6 +4836,7 @@ const PerformanceEvents = {
4910
4836
  */
4911
4837
  InitializeSilentRequest: "initializeSilentRequest",
4912
4838
  InitializeClientApplication: "initializeClientApplication",
4839
+ InitializeCache: "initializeCache",
4913
4840
  /**
4914
4841
  * Helper function in SilentIframeClient class (msal-browser).
4915
4842
  */
@@ -4987,6 +4914,8 @@ const PerformanceEvents = {
4987
4914
  */
4988
4915
  ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
4989
4916
  CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
4917
+ ImportExistingCache: "importExistingCache",
4918
+ SetUserData: "setUserData",
4990
4919
  /**
4991
4920
  * Crypto Operations
4992
4921
  */
@@ -4995,9 +4924,15 @@ const PerformanceEvents = {
4995
4924
  GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
4996
4925
  Sha256Digest: "sha256Digest",
4997
4926
  GetRandomValues: "getRandomValues",
4927
+ GenerateHKDF: "generateHKDF",
4928
+ GenerateBaseKey: "generateBaseKey",
4929
+ Base64Decode: "base64Decode",
4930
+ UrlEncodeArr: "urlEncodeArr",
4931
+ Encrypt: "encrypt",
4932
+ Decrypt: "decrypt",
4998
4933
  };
4999
4934
 
5000
- /*! @azure/msal-common v14.16.0 2024-11-19 */
4935
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
5001
4936
  /*
5002
4937
  * Copyright (c) Microsoft Corporation. All rights reserved.
5003
4938
  * Licensed under the MIT License.
@@ -5093,7 +5028,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5093
5028
  };
5094
5029
  };
5095
5030
 
5096
- /*! @azure/msal-common v14.16.0 2024-11-19 */
5031
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
5097
5032
 
5098
5033
  /*
5099
5034
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5202,7 +5137,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5202
5137
  },
5203
5138
  };
5204
5139
 
5205
- /*! @azure/msal-common v14.16.0 2024-11-19 */
5140
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
5206
5141
 
5207
5142
  /*
5208
5143
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6041,7 +5976,7 @@ function buildStaticAuthorityOptions(authOptions) {
6041
5976
  };
6042
5977
  }
6043
5978
 
6044
- /*! @azure/msal-common v14.16.0 2024-11-19 */
5979
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6045
5980
 
6046
5981
  /*
6047
5982
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6072,7 +6007,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6072
6007
  }
6073
6008
  }
6074
6009
 
6075
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6010
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6076
6011
 
6077
6012
  /*
6078
6013
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6091,7 +6026,7 @@ class ServerError extends AuthError {
6091
6026
  }
6092
6027
  }
6093
6028
 
6094
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6029
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6095
6030
 
6096
6031
  /*
6097
6032
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6189,7 +6124,7 @@ class ThrottlingUtils {
6189
6124
  }
6190
6125
  }
6191
6126
 
6192
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6127
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6193
6128
 
6194
6129
  /*
6195
6130
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6209,7 +6144,7 @@ class NetworkError extends AuthError {
6209
6144
  }
6210
6145
  }
6211
6146
 
6212
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6147
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6213
6148
 
6214
6149
  /*
6215
6150
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6359,7 +6294,7 @@ class BaseClient {
6359
6294
  }
6360
6295
  }
6361
6296
 
6362
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6297
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6363
6298
  /*
6364
6299
  * Copyright (c) Microsoft Corporation. All rights reserved.
6365
6300
  * Licensed under the MIT License.
@@ -6385,7 +6320,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6385
6320
  refreshTokenExpired: refreshTokenExpired
6386
6321
  });
6387
6322
 
6388
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6323
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6389
6324
 
6390
6325
  /*
6391
6326
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6473,7 +6408,7 @@ function createInteractionRequiredAuthError(errorCode) {
6473
6408
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6474
6409
  }
6475
6410
 
6476
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6411
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6477
6412
 
6478
6413
  /*
6479
6414
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6545,7 +6480,7 @@ class ProtocolUtils {
6545
6480
  }
6546
6481
  }
6547
6482
 
6548
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6483
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6549
6484
 
6550
6485
  /*
6551
6486
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6629,7 +6564,7 @@ class PopTokenGenerator {
6629
6564
  }
6630
6565
  }
6631
6566
 
6632
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6567
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6633
6568
  /*
6634
6569
  * Copyright (c) Microsoft Corporation. All rights reserved.
6635
6570
  * Licensed under the MIT License.
@@ -6656,7 +6591,7 @@ class PopTokenGenerator {
6656
6591
  }
6657
6592
  }
6658
6593
 
6659
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6594
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
6660
6595
 
6661
6596
  /*
6662
6597
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6816,13 +6751,13 @@ class ResponseHandler {
6816
6751
  !forceCacheRefreshTokenResponse &&
6817
6752
  cacheRecord.account) {
6818
6753
  const key = cacheRecord.account.generateAccountKey();
6819
- const account = this.cacheStorage.getAccount(key, this.logger);
6754
+ const account = this.cacheStorage.getAccount(key);
6820
6755
  if (!account) {
6821
6756
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
6822
6757
  return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
6823
6758
  }
6824
6759
  }
6825
- await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
6760
+ await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, request.storeInCache);
6826
6761
  }
6827
6762
  finally {
6828
6763
  if (this.persistencePlugin &&
@@ -7008,7 +6943,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7008
6943
  });
7009
6944
  let cachedAccount = null;
7010
6945
  if (baseAccountKey) {
7011
- cachedAccount = cacheStorage.getAccount(baseAccountKey, logger);
6946
+ cachedAccount = cacheStorage.getAccount(baseAccountKey);
7012
6947
  }
7013
6948
  const baseAccount = cachedAccount ||
7014
6949
  AccountEntity.createAccount({
@@ -7033,7 +6968,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7033
6968
  return baseAccount;
7034
6969
  }
7035
6970
 
7036
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6971
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
7037
6972
  /*
7038
6973
  * Copyright (c) Microsoft Corporation. All rights reserved.
7039
6974
  * Licensed under the MIT License.
@@ -7051,7 +6986,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
7051
6986
  }
7052
6987
  }
7053
6988
 
7054
- /*! @azure/msal-common v14.16.0 2024-11-19 */
6989
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
7055
6990
 
7056
6991
  /*
7057
6992
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7425,7 +7360,7 @@ class AuthorizationCodeClient extends BaseClient {
7425
7360
  });
7426
7361
  }
7427
7362
  this.addExtraQueryParams(request, parameterBuilder);
7428
- if (request.nativeBroker) {
7363
+ if (request.platformBroker) {
7429
7364
  // signal ests that this is a WAM call
7430
7365
  parameterBuilder.addNativeBroker();
7431
7366
  // pass the req_cnf for POP
@@ -7493,7 +7428,7 @@ class AuthorizationCodeClient extends BaseClient {
7493
7428
  }
7494
7429
  }
7495
7430
 
7496
- /*! @azure/msal-common v14.16.0 2024-11-19 */
7431
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
7497
7432
 
7498
7433
  /*
7499
7434
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7713,7 +7648,7 @@ class RefreshTokenClient extends BaseClient {
7713
7648
  }
7714
7649
  }
7715
7650
 
7716
- /*! @azure/msal-common v14.16.0 2024-11-19 */
7651
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
7717
7652
 
7718
7653
  /*
7719
7654
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7849,7 +7784,7 @@ class SilentFlowClient extends BaseClient {
7849
7784
  }
7850
7785
  }
7851
7786
 
7852
- /*! @azure/msal-common v14.16.0 2024-11-19 */
7787
+ /*! @azure/msal-common v15.0.2 2025-01-22 */
7853
7788
 
7854
7789
  /*
7855
7790
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8304,7 +8239,7 @@ var internals = /*#__PURE__*/Object.freeze({
8304
8239
  const AUTHORIZATION_HEADER_NAME = "Authorization";
8305
8240
  const METADATA_HEADER_NAME = "Metadata";
8306
8241
  const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
8307
- const SERVICE_FABRIC_SECRET_HEADER_NAME = "secret";
8242
+ const ML_AND_SF_SECRET_HEADER_NAME = "secret";
8308
8243
  const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
8309
8244
  const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
8310
8245
  const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
@@ -8320,6 +8255,7 @@ const ManagedIdentityEnvironmentVariableNames = {
8320
8255
  IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT",
8321
8256
  IMDS_ENDPOINT: "IMDS_ENDPOINT",
8322
8257
  MSI_ENDPOINT: "MSI_ENDPOINT",
8258
+ MSI_SECRET: "MSI_SECRET",
8323
8259
  };
8324
8260
  /**
8325
8261
  * Managed Identity Source Names
@@ -8331,6 +8267,7 @@ const ManagedIdentitySourceNames = {
8331
8267
  CLOUD_SHELL: "CloudShell",
8332
8268
  DEFAULT_TO_IMDS: "DefaultToImds",
8333
8269
  IMDS: "Imds",
8270
+ MACHINE_LEARNING: "MachineLearning",
8334
8271
  SERVICE_FABRIC: "ServiceFabric",
8335
8272
  };
8336
8273
  /**
@@ -9530,23 +9467,12 @@ class NodeStorage extends CacheManager {
9530
9467
  };
9531
9468
  return tokenKeys;
9532
9469
  }
9533
- /**
9534
- * fetch the account entity
9535
- * @param accountKey - lookup key to fetch cache type AccountEntity
9536
- */
9537
- getAccount(accountKey) {
9538
- const accountEntity = this.getCachedAccountEntity(accountKey);
9539
- if (accountEntity && AccountEntity.isAccountEntity(accountEntity)) {
9540
- return this.updateOutdatedCachedAccount(accountKey, accountEntity);
9541
- }
9542
- return null;
9543
- }
9544
9470
  /**
9545
9471
  * Reads account from cache, builds it into an account entity and returns it.
9546
9472
  * @param accountKey - lookup key to fetch cache type AccountEntity
9547
9473
  * @returns
9548
9474
  */
9549
- getCachedAccountEntity(accountKey) {
9475
+ getAccount(accountKey) {
9550
9476
  const cachedAccount = this.getItem(accountKey);
9551
9477
  return cachedAccount
9552
9478
  ? Object.assign(new AccountEntity(), this.getItem(accountKey))
@@ -9556,7 +9482,7 @@ class NodeStorage extends CacheManager {
9556
9482
  * set account entity
9557
9483
  * @param account - cache value to be set of type AccountEntity
9558
9484
  */
9559
- setAccount(account) {
9485
+ async setAccount(account) {
9560
9486
  const accountKey = account.generateAccountKey();
9561
9487
  this.setItem(accountKey, account);
9562
9488
  }
@@ -9575,7 +9501,7 @@ class NodeStorage extends CacheManager {
9575
9501
  * set idToken credential
9576
9502
  * @param idToken - cache value to be set of type IdTokenEntity
9577
9503
  */
9578
- setIdTokenCredential(idToken) {
9504
+ async setIdTokenCredential(idToken) {
9579
9505
  const idTokenKey = generateCredentialKey(idToken);
9580
9506
  this.setItem(idTokenKey, idToken);
9581
9507
  }
@@ -9594,7 +9520,7 @@ class NodeStorage extends CacheManager {
9594
9520
  * set accessToken credential
9595
9521
  * @param accessToken - cache value to be set of type AccessTokenEntity
9596
9522
  */
9597
- setAccessTokenCredential(accessToken) {
9523
+ async setAccessTokenCredential(accessToken) {
9598
9524
  const accessTokenKey = generateCredentialKey(accessToken);
9599
9525
  this.setItem(accessTokenKey, accessToken);
9600
9526
  }
@@ -9613,7 +9539,7 @@ class NodeStorage extends CacheManager {
9613
9539
  * set refreshToken credential
9614
9540
  * @param refreshToken - cache value to be set of type RefreshTokenEntity
9615
9541
  */
9616
- setRefreshTokenCredential(refreshToken) {
9542
+ async setRefreshTokenCredential(refreshToken) {
9617
9543
  const refreshTokenKey = generateCredentialKey(refreshToken);
9618
9544
  this.setItem(refreshTokenKey, refreshToken);
9619
9545
  }
@@ -10208,7 +10134,7 @@ class ClientAssertion {
10208
10134
 
10209
10135
  /* eslint-disable header/header */
10210
10136
  const name = "@azure/msal-node";
10211
- const version = "2.16.2";
10137
+ const version = "3.1.0";
10212
10138
 
10213
10139
  /*
10214
10140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11484,8 +11410,7 @@ class OnBehalfOfClient extends BaseClient {
11484
11410
  * Distinguish between Bearer and PoP/SSH token cache types
11485
11411
  * Cast to lowercase to handle "bearer" from ADFS
11486
11412
  */
11487
- const credentialType = authScheme &&
11488
- authScheme.toLowerCase() !==
11413
+ const credentialType = authScheme.toLowerCase() !==
11489
11414
  AuthenticationScheme.BEARER.toLowerCase()
11490
11415
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
11491
11416
  : CredentialType.ACCESS_TOKEN;
@@ -11606,7 +11531,44 @@ class ConfidentialClientApplication extends ClientApplication {
11606
11531
  */
11607
11532
  constructor(configuration) {
11608
11533
  super(configuration);
11609
- this.setClientCredential();
11534
+ const clientSecretNotEmpty = !!this.config.auth.clientSecret;
11535
+ const clientAssertionNotEmpty = !!this.config.auth.clientAssertion;
11536
+ const certificateNotEmpty = (!!this.config.auth.clientCertificate?.thumbprint ||
11537
+ !!this.config.auth.clientCertificate?.thumbprintSha256) &&
11538
+ !!this.config.auth.clientCertificate?.privateKey;
11539
+ /*
11540
+ * If app developer configures this callback, they don't need a credential
11541
+ * i.e. AzureSDK can get token from Managed Identity without a cert / secret
11542
+ */
11543
+ if (this.appTokenProvider) {
11544
+ return;
11545
+ }
11546
+ // Check that at most one credential is set on the application
11547
+ if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
11548
+ (clientAssertionNotEmpty && certificateNotEmpty) ||
11549
+ (clientSecretNotEmpty && certificateNotEmpty)) {
11550
+ throw createClientAuthError(invalidClientCredential);
11551
+ }
11552
+ if (this.config.auth.clientSecret) {
11553
+ this.clientSecret = this.config.auth.clientSecret;
11554
+ return;
11555
+ }
11556
+ if (this.config.auth.clientAssertion) {
11557
+ this.developerProvidedClientAssertion =
11558
+ this.config.auth.clientAssertion;
11559
+ return;
11560
+ }
11561
+ if (!certificateNotEmpty) {
11562
+ throw createClientAuthError(invalidClientCredential);
11563
+ }
11564
+ else {
11565
+ this.clientAssertion = !!this.config.auth.clientCertificate
11566
+ .thumbprintSha256
11567
+ ? ClientAssertion.fromCertificateWithSha256Thumbprint(this.config.auth.clientCertificate.thumbprintSha256, this.config.auth.clientCertificate.privateKey, this.config.auth.clientCertificate.x5c)
11568
+ : ClientAssertion.fromCertificate(
11569
+ // guaranteed to be a string, due to prior error checking in this function
11570
+ this.config.auth.clientCertificate.thumbprint, this.config.auth.clientCertificate.privateKey, this.config.auth.clientCertificate.x5c);
11571
+ }
11610
11572
  this.appTokenProvider = undefined;
11611
11573
  }
11612
11574
  /**
@@ -11716,46 +11678,6 @@ class ConfidentialClientApplication extends ClientApplication {
11716
11678
  throw e;
11717
11679
  }
11718
11680
  }
11719
- setClientCredential() {
11720
- const clientSecretNotEmpty = !!this.config.auth.clientSecret;
11721
- const clientAssertionNotEmpty = !!this.config.auth.clientAssertion;
11722
- const certificateNotEmpty = (!!this.config.auth.clientCertificate?.thumbprint ||
11723
- !!this.config.auth.clientCertificate?.thumbprintSha256) &&
11724
- !!this.config.auth.clientCertificate?.privateKey;
11725
- /*
11726
- * If app developer configures this callback, they don't need a credential
11727
- * i.e. AzureSDK can get token from Managed Identity without a cert / secret
11728
- */
11729
- if (this.appTokenProvider) {
11730
- return;
11731
- }
11732
- // Check that at most one credential is set on the application
11733
- if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
11734
- (clientAssertionNotEmpty && certificateNotEmpty) ||
11735
- (clientSecretNotEmpty && certificateNotEmpty)) {
11736
- throw createClientAuthError(invalidClientCredential);
11737
- }
11738
- if (this.config.auth.clientSecret) {
11739
- this.clientSecret = this.config.auth.clientSecret;
11740
- return;
11741
- }
11742
- if (this.config.auth.clientAssertion) {
11743
- this.developerProvidedClientAssertion =
11744
- this.config.auth.clientAssertion;
11745
- return;
11746
- }
11747
- if (!certificateNotEmpty) {
11748
- throw createClientAuthError(invalidClientCredential);
11749
- }
11750
- else {
11751
- this.clientAssertion = !!this.config.auth.clientCertificate
11752
- .thumbprintSha256
11753
- ? ClientAssertion.fromCertificateWithSha256Thumbprint(this.config.auth.clientCertificate.thumbprintSha256, this.config.auth.clientCertificate.privateKey, this.config.auth.clientCertificate.x5c)
11754
- : ClientAssertion.fromCertificate(
11755
- // guaranteed to be a string, due to prior error checking in this function
11756
- this.config.auth.clientCertificate.thumbprint, this.config.auth.clientCertificate.privateKey, this.config.auth.clientCertificate.x5c);
11757
- }
11758
- }
11759
11681
  }
11760
11682
 
11761
11683
  /*
@@ -11768,7 +11690,8 @@ class ConfidentialClientApplication extends ClientApplication {
11768
11690
  const ManagedIdentityUserAssignedIdQueryParameterNames = {
11769
11691
  MANAGED_IDENTITY_CLIENT_ID: "client_id",
11770
11692
  MANAGED_IDENTITY_OBJECT_ID: "object_id",
11771
- MANAGED_IDENTITY_RESOURCE_ID: "mi_res_id",
11693
+ MANAGED_IDENTITY_RESOURCE_ID_IMDS: "msi_res_id",
11694
+ MANAGED_IDENTITY_RESOURCE_ID_NON_IMDS: "mi_res_id",
11772
11695
  };
11773
11696
  class BaseManagedIdentitySource {
11774
11697
  constructor(logger, nodeStorage, networkClient, cryptoProvider) {
@@ -11855,14 +11778,16 @@ class BaseManagedIdentitySource {
11855
11778
  // caches the token
11856
11779
  return responseHandler.handleServerTokenResponse(serverTokenResponse, fakeAuthority, reqTimestamp, managedIdentityRequest);
11857
11780
  }
11858
- getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityIdType) {
11781
+ getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityIdType, imds) {
11859
11782
  switch (managedIdentityIdType) {
11860
11783
  case ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID:
11861
11784
  this.logger.info("[Managed Identity] Adding user assigned client id to the request.");
11862
11785
  return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_CLIENT_ID;
11863
11786
  case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
11864
11787
  this.logger.info("[Managed Identity] Adding user assigned resource id to the request.");
11865
- return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_RESOURCE_ID;
11788
+ return imds
11789
+ ? ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_RESOURCE_ID_IMDS
11790
+ : ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_RESOURCE_ID_NON_IMDS;
11866
11791
  case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
11867
11792
  this.logger.info("[Managed Identity] Adding user assigned object id to the request.");
11868
11793
  return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_OBJECT_ID;
@@ -12186,7 +12111,8 @@ class Imds extends BaseManagedIdentitySource {
12186
12111
  request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12187
12112
  resource;
12188
12113
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12189
- request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
12114
+ request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, true // indicates source is IMDS
12115
+ )] = managedIdentityId.id;
12190
12116
  }
12191
12117
  // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
12192
12118
  return request;
@@ -12234,8 +12160,7 @@ class ServiceFabric extends BaseManagedIdentitySource {
12234
12160
  }
12235
12161
  createRequest(resource, managedIdentityId) {
12236
12162
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
12237
- request.headers[SERVICE_FABRIC_SECRET_HEADER_NAME] =
12238
- this.identityHeader;
12163
+ request.headers[ML_AND_SF_SECRET_HEADER_NAME] = this.identityHeader;
12239
12164
  request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12240
12165
  SERVICE_FABRIC_MSI_API_VERSION;
12241
12166
  request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
@@ -12248,6 +12173,49 @@ class ServiceFabric extends BaseManagedIdentitySource {
12248
12173
  }
12249
12174
  }
12250
12175
 
12176
+ /*
12177
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12178
+ * Licensed under the MIT License.
12179
+ */
12180
+ const MACHINE_LEARNING_MSI_API_VERSION = "2017-09-01";
12181
+ class MachineLearning extends BaseManagedIdentitySource {
12182
+ constructor(logger, nodeStorage, networkClient, cryptoProvider, msiEndpoint, secret) {
12183
+ super(logger, nodeStorage, networkClient, cryptoProvider);
12184
+ this.msiEndpoint = msiEndpoint;
12185
+ this.secret = secret;
12186
+ }
12187
+ static getEnvironmentVariables() {
12188
+ const msiEndpoint = process.env[ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT];
12189
+ const secret = process.env[ManagedIdentityEnvironmentVariableNames.MSI_SECRET];
12190
+ return [msiEndpoint, secret];
12191
+ }
12192
+ static tryCreate(logger, nodeStorage, networkClient, cryptoProvider) {
12193
+ const [msiEndpoint, secret] = MachineLearning.getEnvironmentVariables();
12194
+ // if either of the MSI endpoint or MSI secret variables are undefined, this MSI provider is unavailable.
12195
+ if (!msiEndpoint || !secret) {
12196
+ logger.info(`[Managed Identity] ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.MSI_SECRET}' environment variables are not defined.`);
12197
+ return null;
12198
+ }
12199
+ const validatedMsiEndpoint = MachineLearning.getValidatedEnvVariableUrlString(ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT, msiEndpoint, ManagedIdentitySourceNames.MACHINE_LEARNING, logger);
12200
+ logger.info(`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity.`);
12201
+ return new MachineLearning(logger, nodeStorage, networkClient, cryptoProvider, msiEndpoint, secret);
12202
+ }
12203
+ createRequest(resource, managedIdentityId) {
12204
+ const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.msiEndpoint);
12205
+ request.headers[METADATA_HEADER_NAME] = "true";
12206
+ request.headers[ML_AND_SF_SECRET_HEADER_NAME] = this.secret;
12207
+ request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12208
+ MACHINE_LEARNING_MSI_API_VERSION;
12209
+ request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12210
+ resource;
12211
+ if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12212
+ request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
12213
+ }
12214
+ // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
12215
+ return request;
12216
+ }
12217
+ }
12218
+
12251
12219
  /*
12252
12220
  * Copyright (c) Microsoft Corporation. All rights reserved.
12253
12221
  * Licensed under the MIT License.
@@ -12285,11 +12253,13 @@ class ManagedIdentityClient {
12285
12253
  ? ManagedIdentitySourceNames.SERVICE_FABRIC
12286
12254
  : this.allEnvironmentVariablesAreDefined(AppService.getEnvironmentVariables())
12287
12255
  ? ManagedIdentitySourceNames.APP_SERVICE
12288
- : this.allEnvironmentVariablesAreDefined(CloudShell.getEnvironmentVariables())
12289
- ? ManagedIdentitySourceNames.CLOUD_SHELL
12290
- : this.allEnvironmentVariablesAreDefined(AzureArc.getEnvironmentVariables())
12291
- ? ManagedIdentitySourceNames.AZURE_ARC
12292
- : ManagedIdentitySourceNames.DEFAULT_TO_IMDS;
12256
+ : this.allEnvironmentVariablesAreDefined(MachineLearning.getEnvironmentVariables())
12257
+ ? ManagedIdentitySourceNames.MACHINE_LEARNING
12258
+ : this.allEnvironmentVariablesAreDefined(CloudShell.getEnvironmentVariables())
12259
+ ? ManagedIdentitySourceNames.CLOUD_SHELL
12260
+ : this.allEnvironmentVariablesAreDefined(AzureArc.getEnvironmentVariables())
12261
+ ? ManagedIdentitySourceNames.AZURE_ARC
12262
+ : ManagedIdentitySourceNames.DEFAULT_TO_IMDS;
12293
12263
  return ManagedIdentityClient.sourceName;
12294
12264
  }
12295
12265
  /**
@@ -12299,6 +12269,7 @@ class ManagedIdentityClient {
12299
12269
  selectManagedIdentitySource(logger, nodeStorage, networkClient, cryptoProvider, managedIdentityId) {
12300
12270
  const source = ServiceFabric.tryCreate(logger, nodeStorage, networkClient, cryptoProvider, managedIdentityId) ||
12301
12271
  AppService.tryCreate(logger, nodeStorage, networkClient, cryptoProvider) ||
12272
+ MachineLearning.tryCreate(logger, nodeStorage, networkClient, cryptoProvider) ||
12302
12273
  CloudShell.tryCreate(logger, nodeStorage, networkClient, cryptoProvider, managedIdentityId) ||
12303
12274
  AzureArc.tryCreate(logger, nodeStorage, networkClient, cryptoProvider, managedIdentityId) ||
12304
12275
  Imds.tryCreate(logger, nodeStorage, networkClient, cryptoProvider);
@@ -12461,7 +12432,6 @@ exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessag
12461
12432
  exports.Logger = Logger;
12462
12433
  exports.ManagedIdentityApplication = ManagedIdentityApplication;
12463
12434
  exports.ManagedIdentitySourceNames = ManagedIdentitySourceNames;
12464
- exports.NodeStorage = NodeStorage;
12465
12435
  exports.OnBehalfOfClient = OnBehalfOfClient;
12466
12436
  exports.PromptValue = PromptValue;
12467
12437
  exports.ProtocolMode = ProtocolMode;