@azure/msal-browser 3.16.0 → 3.18.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 (102) 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/NativeRequest.d.ts +1 -0
  6. package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
  7. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  8. package/dist/cache/AccountManager.mjs +1 -1
  9. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  10. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  11. package/dist/cache/BrowserCacheManager.mjs +6 -3
  12. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  13. package/dist/cache/BrowserStorage.mjs +1 -1
  14. package/dist/cache/DatabaseStorage.mjs +1 -1
  15. package/dist/cache/MemoryStorage.mjs +1 -1
  16. package/dist/cache/TokenCache.d.ts.map +1 -1
  17. package/dist/cache/TokenCache.mjs +90 -117
  18. package/dist/cache/TokenCache.mjs.map +1 -1
  19. package/dist/config/Configuration.mjs +1 -1
  20. package/dist/controllers/ControllerFactory.mjs +1 -1
  21. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  22. package/dist/controllers/StandardController.d.ts.map +1 -1
  23. package/dist/controllers/StandardController.mjs +4 -3
  24. package/dist/controllers/StandardController.mjs.map +1 -1
  25. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  26. package/dist/crypto/BrowserCrypto.mjs +1 -1
  27. package/dist/crypto/CryptoOps.d.ts +11 -0
  28. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  29. package/dist/crypto/CryptoOps.mjs +16 -1
  30. package/dist/crypto/CryptoOps.mjs.map +1 -1
  31. package/dist/crypto/PkceGenerator.mjs +1 -1
  32. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  33. package/dist/encode/Base64Decode.mjs +1 -1
  34. package/dist/encode/Base64Encode.mjs +1 -1
  35. package/dist/error/BrowserAuthError.d.ts +5 -0
  36. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  37. package/dist/error/BrowserAuthError.mjs +7 -2
  38. package/dist/error/BrowserAuthError.mjs.map +1 -1
  39. package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
  40. package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  41. package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
  42. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  43. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  44. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  45. package/dist/error/NativeAuthError.mjs +1 -1
  46. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  47. package/dist/error/NestedAppAuthError.mjs +2 -2
  48. package/dist/error/NestedAppAuthError.mjs.map +1 -1
  49. package/dist/event/EventHandler.mjs +1 -1
  50. package/dist/event/EventMessage.mjs +1 -1
  51. package/dist/event/EventType.mjs +1 -1
  52. package/dist/index.mjs +1 -1
  53. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  54. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  55. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  56. package/dist/interaction_client/NativeInteractionClient.mjs +36 -15
  57. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  58. package/dist/interaction_client/PopupClient.mjs +1 -1
  59. package/dist/interaction_client/RedirectClient.mjs +1 -1
  60. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  61. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  62. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  63. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  64. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  65. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  66. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  67. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  68. package/dist/naa/BridgeError.mjs +1 -1
  69. package/dist/naa/BridgeProxy.mjs +1 -1
  70. package/dist/naa/BridgeStatusCode.mjs +1 -1
  71. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  72. package/dist/navigation/NavigationClient.mjs +1 -1
  73. package/dist/network/FetchClient.mjs +1 -1
  74. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  75. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  76. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  77. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  78. package/dist/packageMetadata.d.ts +1 -1
  79. package/dist/packageMetadata.mjs +2 -2
  80. package/dist/request/RequestHelpers.mjs +1 -1
  81. package/dist/response/ResponseHandler.mjs +1 -1
  82. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  83. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  84. package/dist/utils/BrowserConstants.mjs +1 -1
  85. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  86. package/dist/utils/BrowserUtils.mjs +1 -1
  87. package/lib/msal-browser.cjs +283 -254
  88. package/lib/msal-browser.cjs.map +1 -1
  89. package/lib/msal-browser.js +283 -254
  90. package/lib/msal-browser.js.map +1 -1
  91. package/lib/msal-browser.min.js +63 -64
  92. package/package.json +3 -2
  93. package/src/broker/nativeBroker/NativeRequest.ts +1 -0
  94. package/src/cache/BrowserCacheManager.ts +4 -5
  95. package/src/cache/TokenCache.ts +158 -243
  96. package/src/controllers/StandardController.ts +6 -5
  97. package/src/crypto/CryptoOps.ts +17 -0
  98. package/src/error/BrowserAuthError.ts +8 -0
  99. package/src/error/BrowserAuthErrorCodes.ts +1 -0
  100. package/src/error/NestedAppAuthError.ts +1 -1
  101. package/src/interaction_client/NativeInteractionClient.ts +52 -23
  102. package/src/packageMetadata.ts +1 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v3.16.0 2024-06-04 */
1
+ /*! @azure/msal-browser v3.18.0 2024-07-01 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -48,6 +48,7 @@ const Constants = {
48
48
  NOT_DEFINED: "not_defined",
49
49
  EMPTY_STRING: "",
50
50
  NOT_APPLICABLE: "N/A",
51
+ NOT_AVAILABLE: "Not Available",
51
52
  FORWARD_SLASH: "/",
52
53
  IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
53
54
  IMDS_VERSION: "2020-06-01",
@@ -310,7 +311,7 @@ const JsonWebTokenTypes = {
310
311
  // Token renewal offset default in seconds
311
312
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
312
313
 
313
- /*! @azure/msal-common v14.11.0 2024-06-04 */
314
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
314
315
  /*
315
316
  * Copyright (c) Microsoft Corporation. All rights reserved.
316
317
  * Licensed under the MIT License.
@@ -327,7 +328,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
327
328
  unexpectedError: unexpectedError
328
329
  });
329
330
 
330
- /*! @azure/msal-common v14.11.0 2024-06-04 */
331
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
331
332
 
332
333
  /*
333
334
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -376,7 +377,7 @@ function createAuthError(code, additionalMessage) {
376
377
  : AuthErrorMessages[code]);
377
378
  }
378
379
 
379
- /*! @azure/msal-common v14.11.0 2024-06-04 */
380
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
380
381
  /*
381
382
  * Copyright (c) Microsoft Corporation. All rights reserved.
382
383
  * Licensed under the MIT License.
@@ -474,7 +475,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
474
475
  userTimeoutReached: userTimeoutReached
475
476
  });
476
477
 
477
- /*! @azure/msal-common v14.11.0 2024-06-04 */
478
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
478
479
 
479
480
  /*
480
481
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -726,7 +727,7 @@ function createClientAuthError(errorCode, additionalMessage) {
726
727
  return new ClientAuthError(errorCode, additionalMessage);
727
728
  }
728
729
 
729
- /*! @azure/msal-common v14.11.0 2024-06-04 */
730
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
730
731
 
731
732
  /*
732
733
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -787,7 +788,7 @@ function checkMaxAge(authTime, maxAge) {
787
788
  }
788
789
  }
789
790
 
790
- /*! @azure/msal-common v14.11.0 2024-06-04 */
791
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
791
792
  /*
792
793
  * Copyright (c) Microsoft Corporation. All rights reserved.
793
794
  * Licensed under the MIT License.
@@ -802,7 +803,7 @@ const AuthorityType = {
802
803
  Ciam: 3,
803
804
  };
804
805
 
805
- /*! @azure/msal-common v14.11.0 2024-06-04 */
806
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
806
807
  /*
807
808
  * Copyright (c) Microsoft Corporation. All rights reserved.
808
809
  * Licensed under the MIT License.
@@ -814,7 +815,7 @@ function isOpenIdConfigResponse(response) {
814
815
  response.hasOwnProperty("jwks_uri"));
815
816
  }
816
817
 
817
- /*! @azure/msal-common v14.11.0 2024-06-04 */
818
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
818
819
  /*
819
820
  * Copyright (c) Microsoft Corporation. All rights reserved.
820
821
  * Licensed under the MIT License.
@@ -868,7 +869,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
868
869
  urlParseError: urlParseError
869
870
  });
870
871
 
871
- /*! @azure/msal-common v14.11.0 2024-06-04 */
872
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
872
873
 
873
874
  /*
874
875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1006,7 +1007,7 @@ function createClientConfigurationError(errorCode) {
1006
1007
  return new ClientConfigurationError(errorCode);
1007
1008
  }
1008
1009
 
1009
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1010
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1010
1011
  /*
1011
1012
  * Copyright (c) Microsoft Corporation. All rights reserved.
1012
1013
  * Licensed under the MIT License.
@@ -1103,7 +1104,7 @@ class StringUtils {
1103
1104
  }
1104
1105
  }
1105
1106
 
1106
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1107
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1107
1108
 
1108
1109
  /*
1109
1110
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1150,7 +1151,7 @@ function getDeserializedResponse(responseString) {
1150
1151
  return null;
1151
1152
  }
1152
1153
 
1153
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1154
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1154
1155
 
1155
1156
  /*
1156
1157
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1314,7 +1315,7 @@ class UrlString {
1314
1315
  }
1315
1316
  }
1316
1317
 
1317
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1318
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1318
1319
 
1319
1320
  /*
1320
1321
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1454,7 +1455,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1454
1455
  return null;
1455
1456
  }
1456
1457
 
1457
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1458
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1458
1459
  /*
1459
1460
  * Copyright (c) Microsoft Corporation. All rights reserved.
1460
1461
  * Licensed under the MIT License.
@@ -1467,7 +1468,7 @@ const ProtocolMode = {
1467
1468
  OIDC: "OIDC",
1468
1469
  };
1469
1470
 
1470
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1471
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1471
1472
  /*
1472
1473
  * Copyright (c) Microsoft Corporation. All rights reserved.
1473
1474
  * Licensed under the MIT License.
@@ -1487,7 +1488,7 @@ const AzureCloudInstance = {
1487
1488
  AzureUsGovernment: "https://login.microsoftonline.us",
1488
1489
  };
1489
1490
 
1490
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1491
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1491
1492
  /*
1492
1493
  * Copyright (c) Microsoft Corporation. All rights reserved.
1493
1494
  * Licensed under the MIT License.
@@ -1497,7 +1498,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1497
1498
  response.hasOwnProperty("metadata"));
1498
1499
  }
1499
1500
 
1500
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1501
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1501
1502
  /*
1502
1503
  * Copyright (c) Microsoft Corporation. All rights reserved.
1503
1504
  * Licensed under the MIT License.
@@ -1507,7 +1508,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1507
1508
  response.hasOwnProperty("error_description"));
1508
1509
  }
1509
1510
 
1510
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1511
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1511
1512
  /*
1512
1513
  * Copyright (c) Microsoft Corporation. All rights reserved.
1513
1514
  * Licensed under the MIT License.
@@ -1989,7 +1990,7 @@ const IntFields = new Set([
1989
1990
  "multiMatchedRT",
1990
1991
  ]);
1991
1992
 
1992
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1993
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1993
1994
  /*
1994
1995
  * Copyright (c) Microsoft Corporation. All rights reserved.
1995
1996
  * Licensed under the MIT License.
@@ -2085,7 +2086,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
2085
2086
  };
2086
2087
  };
2087
2088
 
2088
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2089
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2089
2090
 
2090
2091
  /*
2091
2092
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2194,7 +2195,7 @@ RegionDiscovery.IMDS_OPTIONS = {
2194
2195
  },
2195
2196
  };
2196
2197
 
2197
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2198
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2198
2199
  /*
2199
2200
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2201
  * Licensed under the MIT License.
@@ -2231,7 +2232,7 @@ function wasClockTurnedBack(cachedAt) {
2231
2232
  return cachedAtSec > nowSeconds();
2232
2233
  }
2233
2234
 
2234
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2235
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2235
2236
 
2236
2237
  /*
2237
2238
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2558,7 +2559,7 @@ function isAuthorityMetadataExpired(metadata) {
2558
2559
  return metadata.expiresAt <= nowSeconds();
2559
2560
  }
2560
2561
 
2561
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2562
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2562
2563
 
2563
2564
  /*
2564
2565
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3397,7 +3398,7 @@ function buildStaticAuthorityOptions(authOptions) {
3397
3398
  };
3398
3399
  }
3399
3400
 
3400
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3401
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3401
3402
 
3402
3403
  /*
3403
3404
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3428,7 +3429,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3428
3429
  }
3429
3430
  }
3430
3431
 
3431
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3432
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3432
3433
  /*
3433
3434
  * Copyright (c) Microsoft Corporation. All rights reserved.
3434
3435
  * Licensed under the MIT License.
@@ -3446,7 +3447,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
3446
3447
  }
3447
3448
  }
3448
3449
 
3449
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3450
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3450
3451
  /*
3451
3452
  * Copyright (c) Microsoft Corporation. All rights reserved.
3452
3453
  * Licensed under the MIT License.
@@ -3493,7 +3494,7 @@ const SID = "sid";
3493
3494
  const LOGIN_HINT = "login_hint";
3494
3495
  const DOMAIN_HINT = "domain_hint";
3495
3496
 
3496
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3497
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3497
3498
 
3498
3499
  /*
3499
3500
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3509,6 +3510,12 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3509
3510
  base64Encode: () => {
3510
3511
  throw createClientAuthError(methodNotImplemented);
3511
3512
  },
3513
+ base64UrlEncode: () => {
3514
+ throw createClientAuthError(methodNotImplemented);
3515
+ },
3516
+ encodeKid: () => {
3517
+ throw createClientAuthError(methodNotImplemented);
3518
+ },
3512
3519
  async getPublicKeyThumbprint() {
3513
3520
  throw createClientAuthError(methodNotImplemented);
3514
3521
  },
@@ -3526,7 +3533,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3526
3533
  },
3527
3534
  };
3528
3535
 
3529
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3536
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3530
3537
 
3531
3538
  /*
3532
3539
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3717,12 +3724,12 @@ class Logger {
3717
3724
  }
3718
3725
  }
3719
3726
 
3720
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3727
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3721
3728
  /* eslint-disable header/header */
3722
3729
  const name$1 = "@azure/msal-common";
3723
- const version$1 = "14.11.0";
3730
+ const version$1 = "14.13.0";
3724
3731
 
3725
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3732
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3726
3733
 
3727
3734
  /*
3728
3735
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3922,7 +3929,7 @@ class ScopeSet {
3922
3929
  }
3923
3930
  }
3924
3931
 
3925
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3932
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3926
3933
 
3927
3934
  /*
3928
3935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3962,7 +3969,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
3962
3969
  };
3963
3970
  }
3964
3971
 
3965
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3972
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3966
3973
  /*
3967
3974
  * Copyright (c) Microsoft Corporation. All rights reserved.
3968
3975
  * Licensed under the MIT License.
@@ -4024,7 +4031,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
4024
4031
  return updatedAccountInfo;
4025
4032
  }
4026
4033
 
4027
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4034
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4028
4035
  /*
4029
4036
  * Copyright (c) Microsoft Corporation. All rights reserved.
4030
4037
  * Licensed under the MIT License.
@@ -4046,7 +4053,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
4046
4053
  return null;
4047
4054
  }
4048
4055
 
4049
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4056
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4050
4057
 
4051
4058
  /*
4052
4059
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4169,21 +4176,21 @@ class AccountEntity {
4169
4176
  // How do you account for MSA CID here?
4170
4177
  account.localAccountId =
4171
4178
  clientInfo?.uid ||
4172
- accountDetails.idTokenClaims.oid ||
4173
- accountDetails.idTokenClaims.sub ||
4179
+ accountDetails.idTokenClaims?.oid ||
4180
+ accountDetails.idTokenClaims?.sub ||
4174
4181
  "";
4175
4182
  /*
4176
4183
  * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
4177
4184
  * In most cases it will contain a single email. This field should not be relied upon if a custom
4178
4185
  * policy is configured to return more than 1 email.
4179
4186
  */
4180
- const preferredUsername = accountDetails.idTokenClaims.preferred_username ||
4181
- accountDetails.idTokenClaims.upn;
4182
- const email = accountDetails.idTokenClaims.emails
4187
+ const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
4188
+ accountDetails.idTokenClaims?.upn;
4189
+ const email = accountDetails.idTokenClaims?.emails
4183
4190
  ? accountDetails.idTokenClaims.emails[0]
4184
4191
  : null;
4185
4192
  account.username = preferredUsername || email || "";
4186
- account.name = accountDetails.idTokenClaims.name;
4193
+ account.name = accountDetails.idTokenClaims?.name || "";
4187
4194
  account.cloudGraphHostName = accountDetails.cloudGraphHostName;
4188
4195
  account.msGraphHost = accountDetails.msGraphHost;
4189
4196
  if (accountDetails.tenantProfiles) {
@@ -4293,7 +4300,7 @@ class AccountEntity {
4293
4300
  }
4294
4301
  }
4295
4302
 
4296
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4303
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4297
4304
  /*
4298
4305
  * Copyright (c) Microsoft Corporation. All rights reserved.
4299
4306
  * Licensed under the MIT License.
@@ -4301,7 +4308,7 @@ class AccountEntity {
4301
4308
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
4302
4309
  const cacheUnknownErrorCode = "cache_error_unknown";
4303
4310
 
4304
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4311
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4305
4312
 
4306
4313
  /*
4307
4314
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4328,7 +4335,7 @@ class CacheError extends Error {
4328
4335
  }
4329
4336
  }
4330
4337
 
4331
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4338
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4332
4339
 
4333
4340
  /*
4334
4341
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5467,7 +5474,7 @@ class CacheManager {
5467
5474
  /**
5468
5475
  * Returns true if the credential's keyId matches the one in the request, false otherwise
5469
5476
  * @param entity
5470
- * @param tokenType
5477
+ * @param keyId
5471
5478
  */
5472
5479
  matchKeyId(entity, keyId) {
5473
5480
  return !!(entity.keyId && entity.keyId === keyId);
@@ -5583,7 +5590,7 @@ class DefaultStorageClass extends CacheManager {
5583
5590
  }
5584
5591
  }
5585
5592
 
5586
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5593
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5587
5594
 
5588
5595
  /*
5589
5596
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5681,7 +5688,7 @@ function isOidcProtocolMode(config) {
5681
5688
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5682
5689
  }
5683
5690
 
5684
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5691
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5685
5692
 
5686
5693
  /*
5687
5694
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5691,15 +5698,16 @@ function isOidcProtocolMode(config) {
5691
5698
  * Error thrown when there is an error with the server code, for example, unavailability.
5692
5699
  */
5693
5700
  class ServerError extends AuthError {
5694
- constructor(errorCode, errorMessage, subError, errorNo) {
5701
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
5695
5702
  super(errorCode, errorMessage, subError);
5696
5703
  this.name = "ServerError";
5697
5704
  this.errorNo = errorNo;
5705
+ this.status = status;
5698
5706
  Object.setPrototypeOf(this, ServerError.prototype);
5699
5707
  }
5700
5708
  }
5701
5709
 
5702
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5710
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5703
5711
 
5704
5712
  /*
5705
5713
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5797,7 +5805,7 @@ class ThrottlingUtils {
5797
5805
  }
5798
5806
  }
5799
5807
 
5800
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5808
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5801
5809
 
5802
5810
  /*
5803
5811
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5834,7 +5842,7 @@ class NetworkManager {
5834
5842
  }
5835
5843
  }
5836
5844
 
5837
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5845
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5838
5846
  /*
5839
5847
  * Copyright (c) Microsoft Corporation. All rights reserved.
5840
5848
  * Licensed under the MIT License.
@@ -5844,7 +5852,7 @@ const CcsCredentialType = {
5844
5852
  UPN: "UPN",
5845
5853
  };
5846
5854
 
5847
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5855
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5848
5856
 
5849
5857
  /*
5850
5858
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5909,26 +5917,9 @@ class RequestValidator {
5909
5917
  throw createClientConfigurationError(invalidCodeChallengeMethod);
5910
5918
  }
5911
5919
  }
5912
- /**
5913
- * Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
5914
- * @param request
5915
- */
5916
- static sanitizeEQParams(eQParams, queryParams) {
5917
- if (!eQParams) {
5918
- return {};
5919
- }
5920
- // Remove any query parameters already included in SSO params
5921
- queryParams.forEach((_value, key) => {
5922
- if (eQParams[key]) {
5923
- delete eQParams[key];
5924
- }
5925
- });
5926
- // remove empty string parameters
5927
- return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
5928
- }
5929
5920
  }
5930
5921
 
5931
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5922
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5932
5923
 
5933
5924
  /*
5934
5925
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6216,9 +6207,10 @@ class RequestParameterBuilder {
6216
6207
  * @param eQParams
6217
6208
  */
6218
6209
  addExtraQueryParameters(eQParams) {
6219
- const sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
6220
- Object.keys(sanitizedEQParams).forEach((key) => {
6221
- this.parameters.set(key, eQParams[key]);
6210
+ Object.entries(eQParams).forEach(([key, value]) => {
6211
+ if (!this.parameters.has(key) && value) {
6212
+ this.parameters.set(key, value);
6213
+ }
6222
6214
  });
6223
6215
  }
6224
6216
  addClientCapabilitiesToClaims(claims, clientCapabilities) {
@@ -6312,7 +6304,7 @@ class RequestParameterBuilder {
6312
6304
  }
6313
6305
  }
6314
6306
 
6315
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6307
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6316
6308
 
6317
6309
  /*
6318
6310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6415,7 +6407,7 @@ class BaseClient {
6415
6407
  }
6416
6408
  }
6417
6409
 
6418
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6410
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6419
6411
  /*
6420
6412
  * Copyright (c) Microsoft Corporation. All rights reserved.
6421
6413
  * Licensed under the MIT License.
@@ -6441,7 +6433,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6441
6433
  refreshTokenExpired: refreshTokenExpired
6442
6434
  });
6443
6435
 
6444
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6436
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6445
6437
 
6446
6438
  /*
6447
6439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6529,23 +6521,7 @@ function createInteractionRequiredAuthError(errorCode) {
6529
6521
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6530
6522
  }
6531
6523
 
6532
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6533
- /*
6534
- * Copyright (c) Microsoft Corporation. All rights reserved.
6535
- * Licensed under the MIT License.
6536
- */
6537
- /** @internal */
6538
- class CacheRecord {
6539
- constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
6540
- this.account = accountEntity || null;
6541
- this.idToken = idTokenEntity || null;
6542
- this.accessToken = accessTokenEntity || null;
6543
- this.refreshToken = refreshTokenEntity || null;
6544
- this.appMetadata = appMetadataEntity || null;
6545
- }
6546
- }
6547
-
6548
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6524
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6549
6525
 
6550
6526
  /*
6551
6527
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6617,7 +6593,7 @@ class ProtocolUtils {
6617
6593
  }
6618
6594
  }
6619
6595
 
6620
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6596
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6621
6597
 
6622
6598
  /*
6623
6599
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6642,11 +6618,10 @@ class PopTokenGenerator {
6642
6618
  async generateCnf(request, logger) {
6643
6619
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6644
6620
  const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
6645
- const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
6621
+ const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
6646
6622
  return {
6647
6623
  kid: reqCnf.kid,
6648
6624
  reqCnfString,
6649
- reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
6650
6625
  };
6651
6626
  }
6652
6627
  /**
@@ -6702,7 +6677,7 @@ class PopTokenGenerator {
6702
6677
  }
6703
6678
  }
6704
6679
 
6705
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6680
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6706
6681
  /*
6707
6682
  * Copyright (c) Microsoft Corporation. All rights reserved.
6708
6683
  * Licensed under the MIT License.
@@ -6729,7 +6704,7 @@ class PopTokenGenerator {
6729
6704
  }
6730
6705
  }
6731
6706
 
6732
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6707
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6733
6708
 
6734
6709
  /*
6735
6710
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6806,11 +6781,11 @@ class ResponseHandler {
6806
6781
  if (serverResponse.error ||
6807
6782
  serverResponse.error_description ||
6808
6783
  serverResponse.suberror) {
6809
- const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
6784
+ const errString = `Error(s): ${serverResponse.error_codes || Constants.NOT_AVAILABLE} - Timestamp: ${serverResponse.timestamp || Constants.NOT_AVAILABLE} - Description: ${serverResponse.error_description || Constants.NOT_AVAILABLE} - Correlation ID: ${serverResponse.correlation_id || Constants.NOT_AVAILABLE} - Trace ID: ${serverResponse.trace_id || Constants.NOT_AVAILABLE}`;
6810
6785
  const serverErrorNo = serverResponse.error_codes?.length
6811
6786
  ? serverResponse.error_codes[0]
6812
6787
  : undefined;
6813
- const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
6788
+ const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
6814
6789
  // check if 500 error
6815
6790
  if (refreshAccessToken &&
6816
6791
  serverResponse.status &&
@@ -6924,7 +6899,7 @@ class ResponseHandler {
6924
6899
  let cachedAccount;
6925
6900
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6926
6901
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6927
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, idTokenClaims, this.cryptoObj.base64Decode, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6902
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6928
6903
  this.logger);
6929
6904
  }
6930
6905
  // AccessToken
@@ -6977,7 +6952,13 @@ class ResponseHandler {
6977
6952
  familyId: serverTokenResponse.foci,
6978
6953
  };
6979
6954
  }
6980
- return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
6955
+ return {
6956
+ account: cachedAccount,
6957
+ idToken: cachedIdToken,
6958
+ accessToken: cachedAccessToken,
6959
+ refreshToken: cachedRefreshToken,
6960
+ appMetadata: cachedAppMetadata,
6961
+ };
6981
6962
  }
6982
6963
  /**
6983
6964
  * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
@@ -6997,7 +6978,13 @@ class ResponseHandler {
6997
6978
  let refreshOn;
6998
6979
  let familyId = Constants.EMPTY_STRING;
6999
6980
  if (cacheRecord.accessToken) {
7000
- if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
6981
+ /*
6982
+ * if the request object has `popKid` property, `signPopToken` will be set to false and
6983
+ * the token will be returned unsigned
6984
+ */
6985
+ if (cacheRecord.accessToken.tokenType ===
6986
+ AuthenticationScheme.POP &&
6987
+ !request.popKid) {
7001
6988
  const popTokenGenerator = new PopTokenGenerator(cryptoObj);
7002
6989
  const { secret, keyId } = cacheRecord.accessToken;
7003
6990
  if (!keyId) {
@@ -7060,7 +7047,7 @@ class ResponseHandler {
7060
7047
  };
7061
7048
  }
7062
7049
  }
7063
- function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7050
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7064
7051
  logger?.verbose("setCachedAccount called");
7065
7052
  // Check if base account is already cached
7066
7053
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7083,6 +7070,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
7083
7070
  }, authority, base64Decode);
7084
7071
  const tenantProfiles = baseAccount.tenantProfiles || [];
7085
7072
  if (claimsTenantId &&
7073
+ idTokenClaims &&
7086
7074
  !tenantProfiles.find((tenantProfile) => {
7087
7075
  return tenantProfile.tenantId === claimsTenantId;
7088
7076
  })) {
@@ -7093,7 +7081,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
7093
7081
  return baseAccount;
7094
7082
  }
7095
7083
 
7096
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7084
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7097
7085
 
7098
7086
  /*
7099
7087
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7261,9 +7249,16 @@ class AuthorizationCodeClient extends BaseClient {
7261
7249
  parameterBuilder.addClientInfo();
7262
7250
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7263
7251
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7264
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7252
+ let reqCnfData;
7253
+ if (!request.popKid) {
7254
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7255
+ reqCnfData = generatedReqCnfData.reqCnfString;
7256
+ }
7257
+ else {
7258
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7259
+ }
7265
7260
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7266
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7261
+ parameterBuilder.addPopToken(reqCnfData);
7267
7262
  }
7268
7263
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7269
7264
  if (request.sshJwk) {
@@ -7457,9 +7452,16 @@ class AuthorizationCodeClient extends BaseClient {
7457
7452
  // pass the req_cnf for POP
7458
7453
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7459
7454
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
7460
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
7461
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7462
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
7455
+ // req_cnf is always sent as a string for SPAs
7456
+ let reqCnfData;
7457
+ if (!request.popKid) {
7458
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7459
+ reqCnfData = generatedReqCnfData.reqCnfString;
7460
+ }
7461
+ else {
7462
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7463
+ }
7464
+ parameterBuilder.addPopToken(reqCnfData);
7463
7465
  }
7464
7466
  }
7465
7467
  return parameterBuilder.createQueryString();
@@ -7502,7 +7504,7 @@ class AuthorizationCodeClient extends BaseClient {
7502
7504
  }
7503
7505
  }
7504
7506
 
7505
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7507
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7506
7508
 
7507
7509
  /*
7508
7510
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7667,9 +7669,16 @@ class RefreshTokenClient extends BaseClient {
7667
7669
  }
7668
7670
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7669
7671
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7670
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7672
+ let reqCnfData;
7673
+ if (!request.popKid) {
7674
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7675
+ reqCnfData = generatedReqCnfData.reqCnfString;
7676
+ }
7677
+ else {
7678
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7679
+ }
7671
7680
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7672
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7681
+ parameterBuilder.addPopToken(reqCnfData);
7673
7682
  }
7674
7683
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7675
7684
  if (request.sshJwk) {
@@ -7709,7 +7718,7 @@ class RefreshTokenClient extends BaseClient {
7709
7718
  }
7710
7719
  }
7711
7720
 
7712
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7721
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7713
7722
 
7714
7723
  /*
7715
7724
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7845,7 +7854,7 @@ class SilentFlowClient extends BaseClient {
7845
7854
  }
7846
7855
  }
7847
7856
 
7848
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7857
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7849
7858
 
7850
7859
  /*
7851
7860
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7860,7 +7869,7 @@ const StubbedNetworkModule = {
7860
7869
  },
7861
7870
  };
7862
7871
 
7863
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7872
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7864
7873
  /*
7865
7874
  * Copyright (c) Microsoft Corporation. All rights reserved.
7866
7875
  * Licensed under the MIT License.
@@ -7868,7 +7877,7 @@ const StubbedNetworkModule = {
7868
7877
  const missingKidError = "missing_kid_error";
7869
7878
  const missingAlgError = "missing_alg_error";
7870
7879
 
7871
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7880
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7872
7881
 
7873
7882
  /*
7874
7883
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7893,7 +7902,7 @@ function createJoseHeaderError(code) {
7893
7902
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7894
7903
  }
7895
7904
 
7896
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7905
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7897
7906
 
7898
7907
  /*
7899
7908
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7933,7 +7942,7 @@ class JoseHeader {
7933
7942
  }
7934
7943
  }
7935
7944
 
7936
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7945
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7937
7946
 
7938
7947
  /*
7939
7948
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7991,7 +8000,7 @@ class AuthenticationHeaderParser {
7991
8000
  }
7992
8001
  }
7993
8002
 
7994
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8003
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7995
8004
 
7996
8005
  /*
7997
8006
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8195,7 +8204,7 @@ class ServerTelemetryManager {
8195
8204
  }
8196
8205
  }
8197
8206
 
8198
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8207
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8199
8208
 
8200
8209
  /*
8201
8210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8274,7 +8283,7 @@ class StubPerformanceClient {
8274
8283
  }
8275
8284
  }
8276
8285
 
8277
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8286
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8278
8287
 
8279
8288
  /*
8280
8289
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8913,6 +8922,7 @@ const nativeConnectionNotEstablished = "native_connection_not_established";
8913
8922
  const uninitializedPublicClientApplication = "uninitialized_public_client_application";
8914
8923
  const nativePromptNotSupported = "native_prompt_not_supported";
8915
8924
  const invalidBase64String = "invalid_base64_string";
8925
+ const invalidPopTokenRequest = "invalid_pop_token_request";
8916
8926
 
8917
8927
  var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
8918
8928
  __proto__: null,
@@ -8935,6 +8945,7 @@ var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
8935
8945
  interactionInProgress: interactionInProgress,
8936
8946
  invalidBase64String: invalidBase64String,
8937
8947
  invalidCacheType: invalidCacheType,
8948
+ invalidPopTokenRequest: invalidPopTokenRequest,
8938
8949
  monitorPopupTimeout: monitorPopupTimeout,
8939
8950
  monitorWindowTimeout: monitorWindowTimeout,
8940
8951
  nativeConnectionNotEstablished: nativeConnectionNotEstablished,
@@ -9017,6 +9028,7 @@ const BrowserAuthErrorMessages = {
9017
9028
  [uninitializedPublicClientApplication]: `You must call and await the initialize function before attempting to call any other MSAL API. ${ErrorLink}`,
9018
9029
  [nativePromptNotSupported]: "The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",
9019
9030
  [invalidBase64String]: "Invalid base64 encoded string.",
9031
+ [invalidPopTokenRequest]: "Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",
9020
9032
  };
9021
9033
  /**
9022
9034
  * BrowserAuthErrorMessage class containing string constants used by error codes and messages.
@@ -9207,6 +9219,10 @@ const BrowserAuthErrorMessage = {
9207
9219
  code: invalidBase64String,
9208
9220
  desc: BrowserAuthErrorMessages[invalidBase64String],
9209
9221
  },
9222
+ invalidPopTokenRequest: {
9223
+ code: invalidPopTokenRequest,
9224
+ desc: BrowserAuthErrorMessages[invalidPopTokenRequest],
9225
+ },
9210
9226
  };
9211
9227
  /**
9212
9228
  * Browser library error class thrown by the MSAL.js library for SPAs
@@ -10138,7 +10154,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
10138
10154
 
10139
10155
  /* eslint-disable header/header */
10140
10156
  const name = "@azure/msal-browser";
10141
- const version = "3.16.0";
10157
+ const version = "3.18.0";
10142
10158
 
10143
10159
  /*
10144
10160
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10954,6 +10970,21 @@ class CryptoOps {
10954
10970
  base64Decode(input) {
10955
10971
  return base64Decode(input);
10956
10972
  }
10973
+ /**
10974
+ * Encodes input string to base64 URL safe string.
10975
+ * @param input
10976
+ */
10977
+ base64UrlEncode(input) {
10978
+ return urlEncode(input);
10979
+ }
10980
+ /**
10981
+ * Stringifies and base64Url encodes input public key
10982
+ * @param inputKid
10983
+ * @returns Base64Url encoded public key
10984
+ */
10985
+ encodeKid(inputKid) {
10986
+ return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
10987
+ }
10957
10988
  /**
10958
10989
  * Generates a keypair, stores it and returns a thumbprint
10959
10990
  * @param request
@@ -12383,7 +12414,10 @@ class BrowserCacheManager extends CacheManager {
12383
12414
  const accessTokenEntity = createAccessTokenEntity(result.account?.homeAccountId, result.account.environment, result.accessToken, this.clientId, result.tenantId, result.scopes.join(" "), result.expiresOn ? result.expiresOn.getTime() / 1000 : 0, result.extExpiresOn ? result.extExpiresOn.getTime() / 1000 : 0, base64Decode, undefined, // refreshOn
12384
12415
  result.tokenType, undefined, // userAssertionHash
12385
12416
  request.sshKid, request.claims, claimsHash);
12386
- const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
12417
+ const cacheRecord = {
12418
+ idToken: idTokenEntity,
12419
+ accessToken: accessTokenEntity,
12420
+ };
12387
12421
  return this.saveCacheRecord(cacheRecord);
12388
12422
  }
12389
12423
  /**
@@ -13294,10 +13328,11 @@ class NativeInteractionClient extends BaseInteractionClient {
13294
13328
  // continue with a native call for any and all errors
13295
13329
  this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
13296
13330
  }
13331
+ const { ...nativeTokenRequest } = nativeRequest;
13297
13332
  // fall back to native calls
13298
13333
  const messageBody = {
13299
13334
  method: NativeExtensionMethod.GetToken,
13300
- request: nativeRequest,
13335
+ request: nativeTokenRequest,
13301
13336
  };
13302
13337
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
13303
13338
  const validatedResponse = this.validateNativeResponse(response);
@@ -13379,9 +13414,10 @@ class NativeInteractionClient extends BaseInteractionClient {
13379
13414
  async acquireTokenRedirect(request, rootMeasurement) {
13380
13415
  this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");
13381
13416
  const nativeRequest = await this.initializeNativeRequest(request);
13417
+ const { ...nativeTokenRequest } = nativeRequest;
13382
13418
  const messageBody = {
13383
13419
  method: NativeExtensionMethod.GetToken,
13384
- request: nativeRequest,
13420
+ request: nativeTokenRequest,
13385
13421
  };
13386
13422
  try {
13387
13423
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
@@ -13477,14 +13513,14 @@ class NativeInteractionClient extends BaseInteractionClient {
13477
13513
  }
13478
13514
  // Get the preferred_cache domain for the given authority
13479
13515
  const authority = await this.getDiscoveredAuthority(request.authority);
13480
- const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, idTokenClaims, base64Decode, response.client_info, undefined, // environment
13516
+ const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
13481
13517
  idTokenClaims.tid, undefined, // auth code payload
13482
13518
  response.account.id, this.logger);
13483
13519
  // generate authenticationResult
13484
13520
  const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
13485
13521
  // cache accounts and tokens in the appropriate storage
13486
13522
  this.cacheAccount(baseAccount);
13487
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, result.accessToken, result.tenantId, reqTimestamp);
13523
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
13488
13524
  return result;
13489
13525
  }
13490
13526
  /**
@@ -13515,7 +13551,8 @@ class NativeInteractionClient extends BaseInteractionClient {
13515
13551
  * @param response
13516
13552
  */
13517
13553
  async generatePopAccessToken(response, request) {
13518
- if (request.tokenType === AuthenticationScheme.POP) {
13554
+ if (request.tokenType === AuthenticationScheme.POP &&
13555
+ request.signPopToken) {
13519
13556
  /**
13520
13557
  * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
13521
13558
  * is still received, SHR is calculated locally
@@ -13635,8 +13672,11 @@ class NativeInteractionClient extends BaseInteractionClient {
13635
13672
  : response.expires_in) || 0;
13636
13673
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13637
13674
  const responseScopes = this.generateScopes(response, request);
13638
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode);
13639
- const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
13675
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
13676
+ const nativeCacheRecord = {
13677
+ idToken: cachedIdToken,
13678
+ accessToken: cachedAccessToken,
13679
+ };
13640
13680
  void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13641
13681
  }
13642
13682
  addTelemetryFromNativeResponse(response) {
@@ -13765,8 +13805,13 @@ class NativeInteractionClient extends BaseInteractionClient {
13765
13805
  ...request.extraQueryParameters,
13766
13806
  ...request.tokenQueryParameters,
13767
13807
  },
13768
- extendedExpiryToken: false, // Make this configurable?
13808
+ extendedExpiryToken: false,
13809
+ keyId: request.popKid,
13769
13810
  };
13811
+ // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
13812
+ if (validatedRequest.signPopToken && !!request.popKid) {
13813
+ throw createBrowserAuthError(invalidPopTokenRequest);
13814
+ }
13770
13815
  this.handleExtraBrokerParams(validatedRequest);
13771
13816
  validatedRequest.extraParameters =
13772
13817
  validatedRequest.extraParameters || {};
@@ -13781,10 +13826,20 @@ class NativeInteractionClient extends BaseInteractionClient {
13781
13826
  shrNonce: request.shrNonce,
13782
13827
  };
13783
13828
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
13784
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
13785
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
13786
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
13787
- validatedRequest.keyId = reqCnfData.kid;
13829
+ // generate reqCnf if not provided in the request
13830
+ let reqCnfData;
13831
+ if (!validatedRequest.keyId) {
13832
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(shrParameters, this.logger);
13833
+ reqCnfData = generatedReqCnfData.reqCnfString;
13834
+ validatedRequest.keyId = generatedReqCnfData.kid;
13835
+ validatedRequest.signPopToken = true;
13836
+ }
13837
+ else {
13838
+ reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
13839
+ validatedRequest.signPopToken = false;
13840
+ }
13841
+ // SPAs require whole string to be passed to broker
13842
+ validatedRequest.reqCnf = reqCnfData;
13788
13843
  }
13789
13844
  return validatedRequest;
13790
13845
  }
@@ -15389,47 +15444,32 @@ class TokenCache {
15389
15444
  * @returns `AuthenticationResult` for the response that was loaded.
15390
15445
  */
15391
15446
  loadExternalTokens(request, response, options) {
15392
- this.logger.info("TokenCache - loadExternalTokens called");
15393
- if (!response.id_token) {
15394
- throw createBrowserAuthError(unableToLoadToken);
15447
+ if (!this.isBrowserEnvironment) {
15448
+ throw createBrowserAuthError(nonBrowserEnvironment);
15395
15449
  }
15396
- const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
15397
- let cacheRecord;
15398
- let authority;
15399
- let cacheRecordAccount;
15400
- if (request.account) {
15401
- cacheRecordAccount = AccountEntity.createFromAccountInfo(request.account);
15402
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment));
15403
- }
15404
- else if (request.authority) {
15405
- const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
15406
- const authorityOptions = {
15407
- protocolMode: this.config.auth.protocolMode,
15408
- knownAuthorities: this.config.auth.knownAuthorities,
15409
- cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15410
- authorityMetadata: this.config.auth.authorityMetadata,
15411
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15412
- };
15413
- authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid());
15414
- // "clientInfo" from options takes precedence over "clientInfo" in response
15415
- if (options.clientInfo) {
15416
- this.logger.trace("TokenCache - homeAccountId from options");
15417
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, options.clientInfo);
15418
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
15419
- }
15420
- else if (response.client_info) {
15421
- this.logger.trace("TokenCache - homeAccountId from response");
15422
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, response.client_info);
15423
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
15424
- }
15425
- else {
15426
- throw createBrowserAuthError(unableToLoadToken);
15427
- }
15428
- }
15429
- else {
15430
- throw createBrowserAuthError(unableToLoadToken);
15431
- }
15432
- return this.generateAuthenticationResult(request, idTokenClaims, cacheRecord, cacheRecordAccount, authority);
15450
+ const idTokenClaims = response.id_token
15451
+ ? extractTokenClaims(response.id_token, base64Decode)
15452
+ : undefined;
15453
+ const authorityOptions = {
15454
+ protocolMode: this.config.auth.protocolMode,
15455
+ knownAuthorities: this.config.auth.knownAuthorities,
15456
+ cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15457
+ authorityMetadata: this.config.auth.authorityMetadata,
15458
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15459
+ };
15460
+ const authority = request.authority
15461
+ ? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
15462
+ : undefined;
15463
+ const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
15464
+ const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
15465
+ const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
15466
+ const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
15467
+ return this.generateAuthenticationResult(request, {
15468
+ account: cacheRecordAccount,
15469
+ idToken,
15470
+ accessToken,
15471
+ refreshToken,
15472
+ }, idTokenClaims, authority);
15433
15473
  }
15434
15474
  /**
15435
15475
  * Helper function to load account to msal-browser cache
@@ -15440,29 +15480,24 @@ class TokenCache {
15440
15480
  * @param requestHomeAccountId
15441
15481
  * @returns `AccountEntity`
15442
15482
  */
15443
- loadAccount(idTokenClaims, authority, clientInfo, requestHomeAccountId) {
15444
- if (this.isBrowserEnvironment) {
15445
- this.logger.verbose("TokenCache - loading account");
15446
- let homeAccountId;
15447
- if (requestHomeAccountId) {
15448
- homeAccountId = requestHomeAccountId;
15449
- }
15450
- else if (authority.authorityType !== undefined && clientInfo) {
15451
- homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15452
- }
15453
- if (!homeAccountId) {
15454
- throw createBrowserAuthError(unableToLoadToken);
15455
- }
15456
- const claimsTenantId = idTokenClaims.tid;
15457
- const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15458
- undefined, // nativeAccountId
15459
- this.logger);
15460
- this.storage.setAccount(cachedAccount);
15461
- return cachedAccount;
15483
+ loadAccount(request, clientInfo, idTokenClaims, authority) {
15484
+ this.logger.verbose("TokenCache - loading account");
15485
+ if (request.account) {
15486
+ const accountEntity = AccountEntity.createFromAccountInfo(request.account);
15487
+ this.storage.setAccount(accountEntity);
15488
+ return accountEntity;
15462
15489
  }
15463
- else {
15490
+ else if (!authority || (!clientInfo && !idTokenClaims)) {
15491
+ this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead.");
15464
15492
  throw createBrowserAuthError(unableToLoadToken);
15465
15493
  }
15494
+ const homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15495
+ const claimsTenantId = idTokenClaims?.tid;
15496
+ const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15497
+ undefined, // nativeAccountId
15498
+ this.logger);
15499
+ this.storage.setAccount(cachedAccount);
15500
+ return cachedAccount;
15466
15501
  }
15467
15502
  /**
15468
15503
  * Helper function to load id tokens to msal-browser cache
@@ -15472,16 +15507,15 @@ class TokenCache {
15472
15507
  * @param tenantId
15473
15508
  * @returns `IdTokenEntity`
15474
15509
  */
15475
- loadIdToken(idToken, homeAccountId, environment, tenantId) {
15476
- const idTokenEntity = createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
15477
- if (this.isBrowserEnvironment) {
15478
- this.logger.verbose("TokenCache - loading id token");
15479
- this.storage.setIdTokenCredential(idTokenEntity);
15480
- return idTokenEntity;
15481
- }
15482
- else {
15483
- throw createBrowserAuthError(unableToLoadToken);
15510
+ loadIdToken(response, homeAccountId, environment, tenantId) {
15511
+ if (!response.id_token) {
15512
+ this.logger.verbose("TokenCache - no id token found in response");
15513
+ return null;
15484
15514
  }
15515
+ this.logger.verbose("TokenCache - loading id token");
15516
+ const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
15517
+ this.storage.setIdTokenCredential(idTokenEntity);
15518
+ return idTokenEntity;
15485
15519
  }
15486
15520
  /**
15487
15521
  * Helper function to load access tokens to msal-browser cache
@@ -15494,28 +15528,30 @@ class TokenCache {
15494
15528
  */
15495
15529
  loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
15496
15530
  if (!response.access_token) {
15497
- this.logger.verbose("TokenCache - No access token provided for caching");
15531
+ this.logger.verbose("TokenCache - no access token found in response");
15498
15532
  return null;
15499
15533
  }
15500
- if (!response.expires_in) {
15501
- throw createBrowserAuthError(unableToLoadToken);
15534
+ else if (!response.expires_in) {
15535
+ this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache.");
15536
+ return null;
15502
15537
  }
15503
- if (!options.extendedExpiresOn) {
15504
- throw createBrowserAuthError(unableToLoadToken);
15538
+ else if (!response.scope &&
15539
+ (!request.scopes || !request.scopes.length)) {
15540
+ this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache.");
15541
+ return null;
15505
15542
  }
15506
- const scopes = new ScopeSet(request.scopes).printScopes();
15543
+ this.logger.verbose("TokenCache - loading access token");
15544
+ const scopes = response.scope
15545
+ ? ScopeSet.fromString(response.scope)
15546
+ : new ScopeSet(request.scopes);
15507
15547
  const expiresOn = options.expiresOn ||
15508
15548
  response.expires_in + new Date().getTime() / 1000;
15509
- const extendedExpiresOn = options.extendedExpiresOn;
15510
- const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, base64Decode);
15511
- if (this.isBrowserEnvironment) {
15512
- this.logger.verbose("TokenCache - loading access token");
15513
- this.storage.setAccessTokenCredential(accessTokenEntity);
15514
- return accessTokenEntity;
15515
- }
15516
- else {
15517
- throw createBrowserAuthError(unableToLoadToken);
15518
- }
15549
+ const extendedExpiresOn = options.extendedExpiresOn ||
15550
+ (response.ext_expires_in || response.expires_in) +
15551
+ new Date().getTime() / 1000;
15552
+ const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
15553
+ this.storage.setAccessTokenCredential(accessTokenEntity);
15554
+ return accessTokenEntity;
15519
15555
  }
15520
15556
  /**
15521
15557
  * Helper function to load refresh tokens to msal-browser cache
@@ -15525,20 +15561,16 @@ class TokenCache {
15525
15561
  * @param environment
15526
15562
  * @returns `RefreshTokenEntity`
15527
15563
  */
15528
- loadRefreshToken(request, response, homeAccountId, environment) {
15564
+ loadRefreshToken(response, homeAccountId, environment) {
15529
15565
  if (!response.refresh_token) {
15530
- this.logger.verbose("TokenCache - No refresh token provided for caching");
15566
+ this.logger.verbose("TokenCache - no refresh token found in response");
15531
15567
  return null;
15532
15568
  }
15533
- const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);
15534
- if (this.isBrowserEnvironment) {
15535
- this.logger.verbose("TokenCache - loading refresh token");
15536
- this.storage.setRefreshTokenCredential(refreshTokenEntity);
15537
- return refreshTokenEntity;
15538
- }
15539
- else {
15540
- throw createBrowserAuthError(unableToLoadToken);
15541
- }
15569
+ this.logger.verbose("TokenCache - loading refresh token");
15570
+ const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
15571
+ response.refresh_token_expires_in);
15572
+ this.storage.setRefreshTokenCredential(refreshTokenEntity);
15573
+ return refreshTokenEntity;
15542
15574
  }
15543
15575
  /**
15544
15576
  * Helper function to generate an `AuthenticationResult` for the result.
@@ -15548,8 +15580,8 @@ class TokenCache {
15548
15580
  * @param authority
15549
15581
  * @returns `AuthenticationResult`
15550
15582
  */
15551
- generateAuthenticationResult(request, idTokenClaims, cacheRecord, accountEntity, authority) {
15552
- let accessToken = Constants.EMPTY_STRING;
15583
+ generateAuthenticationResult(request, cacheRecord, idTokenClaims, authority) {
15584
+ let accessToken = "";
15553
15585
  let responseScopes = [];
15554
15586
  let expiresOn = null;
15555
15587
  let extExpiresOn;
@@ -15559,14 +15591,11 @@ class TokenCache {
15559
15591
  expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
15560
15592
  extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
15561
15593
  }
15562
- const uid = idTokenClaims.oid || idTokenClaims.sub || Constants.EMPTY_STRING;
15563
- const tid = idTokenClaims.tid || Constants.EMPTY_STRING;
15594
+ const accountEntity = cacheRecord.account;
15564
15595
  return {
15565
- authority: authority
15566
- ? authority.canonicalAuthority
15567
- : Constants.EMPTY_STRING,
15568
- uniqueId: uid,
15569
- tenantId: tid,
15596
+ authority: authority ? authority.canonicalAuthority : "",
15597
+ uniqueId: cacheRecord.account.localAccountId,
15598
+ tenantId: cacheRecord.account.realm,
15570
15599
  scopes: responseScopes,
15571
15600
  account: accountEntity.getAccountInfo(),
15572
15601
  idToken: cacheRecord.idToken?.secret || "",
@@ -15574,15 +15603,14 @@ class TokenCache {
15574
15603
  accessToken: accessToken,
15575
15604
  fromCache: true,
15576
15605
  expiresOn: expiresOn,
15577
- correlationId: request.correlationId || Constants.EMPTY_STRING,
15578
- requestId: Constants.EMPTY_STRING,
15606
+ correlationId: request.correlationId || "",
15607
+ requestId: "",
15579
15608
  extExpiresOn: extExpiresOn,
15580
- familyId: Constants.EMPTY_STRING,
15581
- tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,
15582
- state: Constants.EMPTY_STRING,
15583
- cloudGraphHostName: accountEntity.cloudGraphHostName || Constants.EMPTY_STRING,
15584
- msGraphHost: accountEntity.msGraphHost || Constants.EMPTY_STRING,
15585
- code: undefined,
15609
+ familyId: cacheRecord.refreshToken?.familyId || "",
15610
+ tokenType: cacheRecord?.accessToken?.tokenType || "",
15611
+ state: request.state || "",
15612
+ cloudGraphHostName: accountEntity.cloudGraphHostName || "",
15613
+ msGraphHost: accountEntity.msGraphHost || "",
15586
15614
  fromNativeBroker: false,
15587
15615
  };
15588
15616
  }
@@ -16824,12 +16852,13 @@ class StandardController {
16824
16852
  * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
16825
16853
  */
16826
16854
  async acquireTokenSilentAsync(request, account) {
16855
+ const trackPageVisibility = () => this.trackPageVisibility(request.correlationId);
16827
16856
  this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
16828
16857
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
16829
16858
  if (request.correlationId) {
16830
16859
  this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
16831
16860
  }
16832
- document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16861
+ document.addEventListener("visibilitychange", trackPageVisibility);
16833
16862
  const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
16834
16863
  const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
16835
16864
  const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
@@ -16908,7 +16937,7 @@ class StandardController {
16908
16937
  throw tokenRenewalError;
16909
16938
  })
16910
16939
  .finally(() => {
16911
- document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16940
+ document.removeEventListener("visibilitychange", trackPageVisibility);
16912
16941
  });
16913
16942
  }
16914
16943
  /**
@@ -17169,7 +17198,7 @@ class NestedAppAuthAdapter {
17169
17198
  const NestedAppAuthErrorMessage = {
17170
17199
  unsupportedMethod: {
17171
17200
  code: "unsupported_method",
17172
- desc: "The PKCE code challenge and verifier could not be generated.",
17201
+ desc: "This method is not supported in nested app environment.",
17173
17202
  },
17174
17203
  };
17175
17204
  class NestedAppAuthError extends AuthError {