@azure/msal-browser 3.7.1 → 3.7.2-alpha.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/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  7. package/dist/cache/BrowserCacheManager.mjs +1 -1
  8. package/dist/cache/BrowserStorage.mjs +1 -1
  9. package/dist/cache/CryptoKeyStore.mjs +1 -1
  10. package/dist/cache/DatabaseStorage.mjs +1 -1
  11. package/dist/cache/MemoryStorage.mjs +1 -1
  12. package/dist/cache/TokenCache.mjs +1 -1
  13. package/dist/config/Configuration.mjs +1 -1
  14. package/dist/controllers/ControllerFactory.mjs +1 -1
  15. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  16. package/dist/controllers/StandardController.mjs +1 -1
  17. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  18. package/dist/crypto/BrowserCrypto.d.ts +6 -3
  19. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  20. package/dist/crypto/BrowserCrypto.mjs +54 -5
  21. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  22. package/dist/crypto/CryptoOps.mjs +1 -1
  23. package/dist/crypto/PkceGenerator.mjs +1 -1
  24. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  25. package/dist/encode/Base64Decode.mjs +1 -1
  26. package/dist/encode/Base64Encode.mjs +1 -1
  27. package/dist/error/BrowserAuthError.mjs +1 -1
  28. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  29. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  30. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  31. package/dist/error/NativeAuthError.mjs +1 -1
  32. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  33. package/dist/error/NestedAppAuthError.mjs +1 -1
  34. package/dist/event/EventHandler.mjs +1 -1
  35. package/dist/event/EventMessage.mjs +1 -1
  36. package/dist/event/EventType.mjs +1 -1
  37. package/dist/index.mjs +1 -1
  38. package/dist/interaction_client/BaseInteractionClient.d.ts +5 -4
  39. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  40. package/dist/interaction_client/BaseInteractionClient.mjs +19 -21
  41. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  42. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  43. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  44. package/dist/interaction_client/NativeInteractionClient.mjs +3 -2
  45. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  46. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  47. package/dist/interaction_client/PopupClient.mjs +4 -3
  48. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  49. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  50. package/dist/interaction_client/RedirectClient.mjs +4 -3
  51. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  52. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  53. package/dist/interaction_client/SilentAuthCodeClient.mjs +2 -2
  54. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  55. package/dist/interaction_client/SilentCacheClient.d.ts +1 -1
  56. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  57. package/dist/interaction_client/SilentCacheClient.mjs +5 -5
  58. package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
  59. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  60. package/dist/interaction_client/SilentIframeClient.mjs +2 -2
  61. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  62. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  63. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  64. package/dist/interaction_client/SilentRefreshClient.mjs +5 -5
  65. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  66. package/dist/interaction_client/StandardInteractionClient.d.ts +3 -9
  67. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  68. package/dist/interaction_client/StandardInteractionClient.mjs +6 -29
  69. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  70. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  71. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  72. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  73. package/dist/naa/BridgeError.mjs +1 -1
  74. package/dist/naa/BridgeProxy.mjs +1 -1
  75. package/dist/naa/BridgeStatusCode.mjs +1 -1
  76. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  77. package/dist/navigation/NavigationClient.mjs +1 -1
  78. package/dist/network/FetchClient.mjs +1 -1
  79. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  80. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  81. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
  82. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  83. package/dist/packageMetadata.d.ts +1 -1
  84. package/dist/packageMetadata.d.ts.map +1 -1
  85. package/dist/packageMetadata.mjs +2 -2
  86. package/dist/response/ResponseHandler.mjs +1 -1
  87. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  88. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  89. package/dist/utils/BrowserConstants.mjs +1 -1
  90. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  91. package/dist/utils/BrowserUtils.mjs +1 -1
  92. package/lib/msal-browser.cjs +209 -187
  93. package/lib/msal-browser.cjs.map +1 -1
  94. package/lib/msal-browser.js +209 -187
  95. package/lib/msal-browser.js.map +1 -1
  96. package/lib/msal-browser.min.js +66 -65
  97. package/package.json +4 -4
  98. package/src/crypto/BrowserCrypto.ts +57 -4
  99. package/src/interaction_client/BaseInteractionClient.ts +40 -31
  100. package/src/interaction_client/NativeInteractionClient.ts +6 -1
  101. package/src/interaction_client/PopupClient.ts +8 -2
  102. package/src/interaction_client/RedirectClient.ts +8 -2
  103. package/src/interaction_client/SilentAuthCodeClient.ts +6 -1
  104. package/src/interaction_client/SilentCacheClient.ts +6 -4
  105. package/src/interaction_client/SilentIframeClient.ts +2 -1
  106. package/src/interaction_client/SilentRefreshClient.ts +7 -4
  107. package/src/interaction_client/StandardInteractionClient.ts +11 -57
  108. package/src/packageMetadata.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.7.1 2024-01-23 */
1
+ /*! @azure/msal-browser v3.7.2-alpha.0 2024-01-30 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v14.6.1 2024-01-23 */
9
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -301,7 +301,7 @@
301
301
  Pop: "pop",
302
302
  };
303
303
 
304
- /*! @azure/msal-common v14.6.1 2024-01-23 */
304
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
305
305
  /*
306
306
  * Copyright (c) Microsoft Corporation. All rights reserved.
307
307
  * Licensed under the MIT License.
@@ -318,7 +318,7 @@
318
318
  unexpectedError: unexpectedError
319
319
  });
320
320
 
321
- /*! @azure/msal-common v14.6.1 2024-01-23 */
321
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
322
322
 
323
323
  /*
324
324
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -367,7 +367,7 @@
367
367
  : AuthErrorMessages[code]);
368
368
  }
369
369
 
370
- /*! @azure/msal-common v14.6.1 2024-01-23 */
370
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
371
371
  /*
372
372
  * Copyright (c) Microsoft Corporation. All rights reserved.
373
373
  * Licensed under the MIT License.
@@ -465,7 +465,7 @@
465
465
  userTimeoutReached: userTimeoutReached
466
466
  });
467
467
 
468
- /*! @azure/msal-common v14.6.1 2024-01-23 */
468
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
469
469
 
470
470
  /*
471
471
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -717,7 +717,7 @@
717
717
  return new ClientAuthError(errorCode, additionalMessage);
718
718
  }
719
719
 
720
- /*! @azure/msal-common v14.6.1 2024-01-23 */
720
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
721
721
 
722
722
  /*
723
723
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -750,7 +750,7 @@
750
750
  },
751
751
  };
752
752
 
753
- /*! @azure/msal-common v14.6.1 2024-01-23 */
753
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
754
754
 
755
755
  /*
756
756
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -941,12 +941,12 @@
941
941
  }
942
942
  }
943
943
 
944
- /*! @azure/msal-common v14.6.1 2024-01-23 */
944
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
945
945
  /* eslint-disable header/header */
946
946
  const name$1 = "@azure/msal-common";
947
- const version$1 = "14.6.1";
947
+ const version$1 = "14.6.2-alpha.0";
948
948
 
949
- /*! @azure/msal-common v14.6.1 2024-01-23 */
949
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
950
950
  /*
951
951
  * Copyright (c) Microsoft Corporation. All rights reserved.
952
952
  * Licensed under the MIT License.
@@ -966,7 +966,7 @@
966
966
  AzureUsGovernment: "https://login.microsoftonline.us",
967
967
  };
968
968
 
969
- /*! @azure/msal-common v14.6.1 2024-01-23 */
969
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
970
970
 
971
971
  /*
972
972
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1027,54 +1027,44 @@
1027
1027
  }
1028
1028
  }
1029
1029
 
1030
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1030
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1031
1031
  /*
1032
1032
  * Copyright (c) Microsoft Corporation. All rights reserved.
1033
1033
  * Licensed under the MIT License.
1034
1034
  */
1035
1035
  /**
1036
- * Utility class which exposes functions for managing date and time operations.
1036
+ * Utility functions for managing date and time operations.
1037
1037
  */
1038
- class TimeUtils {
1039
- /**
1040
- * return the current time in Unix time (seconds).
1041
- */
1042
- static nowSeconds() {
1043
- // Date.getTime() returns in milliseconds.
1044
- return Math.round(new Date().getTime() / 1000.0);
1045
- }
1046
- /**
1047
- * check if a token is expired based on given UTC time in seconds.
1048
- * @param expiresOn
1049
- */
1050
- static isTokenExpired(expiresOn, offset) {
1051
- // check for access token expiry
1052
- const expirationSec = Number(expiresOn) || 0;
1053
- const offsetCurrentTimeSec = TimeUtils.nowSeconds() + offset;
1054
- // If current time + offset is greater than token expiration time, then token is expired.
1055
- return offsetCurrentTimeSec > expirationSec;
1056
- }
1057
- /**
1058
- * If the current time is earlier than the time that a token was cached at, we must discard the token
1059
- * i.e. The system clock was turned back after acquiring the cached token
1060
- * @param cachedAt
1061
- * @param offset
1062
- */
1063
- static wasClockTurnedBack(cachedAt) {
1064
- const cachedAtSec = Number(cachedAt);
1065
- return cachedAtSec > TimeUtils.nowSeconds();
1066
- }
1067
- /**
1068
- * Waits for t number of milliseconds
1069
- * @param t number
1070
- * @param value T
1071
- */
1072
- static delay(t, value) {
1073
- return new Promise((resolve) => setTimeout(() => resolve(value), t));
1074
- }
1038
+ /**
1039
+ * return the current time in Unix time (seconds).
1040
+ */
1041
+ function nowSeconds() {
1042
+ // Date.getTime() returns in milliseconds.
1043
+ return Math.round(new Date().getTime() / 1000.0);
1044
+ }
1045
+ /**
1046
+ * check if a token is expired based on given UTC time in seconds.
1047
+ * @param expiresOn
1048
+ */
1049
+ function isTokenExpired(expiresOn, offset) {
1050
+ // check for access token expiry
1051
+ const expirationSec = Number(expiresOn) || 0;
1052
+ const offsetCurrentTimeSec = nowSeconds() + offset;
1053
+ // If current time + offset is greater than token expiration time, then token is expired.
1054
+ return offsetCurrentTimeSec > expirationSec;
1055
+ }
1056
+ /**
1057
+ * If the current time is earlier than the time that a token was cached at, we must discard the token
1058
+ * i.e. The system clock was turned back after acquiring the cached token
1059
+ * @param cachedAt
1060
+ * @param offset
1061
+ */
1062
+ function wasClockTurnedBack(cachedAt) {
1063
+ const cachedAtSec = Number(cachedAt);
1064
+ return cachedAtSec > nowSeconds();
1075
1065
  }
1076
1066
 
1077
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1067
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1078
1068
 
1079
1069
  /*
1080
1070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1132,7 +1122,7 @@
1132
1122
  homeAccountId: homeAccountId,
1133
1123
  credentialType: CredentialType.ACCESS_TOKEN,
1134
1124
  secret: accessToken,
1135
- cachedAt: TimeUtils.nowSeconds().toString(),
1125
+ cachedAt: nowSeconds().toString(),
1136
1126
  expiresOn: expiresOn.toString(),
1137
1127
  extendedExpiresOn: extExpiresOn.toString(),
1138
1128
  environment: environment,
@@ -1376,7 +1366,7 @@
1376
1366
  * Reset the exiresAt value
1377
1367
  */
1378
1368
  function generateAuthorityMetadataExpiresAt() {
1379
- return (TimeUtils.nowSeconds() +
1369
+ return (nowSeconds() +
1380
1370
  AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS);
1381
1371
  }
1382
1372
  function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
@@ -1398,10 +1388,10 @@
1398
1388
  * Returns whether or not the data needs to be refreshed
1399
1389
  */
1400
1390
  function isAuthorityMetadataExpired(metadata) {
1401
- return metadata.expiresAt <= TimeUtils.nowSeconds();
1391
+ return metadata.expiresAt <= nowSeconds();
1402
1392
  }
1403
1393
 
1404
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1394
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1405
1395
  /*
1406
1396
  * Copyright (c) Microsoft Corporation. All rights reserved.
1407
1397
  * Licensed under the MIT License.
@@ -1455,7 +1445,7 @@
1455
1445
  urlParseError: urlParseError
1456
1446
  });
1457
1447
 
1458
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1448
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1459
1449
 
1460
1450
  /*
1461
1451
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1593,7 +1583,7 @@
1593
1583
  return new ClientConfigurationError(errorCode);
1594
1584
  }
1595
1585
 
1596
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1586
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1597
1587
  /*
1598
1588
  * Copyright (c) Microsoft Corporation. All rights reserved.
1599
1589
  * Licensed under the MIT License.
@@ -1690,7 +1680,7 @@
1690
1680
  }
1691
1681
  }
1692
1682
 
1693
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1683
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1694
1684
 
1695
1685
  /*
1696
1686
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1890,7 +1880,7 @@
1890
1880
  }
1891
1881
  }
1892
1882
 
1893
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1883
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1894
1884
 
1895
1885
  /*
1896
1886
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1930,7 +1920,7 @@
1930
1920
  };
1931
1921
  }
1932
1922
 
1933
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1923
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1934
1924
  /*
1935
1925
  * Copyright (c) Microsoft Corporation. All rights reserved.
1936
1926
  * Licensed under the MIT License.
@@ -1991,7 +1981,7 @@
1991
1981
  return updatedAccountInfo;
1992
1982
  }
1993
1983
 
1994
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1984
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
1995
1985
  /*
1996
1986
  * Copyright (c) Microsoft Corporation. All rights reserved.
1997
1987
  * Licensed under the MIT License.
@@ -2006,7 +1996,7 @@
2006
1996
  Ciam: 3,
2007
1997
  };
2008
1998
 
2009
- /*! @azure/msal-common v14.6.1 2024-01-23 */
1999
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2010
2000
  /*
2011
2001
  * Copyright (c) Microsoft Corporation. All rights reserved.
2012
2002
  * Licensed under the MIT License.
@@ -2028,7 +2018,7 @@
2028
2018
  return null;
2029
2019
  }
2030
2020
 
2031
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2021
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2032
2022
  /*
2033
2023
  * Copyright (c) Microsoft Corporation. All rights reserved.
2034
2024
  * Licensed under the MIT License.
@@ -2041,7 +2031,7 @@
2041
2031
  OIDC: "OIDC",
2042
2032
  };
2043
2033
 
2044
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2034
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2045
2035
 
2046
2036
  /*
2047
2037
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2288,7 +2278,7 @@
2288
2278
  }
2289
2279
  }
2290
2280
 
2291
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2281
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2292
2282
 
2293
2283
  /*
2294
2284
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2335,7 +2325,7 @@
2335
2325
  return null;
2336
2326
  }
2337
2327
 
2338
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2328
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2339
2329
 
2340
2330
  /*
2341
2331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2499,7 +2489,7 @@
2499
2489
  }
2500
2490
  }
2501
2491
 
2502
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2492
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2503
2493
 
2504
2494
  /*
2505
2495
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2639,7 +2629,7 @@
2639
2629
  return null;
2640
2630
  }
2641
2631
 
2642
- /*! @azure/msal-common v14.6.1 2024-01-23 */
2632
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
2643
2633
 
2644
2634
  /*
2645
2635
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3879,7 +3869,7 @@
3879
3869
  }
3880
3870
  }
3881
3871
 
3882
- /*! @azure/msal-common v14.6.1 2024-01-23 */
3872
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
3883
3873
 
3884
3874
  /*
3885
3875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3979,7 +3969,7 @@
3979
3969
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3980
3970
  }
3981
3971
 
3982
- /*! @azure/msal-common v14.6.1 2024-01-23 */
3972
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
3983
3973
 
3984
3974
  /*
3985
3975
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3996,7 +3986,7 @@
3996
3986
  }
3997
3987
  }
3998
3988
 
3999
- /*! @azure/msal-common v14.6.1 2024-01-23 */
3989
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4000
3990
 
4001
3991
  /*
4002
3992
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4094,7 +4084,7 @@
4094
4084
  }
4095
4085
  }
4096
4086
 
4097
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4087
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4098
4088
 
4099
4089
  /*
4100
4090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4131,7 +4121,7 @@
4131
4121
  }
4132
4122
  }
4133
4123
 
4134
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4124
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4135
4125
  /*
4136
4126
  * Copyright (c) Microsoft Corporation. All rights reserved.
4137
4127
  * Licensed under the MIT License.
@@ -4141,7 +4131,7 @@
4141
4131
  UPN: "UPN",
4142
4132
  };
4143
4133
 
4144
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4134
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4145
4135
  /*
4146
4136
  * Copyright (c) Microsoft Corporation. All rights reserved.
4147
4137
  * Licensed under the MIT License.
@@ -4188,7 +4178,7 @@
4188
4178
  const LOGIN_HINT = "login_hint";
4189
4179
  const DOMAIN_HINT = "domain_hint";
4190
4180
 
4191
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4181
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4192
4182
 
4193
4183
  /*
4194
4184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4272,7 +4262,7 @@
4272
4262
  }
4273
4263
  }
4274
4264
 
4275
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4265
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4276
4266
 
4277
4267
  /*
4278
4268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4656,7 +4646,7 @@
4656
4646
  }
4657
4647
  }
4658
4648
 
4659
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4649
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4660
4650
  /*
4661
4651
  * Copyright (c) Microsoft Corporation. All rights reserved.
4662
4652
  * Licensed under the MIT License.
@@ -4668,7 +4658,7 @@
4668
4658
  response.hasOwnProperty("jwks_uri"));
4669
4659
  }
4670
4660
 
4671
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4661
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4672
4662
  /*
4673
4663
  * Copyright (c) Microsoft Corporation. All rights reserved.
4674
4664
  * Licensed under the MIT License.
@@ -4678,7 +4668,7 @@
4678
4668
  response.hasOwnProperty("metadata"));
4679
4669
  }
4680
4670
 
4681
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4671
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4682
4672
  /*
4683
4673
  * Copyright (c) Microsoft Corporation. All rights reserved.
4684
4674
  * Licensed under the MIT License.
@@ -4688,7 +4678,7 @@
4688
4678
  response.hasOwnProperty("error_description"));
4689
4679
  }
4690
4680
 
4691
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4681
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4692
4682
  /*
4693
4683
  * Copyright (c) Microsoft Corporation. All rights reserved.
4694
4684
  * Licensed under the MIT License.
@@ -4943,7 +4933,7 @@
4943
4933
  "multiMatchedRT",
4944
4934
  ]);
4945
4935
 
4946
- /*! @azure/msal-common v14.6.1 2024-01-23 */
4936
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
4947
4937
  /*
4948
4938
  * Copyright (c) Microsoft Corporation. All rights reserved.
4949
4939
  * Licensed under the MIT License.
@@ -4964,6 +4954,11 @@
4964
4954
  return (...args) => {
4965
4955
  logger.trace(`Executing function ${eventName}`);
4966
4956
  const inProgressEvent = telemetryClient?.startMeasurement(eventName, correlationId);
4957
+ if (correlationId) {
4958
+ // Track number of times this API is called in a single request
4959
+ const eventCount = eventName + "CallCount";
4960
+ telemetryClient?.incrementFields({ [eventCount]: 1 }, correlationId);
4961
+ }
4967
4962
  try {
4968
4963
  const result = callback(...args);
4969
4964
  inProgressEvent?.end({
@@ -5004,6 +4999,11 @@
5004
4999
  return (...args) => {
5005
5000
  logger.trace(`Executing function ${eventName}`);
5006
5001
  const inProgressEvent = telemetryClient?.startMeasurement(eventName, correlationId);
5002
+ if (correlationId) {
5003
+ // Track number of times this API is called in a single request
5004
+ const eventCount = eventName + "CallCount";
5005
+ telemetryClient?.incrementFields({ [eventCount]: 1 }, correlationId);
5006
+ }
5007
5007
  telemetryClient?.setPreQueueTime(eventName, correlationId);
5008
5008
  return callback(...args)
5009
5009
  .then((response) => {
@@ -5029,7 +5029,7 @@
5029
5029
  };
5030
5030
  };
5031
5031
 
5032
- /*! @azure/msal-common v14.6.1 2024-01-23 */
5032
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
5033
5033
 
5034
5034
  /*
5035
5035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5138,7 +5138,7 @@
5138
5138
  },
5139
5139
  };
5140
5140
 
5141
- /*! @azure/msal-common v14.6.1 2024-01-23 */
5141
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
5142
5142
 
5143
5143
  /*
5144
5144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5971,7 +5971,7 @@
5971
5971
  };
5972
5972
  }
5973
5973
 
5974
- /*! @azure/msal-common v14.6.1 2024-01-23 */
5974
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
5975
5975
 
5976
5976
  /*
5977
5977
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6002,12 +6002,7 @@
6002
6002
  }
6003
6003
  }
6004
6004
 
6005
- var AuthorityFactory = /*#__PURE__*/Object.freeze({
6006
- __proto__: null,
6007
- createDiscoveredInstance: createDiscoveredInstance
6008
- });
6009
-
6010
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6005
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6011
6006
 
6012
6007
  /*
6013
6008
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6110,7 +6105,7 @@
6110
6105
  }
6111
6106
  }
6112
6107
 
6113
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6108
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6114
6109
  /*
6115
6110
  * Copyright (c) Microsoft Corporation. All rights reserved.
6116
6111
  * Licensed under the MIT License.
@@ -6136,7 +6131,7 @@
6136
6131
  refreshTokenExpired: refreshTokenExpired
6137
6132
  });
6138
6133
 
6139
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6134
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6140
6135
 
6141
6136
  /*
6142
6137
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6223,7 +6218,7 @@
6223
6218
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6224
6219
  }
6225
6220
 
6226
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6221
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6227
6222
  /*
6228
6223
  * Copyright (c) Microsoft Corporation. All rights reserved.
6229
6224
  * Licensed under the MIT License.
@@ -6239,7 +6234,7 @@
6239
6234
  }
6240
6235
  }
6241
6236
 
6242
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6237
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6243
6238
 
6244
6239
  /*
6245
6240
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6311,7 +6306,7 @@
6311
6306
  }
6312
6307
  }
6313
6308
 
6314
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6309
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6315
6310
 
6316
6311
  /*
6317
6312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6382,7 +6377,7 @@
6382
6377
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
6383
6378
  return this.cryptoUtils.signJwt({
6384
6379
  at: payload,
6385
- ts: TimeUtils.nowSeconds(),
6380
+ ts: nowSeconds(),
6386
6381
  m: resourceRequestMethod?.toUpperCase(),
6387
6382
  u: resourceUrlComponents?.HostNameAndPort,
6388
6383
  nonce: shrNonce || this.cryptoUtils.createNewGuid(),
@@ -6396,7 +6391,7 @@
6396
6391
  }
6397
6392
  }
6398
6393
 
6399
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6394
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6400
6395
  /*
6401
6396
  * Copyright (c) Microsoft Corporation. All rights reserved.
6402
6397
  * Licensed under the MIT License.
@@ -6423,7 +6418,7 @@
6423
6418
  }
6424
6419
  }
6425
6420
 
6426
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6421
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6427
6422
 
6428
6423
  /*
6429
6424
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6636,7 +6631,7 @@
6636
6631
  ? reqTimestamp + refreshIn
6637
6632
  : undefined;
6638
6633
  // non AAD scenarios can have empty realm
6639
- cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
6634
+ cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
6640
6635
  }
6641
6636
  // refreshToken
6642
6637
  let cachedRefreshToken = null;
@@ -6776,7 +6771,7 @@
6776
6771
  return baseAccount;
6777
6772
  }
6778
6773
 
6779
- /*! @azure/msal-common v14.6.1 2024-01-23 */
6774
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
6780
6775
 
6781
6776
  /*
6782
6777
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6819,7 +6814,7 @@
6819
6814
  if (!request.code) {
6820
6815
  throw createClientAuthError(requestCannotBeMade);
6821
6816
  }
6822
- const reqTimestamp = TimeUtils.nowSeconds();
6817
+ const reqTimestamp = nowSeconds();
6823
6818
  const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request);
6824
6819
  // Retrieve requestId from response headers
6825
6820
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
@@ -7181,7 +7176,7 @@
7181
7176
  }
7182
7177
  }
7183
7178
 
7184
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7179
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7185
7180
 
7186
7181
  /*
7187
7182
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7198,7 +7193,7 @@
7198
7193
  }
7199
7194
  async acquireToken(request) {
7200
7195
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
7201
- const reqTimestamp = TimeUtils.nowSeconds();
7196
+ const reqTimestamp = nowSeconds();
7202
7197
  const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
7203
7198
  // Retrieve requestId from response headers
7204
7199
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
@@ -7259,7 +7254,7 @@
7259
7254
  throw createInteractionRequiredAuthError(noTokensFound);
7260
7255
  }
7261
7256
  if (refreshToken.expiresOn &&
7262
- TimeUtils.isTokenExpired(refreshToken.expiresOn, request.refreshTokenExpirationOffsetSeconds ||
7257
+ isTokenExpired(refreshToken.expiresOn, request.refreshTokenExpirationOffsetSeconds ||
7263
7258
  DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS)) {
7264
7259
  throw createInteractionRequiredAuthError(refreshTokenExpired);
7265
7260
  }
@@ -7388,7 +7383,7 @@
7388
7383
  }
7389
7384
  }
7390
7385
 
7391
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7386
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7392
7387
 
7393
7388
  /*
7394
7389
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7459,14 +7454,14 @@
7459
7454
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
7460
7455
  throw createClientAuthError(tokenRefreshRequired);
7461
7456
  }
7462
- else if (TimeUtils.wasClockTurnedBack(cachedAccessToken.cachedAt) ||
7463
- TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
7457
+ else if (wasClockTurnedBack(cachedAccessToken.cachedAt) ||
7458
+ isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
7464
7459
  // must refresh due to the expires_in value
7465
7460
  this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);
7466
7461
  throw createClientAuthError(tokenRefreshRequired);
7467
7462
  }
7468
7463
  else if (cachedAccessToken.refreshOn &&
7469
- TimeUtils.isTokenExpired(cachedAccessToken.refreshOn, 0)) {
7464
+ isTokenExpired(cachedAccessToken.refreshOn, 0)) {
7470
7465
  // must refresh (in the background) due to the refresh_in value
7471
7466
  lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
7472
7467
  // don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
@@ -7519,7 +7514,7 @@
7519
7514
  }
7520
7515
  }
7521
7516
 
7522
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7517
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7523
7518
 
7524
7519
  /*
7525
7520
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7534,7 +7529,7 @@
7534
7529
  },
7535
7530
  };
7536
7531
 
7537
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7532
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7538
7533
  /*
7539
7534
  * Copyright (c) Microsoft Corporation. All rights reserved.
7540
7535
  * Licensed under the MIT License.
@@ -7542,7 +7537,7 @@
7542
7537
  const missingKidError = "missing_kid_error";
7543
7538
  const missingAlgError = "missing_alg_error";
7544
7539
 
7545
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7540
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7546
7541
 
7547
7542
  /*
7548
7543
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7567,7 +7562,7 @@
7567
7562
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7568
7563
  }
7569
7564
 
7570
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7565
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7571
7566
 
7572
7567
  /*
7573
7568
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7607,7 +7602,7 @@
7607
7602
  }
7608
7603
  }
7609
7604
 
7610
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7605
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7611
7606
 
7612
7607
  /*
7613
7608
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7665,7 +7660,7 @@
7665
7660
  }
7666
7661
  }
7667
7662
 
7668
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7663
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7669
7664
 
7670
7665
  /*
7671
7666
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7869,7 +7864,7 @@
7869
7864
  }
7870
7865
  }
7871
7866
 
7872
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7867
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7873
7868
 
7874
7869
  /*
7875
7870
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7948,7 +7943,7 @@
7948
7943
  }
7949
7944
  }
7950
7945
 
7951
- /*! @azure/msal-common v14.6.1 2024-01-23 */
7946
+ /*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
7952
7947
 
7953
7948
  /*
7954
7949
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9348,7 +9343,7 @@
9348
9343
 
9349
9344
  /* eslint-disable header/header */
9350
9345
  const name = "@azure/msal-browser";
9351
- const version = "3.7.1";
9346
+ const version = "3.7.2-alpha.0";
9352
9347
 
9353
9348
  /*
9354
9349
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9874,6 +9869,10 @@
9874
9869
  const MODULUS_LENGTH = 2048;
9875
9870
  // Public Exponent
9876
9871
  const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
9872
+ // UUID hex digits
9873
+ const UUID_CHARS = "0123456789abcdef";
9874
+ // Array to store UINT32 random value
9875
+ const UINT32_ARR = new Uint32Array(1);
9877
9876
  const keygenAlgorithmOptions = {
9878
9877
  name: PKCS1_V15_KEYGEN_ALG,
9879
9878
  hash: S256_HASH_ALG,
@@ -9894,7 +9893,9 @@
9894
9893
  }
9895
9894
  /**
9896
9895
  * Returns a sha-256 hash of the given dataString as an ArrayBuffer.
9897
- * @param dataString
9896
+ * @param dataString {string} data string
9897
+ * @param performanceClient {?IPerformanceClient}
9898
+ * @param correlationId {?string} correlation id
9898
9899
  */
9899
9900
  async function sha256Digest(dataString, performanceClient, correlationId) {
9900
9901
  performanceClient?.addQueueMeasurement(PerformanceEvents.Sha256Digest, correlationId);
@@ -9910,11 +9911,54 @@
9910
9911
  return window.crypto.getRandomValues(dataBuffer);
9911
9912
  }
9912
9913
  /**
9913
- * Creates a new random GUID
9914
- * @returns
9914
+ * Returns random Uint32 value.
9915
+ * @returns {number}
9916
+ */
9917
+ function getRandomUint32() {
9918
+ window.crypto.getRandomValues(UINT32_ARR);
9919
+ return UINT32_ARR[0];
9920
+ }
9921
+ /**
9922
+ * Creates a UUID v7 from the current timestamp.
9923
+ * Implementation relies on the system clock to guarantee increasing order of generated identifiers.
9924
+ * @returns {number}
9915
9925
  */
9916
9926
  function createNewGuid() {
9917
- return window.crypto.randomUUID();
9927
+ const currentTimestamp = Date.now();
9928
+ const baseRand = getRandomUint32() * 0x400 + (getRandomUint32() & 0x3ff);
9929
+ // Result byte array
9930
+ const bytes = new Uint8Array(16);
9931
+ // A 12-bit `rand_a` field value
9932
+ const randA = Math.trunc(baseRand / 2 ** 30);
9933
+ // The higher 30 bits of 62-bit `rand_b` field value
9934
+ const randBHi = baseRand & (2 ** 30 - 1);
9935
+ // The lower 32 bits of 62-bit `rand_b` field value
9936
+ const randBLo = getRandomUint32();
9937
+ bytes[0] = currentTimestamp / 2 ** 40;
9938
+ bytes[1] = currentTimestamp / 2 ** 32;
9939
+ bytes[2] = currentTimestamp / 2 ** 24;
9940
+ bytes[3] = currentTimestamp / 2 ** 16;
9941
+ bytes[4] = currentTimestamp / 2 ** 8;
9942
+ bytes[5] = currentTimestamp;
9943
+ bytes[6] = 0x70 | (randA >>> 8);
9944
+ bytes[7] = randA;
9945
+ bytes[8] = 0x80 | (randBHi >>> 24);
9946
+ bytes[9] = randBHi >>> 16;
9947
+ bytes[10] = randBHi >>> 8;
9948
+ bytes[11] = randBHi;
9949
+ bytes[12] = randBLo >>> 24;
9950
+ bytes[13] = randBLo >>> 16;
9951
+ bytes[14] = randBLo >>> 8;
9952
+ bytes[15] = randBLo;
9953
+ let text = "";
9954
+ for (let i = 0; i < bytes.length; i++) {
9955
+ text += UUID_CHARS.charAt(bytes[i] >>> 4);
9956
+ text += UUID_CHARS.charAt(bytes[i] & 0xf);
9957
+ if (i === 3 || i === 5 || i === 7 || i === 9) {
9958
+ text += "-";
9959
+ }
9960
+ }
9961
+ return text;
9918
9962
  }
9919
9963
  /**
9920
9964
  * Generates a keypair based on current keygen algorithm config.
@@ -12088,12 +12132,9 @@
12088
12132
  * Initializer function for all request APIs
12089
12133
  * @param request
12090
12134
  */
12091
- async initializeBaseRequest(request, account) {
12135
+ async initializeBaseRequest(request) {
12092
12136
  this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, this.correlationId);
12093
12137
  const authority = request.authority || this.config.auth.authority;
12094
- if (account) {
12095
- await this.validateRequestAuthority(authority, account);
12096
- }
12097
12138
  const scopes = [...((request && request.scopes) || [])];
12098
12139
  const validatedRequest = {
12099
12140
  ...request,
@@ -12142,16 +12183,6 @@
12142
12183
  getCurrentUri();
12143
12184
  return UrlString.getAbsoluteUrl(redirectUri, getCurrentUri());
12144
12185
  }
12145
- /*
12146
- * If authority provided in the request does not match environment/authority specified
12147
- * in the account or MSAL config, we throw an error.
12148
- */
12149
- async validateRequestAuthority(authority, account) {
12150
- const discoveredAuthority = await this.getDiscoveredAuthority(authority);
12151
- if (!discoveredAuthority.isAlias(account.environment)) {
12152
- throw createClientConfigurationError(authorityMismatch);
12153
- }
12154
- }
12155
12186
  /**
12156
12187
  *
12157
12188
  * @param apiId
@@ -12173,19 +12204,30 @@
12173
12204
  /**
12174
12205
  * Used to get a discovered version of the default authority.
12175
12206
  * @param requestAuthority
12207
+ * @param requestAzureCloudOptions
12208
+ * @param account
12176
12209
  */
12177
- async getDiscoveredAuthority(requestAuthority) {
12178
- this.logger.verbose("getDiscoveredAuthority called");
12210
+ async getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions, account) {
12211
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
12179
12212
  const authorityOptions = {
12180
12213
  protocolMode: this.config.auth.protocolMode,
12181
12214
  OIDCOptions: this.config.auth.OIDCOptions,
12182
12215
  knownAuthorities: this.config.auth.knownAuthorities,
12183
12216
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
12184
12217
  authorityMetadata: this.config.auth.authorityMetadata,
12218
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
12185
12219
  };
12186
- const authority = requestAuthority || this.config.auth.authority;
12187
- this.logger.verbose(`Creating discovered authority with ${authority}`);
12188
- return createDiscoveredInstance(authority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.correlationId, this.performanceClient);
12220
+ // build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
12221
+ const userAuthority = requestAuthority
12222
+ ? requestAuthority
12223
+ : this.config.auth.authority;
12224
+ // fall back to the authority from config
12225
+ const builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
12226
+ const discoveredAuthority = await invokeAsync(createDiscoveredInstance, PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.logger, this.performanceClient, this.correlationId)(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.correlationId, this.performanceClient);
12227
+ if (account && !discoveredAuthority.isAlias(account.environment)) {
12228
+ throw createClientConfigurationError(authorityMismatch);
12229
+ }
12230
+ return discoveredAuthority;
12189
12231
  }
12190
12232
  }
12191
12233
 
@@ -12358,10 +12400,10 @@
12358
12400
  * @param serverTelemetryManager
12359
12401
  * @param authorityUrl
12360
12402
  */
12361
- async createAuthCodeClient(serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
12403
+ async createAuthCodeClient(serverTelemetryManager, authorityUrl, requestAzureCloudOptions, account) {
12362
12404
  this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
12363
12405
  // Create auth module.
12364
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
12406
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, requestAzureCloudOptions, account);
12365
12407
  return new AuthorizationCodeClient(clientConfig, this.performanceClient);
12366
12408
  }
12367
12409
  /**
@@ -12370,9 +12412,9 @@
12370
12412
  * @param requestAuthority
12371
12413
  * @param requestCorrelationId
12372
12414
  */
12373
- async getClientConfiguration(serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
12415
+ async getClientConfiguration(serverTelemetryManager, requestAuthority, requestAzureCloudOptions, account) {
12374
12416
  this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
12375
- const discoveredAuthority = await invokeAsync(this.getDiscoveredAuthority.bind(this), PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, this.correlationId)(requestAuthority, requestAzureCloudOptions);
12417
+ const discoveredAuthority = await invokeAsync(this.getDiscoveredAuthority.bind(this), PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, this.correlationId)(requestAuthority, requestAzureCloudOptions, account);
12376
12418
  const logger = this.config.system.loggerOptions;
12377
12419
  return {
12378
12420
  authOptions: {
@@ -12406,29 +12448,6 @@
12406
12448
  telemetry: this.config.telemetry,
12407
12449
  };
12408
12450
  }
12409
- /**
12410
- * Used to get a discovered version of the default authority.
12411
- * @param requestAuthority
12412
- * @param requestCorrelationId
12413
- */
12414
- async getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions) {
12415
- this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
12416
- const authorityOptions = {
12417
- protocolMode: this.config.auth.protocolMode,
12418
- OIDCOptions: this.config.auth.OIDCOptions,
12419
- knownAuthorities: this.config.auth.knownAuthorities,
12420
- cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
12421
- authorityMetadata: this.config.auth.authorityMetadata,
12422
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
12423
- };
12424
- // build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
12425
- const userAuthority = requestAuthority
12426
- ? requestAuthority
12427
- : this.config.auth.authority;
12428
- // fall back to the authority from config
12429
- const builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
12430
- return invokeAsync(createDiscoveredInstance.bind(AuthorityFactory), PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.logger, this.performanceClient, this.correlationId)(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.correlationId, this.performanceClient);
12431
- }
12432
12451
  /**
12433
12452
  * Helper to initialize required request parameters for interactive APIs and ssoSilent()
12434
12453
  * @param request
@@ -12560,7 +12579,7 @@
12560
12579
  this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
12561
12580
  // Telemetry manager only used to increment cacheHits here
12562
12581
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
12563
- const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
12582
+ const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
12564
12583
  this.logger.verbose("Silent auth client created");
12565
12584
  try {
12566
12585
  const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
@@ -12592,14 +12611,14 @@
12592
12611
  * @param serverTelemetryManager
12593
12612
  * @param authorityUrl
12594
12613
  */
12595
- async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
12614
+ async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
12596
12615
  // Create auth module.
12597
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions);
12616
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
12598
12617
  return new SilentFlowClient(clientConfig, this.performanceClient);
12599
12618
  }
12600
12619
  async initializeSilentRequest(request, account) {
12601
12620
  this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
12602
- const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request, account);
12621
+ const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request);
12603
12622
  return {
12604
12623
  ...request,
12605
12624
  ...baseRequest,
@@ -12635,7 +12654,7 @@
12635
12654
  this.logger.trace("NativeInteractionClient - acquireToken called.");
12636
12655
  // start the perf measurement
12637
12656
  const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
12638
- const reqTimestamp = TimeUtils.nowSeconds();
12657
+ const reqTimestamp = nowSeconds();
12639
12658
  // initialize native request
12640
12659
  const nativeRequest = await this.initializeNativeRequest(request);
12641
12660
  // check if the tokens can be retrieved from internal cache
@@ -12784,7 +12803,7 @@
12784
12803
  method: NativeExtensionMethod.GetToken,
12785
12804
  request: request,
12786
12805
  };
12787
- const reqTimestamp = TimeUtils.nowSeconds();
12806
+ const reqTimestamp = nowSeconds();
12788
12807
  try {
12789
12808
  this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");
12790
12809
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
@@ -13055,7 +13074,8 @@
13055
13074
  this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
13056
13075
  const authority = request.authority || this.config.auth.authority;
13057
13076
  if (request.account) {
13058
- await this.validateRequestAuthority(authority, request.account);
13077
+ // validate authority
13078
+ await this.getDiscoveredAuthority(authority, request.azureCloudOptions, request.account);
13059
13079
  }
13060
13080
  const canonicalAuthority = new UrlString(authority);
13061
13081
  canonicalAuthority.validateAsUri();
@@ -13620,7 +13640,7 @@
13620
13640
  // Create auth code request and generate PKCE params
13621
13641
  const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, this.correlationId)(validRequest);
13622
13642
  // Initialize the client
13623
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
13643
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions, validRequest.account);
13624
13644
  const isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
13625
13645
  // Start measurement for server calls with native brokering enabled
13626
13646
  let fetchNativeAccountIdMeasurement;
@@ -13701,7 +13721,8 @@
13701
13721
  // Clear cache on logout
13702
13722
  await this.clearCacheOnLogout(validRequest.account);
13703
13723
  // Initialize the client
13704
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, requestAuthority);
13724
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, requestAuthority, undefined, // AzureCloudOptions
13725
+ validRequest.account || undefined);
13705
13726
  try {
13706
13727
  authClient.authority.endSessionEndpoint;
13707
13728
  }
@@ -14133,7 +14154,7 @@
14133
14154
  // Create auth code request and generate PKCE params
14134
14155
  const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, this.correlationId)(validRequest);
14135
14156
  // Initialize the client
14136
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
14157
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions, validRequest.account);
14137
14158
  // Create redirect interaction handler.
14138
14159
  const interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
14139
14160
  // Create acquire token url.
@@ -14351,7 +14372,8 @@
14351
14372
  timeout: this.config.system.redirectNavigationTimeout,
14352
14373
  noHistory: false,
14353
14374
  };
14354
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, logoutRequest && logoutRequest.authority);
14375
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, logoutRequest && logoutRequest.authority, undefined, // AzureCloudOptions
14376
+ (logoutRequest && logoutRequest.account) || undefined);
14355
14377
  if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
14356
14378
  try {
14357
14379
  authClient.authority.endSessionEndpoint;
@@ -14587,7 +14609,7 @@
14587
14609
  const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
14588
14610
  try {
14589
14611
  // Initialize the client
14590
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
14612
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
14591
14613
  return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
14592
14614
  }
14593
14615
  catch (e) {
@@ -14658,7 +14680,7 @@
14658
14680
  */
14659
14681
  async acquireToken(request) {
14660
14682
  this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
14661
- const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, request.account);
14683
+ const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request);
14662
14684
  const silentRequest = {
14663
14685
  ...request,
14664
14686
  ...baseRequest,
@@ -14668,7 +14690,7 @@
14668
14690
  silentRequest.redirectUri = this.getRedirectUri(request.redirectUri);
14669
14691
  }
14670
14692
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
14671
- const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
14693
+ const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
14672
14694
  // Send request to renew token. Auth module will throw errors if token cannot be renewed.
14673
14695
  return invokeAsync(refreshTokenClient.acquireTokenByRefreshToken.bind(refreshTokenClient), PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, this.logger, this.performanceClient, request.correlationId)(silentRequest).catch((e) => {
14674
14696
  e.setCorrelationId(this.correlationId);
@@ -14688,9 +14710,9 @@
14688
14710
  * @param serverTelemetryManager
14689
14711
  * @param authorityUrl
14690
14712
  */
14691
- async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
14713
+ async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
14692
14714
  // Create auth module.
14693
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions);
14715
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
14694
14716
  return new RefreshTokenClient(clientConfig, this.performanceClient);
14695
14717
  }
14696
14718
  }
@@ -14957,7 +14979,7 @@
14957
14979
  code: request.code,
14958
14980
  };
14959
14981
  // Initialize the client
14960
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority);
14982
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
14961
14983
  const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
14962
14984
  this.logger.verbose("Auth code client created");
14963
14985
  // Create silent handler
@@ -17993,7 +18015,7 @@
17993
18015
  atPopupMeasurement?.add({ nestedAppAuthRequest: true });
17994
18016
  try {
17995
18017
  const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(request);
17996
- const reqTimestamp = TimeUtils.nowSeconds();
18018
+ const reqTimestamp = nowSeconds();
17997
18019
  const response = await this.bridgeProxy.getTokenInteractive(naaRequest);
17998
18020
  const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
17999
18021
  this.operatingContext.setActiveAccount(result.account);
@@ -18030,7 +18052,7 @@
18030
18052
  });
18031
18053
  try {
18032
18054
  const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(request);
18033
- const reqTimestamp = TimeUtils.nowSeconds();
18055
+ const reqTimestamp = nowSeconds();
18034
18056
  const response = await this.bridgeProxy.getTokenSilent(naaRequest);
18035
18057
  const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
18036
18058
  this.operatingContext.setActiveAccount(result.account);