@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,4 +1,4 @@
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
  (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.11.0 2024-06-04 */
9
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -52,6 +52,7 @@
52
52
  NOT_DEFINED: "not_defined",
53
53
  EMPTY_STRING: "",
54
54
  NOT_APPLICABLE: "N/A",
55
+ NOT_AVAILABLE: "Not Available",
55
56
  FORWARD_SLASH: "/",
56
57
  IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
57
58
  IMDS_VERSION: "2020-06-01",
@@ -314,7 +315,7 @@
314
315
  // Token renewal offset default in seconds
315
316
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
316
317
 
317
- /*! @azure/msal-common v14.11.0 2024-06-04 */
318
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
318
319
  /*
319
320
  * Copyright (c) Microsoft Corporation. All rights reserved.
320
321
  * Licensed under the MIT License.
@@ -331,7 +332,7 @@
331
332
  unexpectedError: unexpectedError
332
333
  });
333
334
 
334
- /*! @azure/msal-common v14.11.0 2024-06-04 */
335
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
335
336
 
336
337
  /*
337
338
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -380,7 +381,7 @@
380
381
  : AuthErrorMessages[code]);
381
382
  }
382
383
 
383
- /*! @azure/msal-common v14.11.0 2024-06-04 */
384
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
384
385
  /*
385
386
  * Copyright (c) Microsoft Corporation. All rights reserved.
386
387
  * Licensed under the MIT License.
@@ -478,7 +479,7 @@
478
479
  userTimeoutReached: userTimeoutReached
479
480
  });
480
481
 
481
- /*! @azure/msal-common v14.11.0 2024-06-04 */
482
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
482
483
 
483
484
  /*
484
485
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -730,7 +731,7 @@
730
731
  return new ClientAuthError(errorCode, additionalMessage);
731
732
  }
732
733
 
733
- /*! @azure/msal-common v14.11.0 2024-06-04 */
734
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
734
735
 
735
736
  /*
736
737
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -791,7 +792,7 @@
791
792
  }
792
793
  }
793
794
 
794
- /*! @azure/msal-common v14.11.0 2024-06-04 */
795
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
795
796
  /*
796
797
  * Copyright (c) Microsoft Corporation. All rights reserved.
797
798
  * Licensed under the MIT License.
@@ -806,7 +807,7 @@
806
807
  Ciam: 3,
807
808
  };
808
809
 
809
- /*! @azure/msal-common v14.11.0 2024-06-04 */
810
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
810
811
  /*
811
812
  * Copyright (c) Microsoft Corporation. All rights reserved.
812
813
  * Licensed under the MIT License.
@@ -818,7 +819,7 @@
818
819
  response.hasOwnProperty("jwks_uri"));
819
820
  }
820
821
 
821
- /*! @azure/msal-common v14.11.0 2024-06-04 */
822
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
822
823
  /*
823
824
  * Copyright (c) Microsoft Corporation. All rights reserved.
824
825
  * Licensed under the MIT License.
@@ -872,7 +873,7 @@
872
873
  urlParseError: urlParseError
873
874
  });
874
875
 
875
- /*! @azure/msal-common v14.11.0 2024-06-04 */
876
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
876
877
 
877
878
  /*
878
879
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1010,7 +1011,7 @@
1010
1011
  return new ClientConfigurationError(errorCode);
1011
1012
  }
1012
1013
 
1013
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1014
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1014
1015
  /*
1015
1016
  * Copyright (c) Microsoft Corporation. All rights reserved.
1016
1017
  * Licensed under the MIT License.
@@ -1107,7 +1108,7 @@
1107
1108
  }
1108
1109
  }
1109
1110
 
1110
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1111
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1111
1112
 
1112
1113
  /*
1113
1114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1154,7 +1155,7 @@
1154
1155
  return null;
1155
1156
  }
1156
1157
 
1157
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1158
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1158
1159
 
1159
1160
  /*
1160
1161
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1318,7 +1319,7 @@
1318
1319
  }
1319
1320
  }
1320
1321
 
1321
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1322
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1322
1323
 
1323
1324
  /*
1324
1325
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1458,7 +1459,7 @@
1458
1459
  return null;
1459
1460
  }
1460
1461
 
1461
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1462
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1462
1463
  /*
1463
1464
  * Copyright (c) Microsoft Corporation. All rights reserved.
1464
1465
  * Licensed under the MIT License.
@@ -1471,7 +1472,7 @@
1471
1472
  OIDC: "OIDC",
1472
1473
  };
1473
1474
 
1474
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1475
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1475
1476
  /*
1476
1477
  * Copyright (c) Microsoft Corporation. All rights reserved.
1477
1478
  * Licensed under the MIT License.
@@ -1491,7 +1492,7 @@
1491
1492
  AzureUsGovernment: "https://login.microsoftonline.us",
1492
1493
  };
1493
1494
 
1494
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1495
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1495
1496
  /*
1496
1497
  * Copyright (c) Microsoft Corporation. All rights reserved.
1497
1498
  * Licensed under the MIT License.
@@ -1501,7 +1502,7 @@
1501
1502
  response.hasOwnProperty("metadata"));
1502
1503
  }
1503
1504
 
1504
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1505
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1505
1506
  /*
1506
1507
  * Copyright (c) Microsoft Corporation. All rights reserved.
1507
1508
  * Licensed under the MIT License.
@@ -1511,7 +1512,7 @@
1511
1512
  response.hasOwnProperty("error_description"));
1512
1513
  }
1513
1514
 
1514
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1515
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1515
1516
  /*
1516
1517
  * Copyright (c) Microsoft Corporation. All rights reserved.
1517
1518
  * Licensed under the MIT License.
@@ -1993,7 +1994,7 @@
1993
1994
  "multiMatchedRT",
1994
1995
  ]);
1995
1996
 
1996
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1997
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1997
1998
  /*
1998
1999
  * Copyright (c) Microsoft Corporation. All rights reserved.
1999
2000
  * Licensed under the MIT License.
@@ -2089,7 +2090,7 @@
2089
2090
  };
2090
2091
  };
2091
2092
 
2092
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2093
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2093
2094
 
2094
2095
  /*
2095
2096
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2198,7 +2199,7 @@
2198
2199
  },
2199
2200
  };
2200
2201
 
2201
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2202
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2202
2203
  /*
2203
2204
  * Copyright (c) Microsoft Corporation. All rights reserved.
2204
2205
  * Licensed under the MIT License.
@@ -2235,7 +2236,7 @@
2235
2236
  return cachedAtSec > nowSeconds();
2236
2237
  }
2237
2238
 
2238
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2239
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2239
2240
 
2240
2241
  /*
2241
2242
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2562,7 +2563,7 @@
2562
2563
  return metadata.expiresAt <= nowSeconds();
2563
2564
  }
2564
2565
 
2565
- /*! @azure/msal-common v14.11.0 2024-06-04 */
2566
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2566
2567
 
2567
2568
  /*
2568
2569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3401,7 +3402,7 @@
3401
3402
  };
3402
3403
  }
3403
3404
 
3404
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3405
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3405
3406
 
3406
3407
  /*
3407
3408
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3432,7 +3433,7 @@
3432
3433
  }
3433
3434
  }
3434
3435
 
3435
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3436
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3436
3437
  /*
3437
3438
  * Copyright (c) Microsoft Corporation. All rights reserved.
3438
3439
  * Licensed under the MIT License.
@@ -3450,7 +3451,7 @@
3450
3451
  }
3451
3452
  }
3452
3453
 
3453
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3454
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3454
3455
  /*
3455
3456
  * Copyright (c) Microsoft Corporation. All rights reserved.
3456
3457
  * Licensed under the MIT License.
@@ -3497,7 +3498,7 @@
3497
3498
  const LOGIN_HINT = "login_hint";
3498
3499
  const DOMAIN_HINT = "domain_hint";
3499
3500
 
3500
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3501
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3501
3502
 
3502
3503
  /*
3503
3504
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3513,6 +3514,12 @@
3513
3514
  base64Encode: () => {
3514
3515
  throw createClientAuthError(methodNotImplemented);
3515
3516
  },
3517
+ base64UrlEncode: () => {
3518
+ throw createClientAuthError(methodNotImplemented);
3519
+ },
3520
+ encodeKid: () => {
3521
+ throw createClientAuthError(methodNotImplemented);
3522
+ },
3516
3523
  async getPublicKeyThumbprint() {
3517
3524
  throw createClientAuthError(methodNotImplemented);
3518
3525
  },
@@ -3530,7 +3537,7 @@
3530
3537
  },
3531
3538
  };
3532
3539
 
3533
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3540
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3534
3541
 
3535
3542
  /*
3536
3543
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3721,12 +3728,12 @@
3721
3728
  }
3722
3729
  }
3723
3730
 
3724
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3731
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3725
3732
  /* eslint-disable header/header */
3726
3733
  const name$1 = "@azure/msal-common";
3727
- const version$1 = "14.11.0";
3734
+ const version$1 = "14.13.0";
3728
3735
 
3729
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3736
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3730
3737
 
3731
3738
  /*
3732
3739
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3926,7 +3933,7 @@
3926
3933
  }
3927
3934
  }
3928
3935
 
3929
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3936
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3930
3937
 
3931
3938
  /*
3932
3939
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3966,7 +3973,7 @@
3966
3973
  };
3967
3974
  }
3968
3975
 
3969
- /*! @azure/msal-common v14.11.0 2024-06-04 */
3976
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3970
3977
  /*
3971
3978
  * Copyright (c) Microsoft Corporation. All rights reserved.
3972
3979
  * Licensed under the MIT License.
@@ -4028,7 +4035,7 @@
4028
4035
  return updatedAccountInfo;
4029
4036
  }
4030
4037
 
4031
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4038
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4032
4039
  /*
4033
4040
  * Copyright (c) Microsoft Corporation. All rights reserved.
4034
4041
  * Licensed under the MIT License.
@@ -4050,7 +4057,7 @@
4050
4057
  return null;
4051
4058
  }
4052
4059
 
4053
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4060
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4054
4061
 
4055
4062
  /*
4056
4063
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4173,21 +4180,21 @@
4173
4180
  // How do you account for MSA CID here?
4174
4181
  account.localAccountId =
4175
4182
  clientInfo?.uid ||
4176
- accountDetails.idTokenClaims.oid ||
4177
- accountDetails.idTokenClaims.sub ||
4183
+ accountDetails.idTokenClaims?.oid ||
4184
+ accountDetails.idTokenClaims?.sub ||
4178
4185
  "";
4179
4186
  /*
4180
4187
  * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
4181
4188
  * In most cases it will contain a single email. This field should not be relied upon if a custom
4182
4189
  * policy is configured to return more than 1 email.
4183
4190
  */
4184
- const preferredUsername = accountDetails.idTokenClaims.preferred_username ||
4185
- accountDetails.idTokenClaims.upn;
4186
- const email = accountDetails.idTokenClaims.emails
4191
+ const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
4192
+ accountDetails.idTokenClaims?.upn;
4193
+ const email = accountDetails.idTokenClaims?.emails
4187
4194
  ? accountDetails.idTokenClaims.emails[0]
4188
4195
  : null;
4189
4196
  account.username = preferredUsername || email || "";
4190
- account.name = accountDetails.idTokenClaims.name;
4197
+ account.name = accountDetails.idTokenClaims?.name || "";
4191
4198
  account.cloudGraphHostName = accountDetails.cloudGraphHostName;
4192
4199
  account.msGraphHost = accountDetails.msGraphHost;
4193
4200
  if (accountDetails.tenantProfiles) {
@@ -4297,7 +4304,7 @@
4297
4304
  }
4298
4305
  }
4299
4306
 
4300
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4307
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4301
4308
  /*
4302
4309
  * Copyright (c) Microsoft Corporation. All rights reserved.
4303
4310
  * Licensed under the MIT License.
@@ -4305,7 +4312,7 @@
4305
4312
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
4306
4313
  const cacheUnknownErrorCode = "cache_error_unknown";
4307
4314
 
4308
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4315
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4309
4316
 
4310
4317
  /*
4311
4318
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4332,7 +4339,7 @@
4332
4339
  }
4333
4340
  }
4334
4341
 
4335
- /*! @azure/msal-common v14.11.0 2024-06-04 */
4342
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4336
4343
 
4337
4344
  /*
4338
4345
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5471,7 +5478,7 @@
5471
5478
  /**
5472
5479
  * Returns true if the credential's keyId matches the one in the request, false otherwise
5473
5480
  * @param entity
5474
- * @param tokenType
5481
+ * @param keyId
5475
5482
  */
5476
5483
  matchKeyId(entity, keyId) {
5477
5484
  return !!(entity.keyId && entity.keyId === keyId);
@@ -5587,7 +5594,7 @@
5587
5594
  }
5588
5595
  }
5589
5596
 
5590
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5597
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5591
5598
 
5592
5599
  /*
5593
5600
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5685,7 +5692,7 @@
5685
5692
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5686
5693
  }
5687
5694
 
5688
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5695
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5689
5696
 
5690
5697
  /*
5691
5698
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5695,15 +5702,16 @@
5695
5702
  * Error thrown when there is an error with the server code, for example, unavailability.
5696
5703
  */
5697
5704
  class ServerError extends AuthError {
5698
- constructor(errorCode, errorMessage, subError, errorNo) {
5705
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
5699
5706
  super(errorCode, errorMessage, subError);
5700
5707
  this.name = "ServerError";
5701
5708
  this.errorNo = errorNo;
5709
+ this.status = status;
5702
5710
  Object.setPrototypeOf(this, ServerError.prototype);
5703
5711
  }
5704
5712
  }
5705
5713
 
5706
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5714
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5707
5715
 
5708
5716
  /*
5709
5717
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5801,7 +5809,7 @@
5801
5809
  }
5802
5810
  }
5803
5811
 
5804
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5812
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5805
5813
 
5806
5814
  /*
5807
5815
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5838,7 +5846,7 @@
5838
5846
  }
5839
5847
  }
5840
5848
 
5841
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5849
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5842
5850
  /*
5843
5851
  * Copyright (c) Microsoft Corporation. All rights reserved.
5844
5852
  * Licensed under the MIT License.
@@ -5848,7 +5856,7 @@
5848
5856
  UPN: "UPN",
5849
5857
  };
5850
5858
 
5851
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5859
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5852
5860
 
5853
5861
  /*
5854
5862
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5913,26 +5921,9 @@
5913
5921
  throw createClientConfigurationError(invalidCodeChallengeMethod);
5914
5922
  }
5915
5923
  }
5916
- /**
5917
- * Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
5918
- * @param request
5919
- */
5920
- static sanitizeEQParams(eQParams, queryParams) {
5921
- if (!eQParams) {
5922
- return {};
5923
- }
5924
- // Remove any query parameters already included in SSO params
5925
- queryParams.forEach((_value, key) => {
5926
- if (eQParams[key]) {
5927
- delete eQParams[key];
5928
- }
5929
- });
5930
- // remove empty string parameters
5931
- return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
5932
- }
5933
5924
  }
5934
5925
 
5935
- /*! @azure/msal-common v14.11.0 2024-06-04 */
5926
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5936
5927
 
5937
5928
  /*
5938
5929
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6220,9 +6211,10 @@
6220
6211
  * @param eQParams
6221
6212
  */
6222
6213
  addExtraQueryParameters(eQParams) {
6223
- const sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
6224
- Object.keys(sanitizedEQParams).forEach((key) => {
6225
- this.parameters.set(key, eQParams[key]);
6214
+ Object.entries(eQParams).forEach(([key, value]) => {
6215
+ if (!this.parameters.has(key) && value) {
6216
+ this.parameters.set(key, value);
6217
+ }
6226
6218
  });
6227
6219
  }
6228
6220
  addClientCapabilitiesToClaims(claims, clientCapabilities) {
@@ -6316,7 +6308,7 @@
6316
6308
  }
6317
6309
  }
6318
6310
 
6319
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6311
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6320
6312
 
6321
6313
  /*
6322
6314
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6419,7 +6411,7 @@
6419
6411
  }
6420
6412
  }
6421
6413
 
6422
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6414
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6423
6415
  /*
6424
6416
  * Copyright (c) Microsoft Corporation. All rights reserved.
6425
6417
  * Licensed under the MIT License.
@@ -6445,7 +6437,7 @@
6445
6437
  refreshTokenExpired: refreshTokenExpired
6446
6438
  });
6447
6439
 
6448
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6440
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6449
6441
 
6450
6442
  /*
6451
6443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6533,23 +6525,7 @@
6533
6525
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6534
6526
  }
6535
6527
 
6536
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6537
- /*
6538
- * Copyright (c) Microsoft Corporation. All rights reserved.
6539
- * Licensed under the MIT License.
6540
- */
6541
- /** @internal */
6542
- class CacheRecord {
6543
- constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
6544
- this.account = accountEntity || null;
6545
- this.idToken = idTokenEntity || null;
6546
- this.accessToken = accessTokenEntity || null;
6547
- this.refreshToken = refreshTokenEntity || null;
6548
- this.appMetadata = appMetadataEntity || null;
6549
- }
6550
- }
6551
-
6552
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6528
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6553
6529
 
6554
6530
  /*
6555
6531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6621,7 +6597,7 @@
6621
6597
  }
6622
6598
  }
6623
6599
 
6624
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6600
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6625
6601
 
6626
6602
  /*
6627
6603
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6646,11 +6622,10 @@
6646
6622
  async generateCnf(request, logger) {
6647
6623
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6648
6624
  const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
6649
- const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
6625
+ const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
6650
6626
  return {
6651
6627
  kid: reqCnf.kid,
6652
6628
  reqCnfString,
6653
- reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
6654
6629
  };
6655
6630
  }
6656
6631
  /**
@@ -6706,7 +6681,7 @@
6706
6681
  }
6707
6682
  }
6708
6683
 
6709
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6684
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6710
6685
  /*
6711
6686
  * Copyright (c) Microsoft Corporation. All rights reserved.
6712
6687
  * Licensed under the MIT License.
@@ -6733,7 +6708,7 @@
6733
6708
  }
6734
6709
  }
6735
6710
 
6736
- /*! @azure/msal-common v14.11.0 2024-06-04 */
6711
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6737
6712
 
6738
6713
  /*
6739
6714
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6810,11 +6785,11 @@
6810
6785
  if (serverResponse.error ||
6811
6786
  serverResponse.error_description ||
6812
6787
  serverResponse.suberror) {
6813
- const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
6788
+ 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}`;
6814
6789
  const serverErrorNo = serverResponse.error_codes?.length
6815
6790
  ? serverResponse.error_codes[0]
6816
6791
  : undefined;
6817
- const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
6792
+ const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
6818
6793
  // check if 500 error
6819
6794
  if (refreshAccessToken &&
6820
6795
  serverResponse.status &&
@@ -6928,7 +6903,7 @@
6928
6903
  let cachedAccount;
6929
6904
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6930
6905
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6931
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, idTokenClaims, this.cryptoObj.base64Decode, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6906
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6932
6907
  this.logger);
6933
6908
  }
6934
6909
  // AccessToken
@@ -6981,7 +6956,13 @@
6981
6956
  familyId: serverTokenResponse.foci,
6982
6957
  };
6983
6958
  }
6984
- return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
6959
+ return {
6960
+ account: cachedAccount,
6961
+ idToken: cachedIdToken,
6962
+ accessToken: cachedAccessToken,
6963
+ refreshToken: cachedRefreshToken,
6964
+ appMetadata: cachedAppMetadata,
6965
+ };
6985
6966
  }
6986
6967
  /**
6987
6968
  * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
@@ -7001,7 +6982,13 @@
7001
6982
  let refreshOn;
7002
6983
  let familyId = Constants.EMPTY_STRING;
7003
6984
  if (cacheRecord.accessToken) {
7004
- if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
6985
+ /*
6986
+ * if the request object has `popKid` property, `signPopToken` will be set to false and
6987
+ * the token will be returned unsigned
6988
+ */
6989
+ if (cacheRecord.accessToken.tokenType ===
6990
+ AuthenticationScheme.POP &&
6991
+ !request.popKid) {
7005
6992
  const popTokenGenerator = new PopTokenGenerator(cryptoObj);
7006
6993
  const { secret, keyId } = cacheRecord.accessToken;
7007
6994
  if (!keyId) {
@@ -7064,7 +7051,7 @@
7064
7051
  };
7065
7052
  }
7066
7053
  }
7067
- function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7054
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7068
7055
  logger?.verbose("setCachedAccount called");
7069
7056
  // Check if base account is already cached
7070
7057
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7087,6 +7074,7 @@
7087
7074
  }, authority, base64Decode);
7088
7075
  const tenantProfiles = baseAccount.tenantProfiles || [];
7089
7076
  if (claimsTenantId &&
7077
+ idTokenClaims &&
7090
7078
  !tenantProfiles.find((tenantProfile) => {
7091
7079
  return tenantProfile.tenantId === claimsTenantId;
7092
7080
  })) {
@@ -7097,7 +7085,7 @@
7097
7085
  return baseAccount;
7098
7086
  }
7099
7087
 
7100
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7088
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7101
7089
 
7102
7090
  /*
7103
7091
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7265,9 +7253,16 @@
7265
7253
  parameterBuilder.addClientInfo();
7266
7254
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7267
7255
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7268
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7256
+ let reqCnfData;
7257
+ if (!request.popKid) {
7258
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7259
+ reqCnfData = generatedReqCnfData.reqCnfString;
7260
+ }
7261
+ else {
7262
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7263
+ }
7269
7264
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7270
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7265
+ parameterBuilder.addPopToken(reqCnfData);
7271
7266
  }
7272
7267
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7273
7268
  if (request.sshJwk) {
@@ -7461,9 +7456,16 @@
7461
7456
  // pass the req_cnf for POP
7462
7457
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7463
7458
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
7464
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
7465
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7466
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
7459
+ // req_cnf is always sent as a string for SPAs
7460
+ let reqCnfData;
7461
+ if (!request.popKid) {
7462
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7463
+ reqCnfData = generatedReqCnfData.reqCnfString;
7464
+ }
7465
+ else {
7466
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7467
+ }
7468
+ parameterBuilder.addPopToken(reqCnfData);
7467
7469
  }
7468
7470
  }
7469
7471
  return parameterBuilder.createQueryString();
@@ -7506,7 +7508,7 @@
7506
7508
  }
7507
7509
  }
7508
7510
 
7509
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7511
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7510
7512
 
7511
7513
  /*
7512
7514
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7671,9 +7673,16 @@
7671
7673
  }
7672
7674
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7673
7675
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7674
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7676
+ let reqCnfData;
7677
+ if (!request.popKid) {
7678
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7679
+ reqCnfData = generatedReqCnfData.reqCnfString;
7680
+ }
7681
+ else {
7682
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7683
+ }
7675
7684
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7676
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7685
+ parameterBuilder.addPopToken(reqCnfData);
7677
7686
  }
7678
7687
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7679
7688
  if (request.sshJwk) {
@@ -7713,7 +7722,7 @@
7713
7722
  }
7714
7723
  }
7715
7724
 
7716
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7725
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7717
7726
 
7718
7727
  /*
7719
7728
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7849,7 +7858,7 @@
7849
7858
  }
7850
7859
  }
7851
7860
 
7852
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7861
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7853
7862
 
7854
7863
  /*
7855
7864
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7864,7 +7873,7 @@
7864
7873
  },
7865
7874
  };
7866
7875
 
7867
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7876
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7868
7877
  /*
7869
7878
  * Copyright (c) Microsoft Corporation. All rights reserved.
7870
7879
  * Licensed under the MIT License.
@@ -7872,7 +7881,7 @@
7872
7881
  const missingKidError = "missing_kid_error";
7873
7882
  const missingAlgError = "missing_alg_error";
7874
7883
 
7875
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7884
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7876
7885
 
7877
7886
  /*
7878
7887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7897,7 +7906,7 @@
7897
7906
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7898
7907
  }
7899
7908
 
7900
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7909
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7901
7910
 
7902
7911
  /*
7903
7912
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7937,7 +7946,7 @@
7937
7946
  }
7938
7947
  }
7939
7948
 
7940
- /*! @azure/msal-common v14.11.0 2024-06-04 */
7949
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7941
7950
 
7942
7951
  /*
7943
7952
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7995,7 +8004,7 @@
7995
8004
  }
7996
8005
  }
7997
8006
 
7998
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8007
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7999
8008
 
8000
8009
  /*
8001
8010
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8199,7 +8208,7 @@
8199
8208
  }
8200
8209
  }
8201
8210
 
8202
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8211
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8203
8212
 
8204
8213
  /*
8205
8214
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8278,7 +8287,7 @@
8278
8287
  }
8279
8288
  }
8280
8289
 
8281
- /*! @azure/msal-common v14.11.0 2024-06-04 */
8290
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8282
8291
 
8283
8292
  /*
8284
8293
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8917,6 +8926,7 @@
8917
8926
  const uninitializedPublicClientApplication = "uninitialized_public_client_application";
8918
8927
  const nativePromptNotSupported = "native_prompt_not_supported";
8919
8928
  const invalidBase64String = "invalid_base64_string";
8929
+ const invalidPopTokenRequest = "invalid_pop_token_request";
8920
8930
 
8921
8931
  var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
8922
8932
  __proto__: null,
@@ -8939,6 +8949,7 @@
8939
8949
  interactionInProgress: interactionInProgress,
8940
8950
  invalidBase64String: invalidBase64String,
8941
8951
  invalidCacheType: invalidCacheType,
8952
+ invalidPopTokenRequest: invalidPopTokenRequest,
8942
8953
  monitorPopupTimeout: monitorPopupTimeout,
8943
8954
  monitorWindowTimeout: monitorWindowTimeout,
8944
8955
  nativeConnectionNotEstablished: nativeConnectionNotEstablished,
@@ -9021,6 +9032,7 @@
9021
9032
  [uninitializedPublicClientApplication]: `You must call and await the initialize function before attempting to call any other MSAL API. ${ErrorLink}`,
9022
9033
  [nativePromptNotSupported]: "The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",
9023
9034
  [invalidBase64String]: "Invalid base64 encoded string.",
9035
+ [invalidPopTokenRequest]: "Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",
9024
9036
  };
9025
9037
  /**
9026
9038
  * BrowserAuthErrorMessage class containing string constants used by error codes and messages.
@@ -9211,6 +9223,10 @@
9211
9223
  code: invalidBase64String,
9212
9224
  desc: BrowserAuthErrorMessages[invalidBase64String],
9213
9225
  },
9226
+ invalidPopTokenRequest: {
9227
+ code: invalidPopTokenRequest,
9228
+ desc: BrowserAuthErrorMessages[invalidPopTokenRequest],
9229
+ },
9214
9230
  };
9215
9231
  /**
9216
9232
  * Browser library error class thrown by the MSAL.js library for SPAs
@@ -10142,7 +10158,7 @@
10142
10158
 
10143
10159
  /* eslint-disable header/header */
10144
10160
  const name = "@azure/msal-browser";
10145
- const version = "3.16.0";
10161
+ const version = "3.18.0";
10146
10162
 
10147
10163
  /*
10148
10164
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10958,6 +10974,21 @@
10958
10974
  base64Decode(input) {
10959
10975
  return base64Decode(input);
10960
10976
  }
10977
+ /**
10978
+ * Encodes input string to base64 URL safe string.
10979
+ * @param input
10980
+ */
10981
+ base64UrlEncode(input) {
10982
+ return urlEncode(input);
10983
+ }
10984
+ /**
10985
+ * Stringifies and base64Url encodes input public key
10986
+ * @param inputKid
10987
+ * @returns Base64Url encoded public key
10988
+ */
10989
+ encodeKid(inputKid) {
10990
+ return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
10991
+ }
10961
10992
  /**
10962
10993
  * Generates a keypair, stores it and returns a thumbprint
10963
10994
  * @param request
@@ -12387,7 +12418,10 @@
12387
12418
  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
12388
12419
  result.tokenType, undefined, // userAssertionHash
12389
12420
  request.sshKid, request.claims, claimsHash);
12390
- const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
12421
+ const cacheRecord = {
12422
+ idToken: idTokenEntity,
12423
+ accessToken: accessTokenEntity,
12424
+ };
12391
12425
  return this.saveCacheRecord(cacheRecord);
12392
12426
  }
12393
12427
  /**
@@ -13298,10 +13332,11 @@
13298
13332
  // continue with a native call for any and all errors
13299
13333
  this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
13300
13334
  }
13335
+ const { ...nativeTokenRequest } = nativeRequest;
13301
13336
  // fall back to native calls
13302
13337
  const messageBody = {
13303
13338
  method: NativeExtensionMethod.GetToken,
13304
- request: nativeRequest,
13339
+ request: nativeTokenRequest,
13305
13340
  };
13306
13341
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
13307
13342
  const validatedResponse = this.validateNativeResponse(response);
@@ -13383,9 +13418,10 @@
13383
13418
  async acquireTokenRedirect(request, rootMeasurement) {
13384
13419
  this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");
13385
13420
  const nativeRequest = await this.initializeNativeRequest(request);
13421
+ const { ...nativeTokenRequest } = nativeRequest;
13386
13422
  const messageBody = {
13387
13423
  method: NativeExtensionMethod.GetToken,
13388
- request: nativeRequest,
13424
+ request: nativeTokenRequest,
13389
13425
  };
13390
13426
  try {
13391
13427
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
@@ -13481,14 +13517,14 @@
13481
13517
  }
13482
13518
  // Get the preferred_cache domain for the given authority
13483
13519
  const authority = await this.getDiscoveredAuthority(request.authority);
13484
- const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, idTokenClaims, base64Decode, response.client_info, undefined, // environment
13520
+ const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
13485
13521
  idTokenClaims.tid, undefined, // auth code payload
13486
13522
  response.account.id, this.logger);
13487
13523
  // generate authenticationResult
13488
13524
  const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
13489
13525
  // cache accounts and tokens in the appropriate storage
13490
13526
  this.cacheAccount(baseAccount);
13491
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, result.accessToken, result.tenantId, reqTimestamp);
13527
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
13492
13528
  return result;
13493
13529
  }
13494
13530
  /**
@@ -13519,7 +13555,8 @@
13519
13555
  * @param response
13520
13556
  */
13521
13557
  async generatePopAccessToken(response, request) {
13522
- if (request.tokenType === AuthenticationScheme.POP) {
13558
+ if (request.tokenType === AuthenticationScheme.POP &&
13559
+ request.signPopToken) {
13523
13560
  /**
13524
13561
  * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
13525
13562
  * is still received, SHR is calculated locally
@@ -13639,8 +13676,11 @@
13639
13676
  : response.expires_in) || 0;
13640
13677
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13641
13678
  const responseScopes = this.generateScopes(response, request);
13642
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode);
13643
- const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
13679
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
13680
+ const nativeCacheRecord = {
13681
+ idToken: cachedIdToken,
13682
+ accessToken: cachedAccessToken,
13683
+ };
13644
13684
  void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13645
13685
  }
13646
13686
  addTelemetryFromNativeResponse(response) {
@@ -13769,8 +13809,13 @@
13769
13809
  ...request.extraQueryParameters,
13770
13810
  ...request.tokenQueryParameters,
13771
13811
  },
13772
- extendedExpiryToken: false, // Make this configurable?
13812
+ extendedExpiryToken: false,
13813
+ keyId: request.popKid,
13773
13814
  };
13815
+ // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
13816
+ if (validatedRequest.signPopToken && !!request.popKid) {
13817
+ throw createBrowserAuthError(invalidPopTokenRequest);
13818
+ }
13774
13819
  this.handleExtraBrokerParams(validatedRequest);
13775
13820
  validatedRequest.extraParameters =
13776
13821
  validatedRequest.extraParameters || {};
@@ -13785,10 +13830,20 @@
13785
13830
  shrNonce: request.shrNonce,
13786
13831
  };
13787
13832
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
13788
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
13789
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
13790
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
13791
- validatedRequest.keyId = reqCnfData.kid;
13833
+ // generate reqCnf if not provided in the request
13834
+ let reqCnfData;
13835
+ if (!validatedRequest.keyId) {
13836
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(shrParameters, this.logger);
13837
+ reqCnfData = generatedReqCnfData.reqCnfString;
13838
+ validatedRequest.keyId = generatedReqCnfData.kid;
13839
+ validatedRequest.signPopToken = true;
13840
+ }
13841
+ else {
13842
+ reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
13843
+ validatedRequest.signPopToken = false;
13844
+ }
13845
+ // SPAs require whole string to be passed to broker
13846
+ validatedRequest.reqCnf = reqCnfData;
13792
13847
  }
13793
13848
  return validatedRequest;
13794
13849
  }
@@ -15393,47 +15448,32 @@
15393
15448
  * @returns `AuthenticationResult` for the response that was loaded.
15394
15449
  */
15395
15450
  loadExternalTokens(request, response, options) {
15396
- this.logger.info("TokenCache - loadExternalTokens called");
15397
- if (!response.id_token) {
15398
- throw createBrowserAuthError(unableToLoadToken);
15451
+ if (!this.isBrowserEnvironment) {
15452
+ throw createBrowserAuthError(nonBrowserEnvironment);
15399
15453
  }
15400
- const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
15401
- let cacheRecord;
15402
- let authority;
15403
- let cacheRecordAccount;
15404
- if (request.account) {
15405
- cacheRecordAccount = AccountEntity.createFromAccountInfo(request.account);
15406
- 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));
15407
- }
15408
- else if (request.authority) {
15409
- const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
15410
- const authorityOptions = {
15411
- protocolMode: this.config.auth.protocolMode,
15412
- knownAuthorities: this.config.auth.knownAuthorities,
15413
- cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15414
- authorityMetadata: this.config.auth.authorityMetadata,
15415
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15416
- };
15417
- authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid());
15418
- // "clientInfo" from options takes precedence over "clientInfo" in response
15419
- if (options.clientInfo) {
15420
- this.logger.trace("TokenCache - homeAccountId from options");
15421
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, options.clientInfo);
15422
- 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));
15423
- }
15424
- else if (response.client_info) {
15425
- this.logger.trace("TokenCache - homeAccountId from response");
15426
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, response.client_info);
15427
- 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));
15428
- }
15429
- else {
15430
- throw createBrowserAuthError(unableToLoadToken);
15431
- }
15432
- }
15433
- else {
15434
- throw createBrowserAuthError(unableToLoadToken);
15435
- }
15436
- return this.generateAuthenticationResult(request, idTokenClaims, cacheRecord, cacheRecordAccount, authority);
15454
+ const idTokenClaims = response.id_token
15455
+ ? extractTokenClaims(response.id_token, base64Decode)
15456
+ : undefined;
15457
+ const authorityOptions = {
15458
+ protocolMode: this.config.auth.protocolMode,
15459
+ knownAuthorities: this.config.auth.knownAuthorities,
15460
+ cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15461
+ authorityMetadata: this.config.auth.authorityMetadata,
15462
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15463
+ };
15464
+ const authority = request.authority
15465
+ ? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
15466
+ : undefined;
15467
+ const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
15468
+ const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
15469
+ const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
15470
+ const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
15471
+ return this.generateAuthenticationResult(request, {
15472
+ account: cacheRecordAccount,
15473
+ idToken,
15474
+ accessToken,
15475
+ refreshToken,
15476
+ }, idTokenClaims, authority);
15437
15477
  }
15438
15478
  /**
15439
15479
  * Helper function to load account to msal-browser cache
@@ -15444,29 +15484,24 @@
15444
15484
  * @param requestHomeAccountId
15445
15485
  * @returns `AccountEntity`
15446
15486
  */
15447
- loadAccount(idTokenClaims, authority, clientInfo, requestHomeAccountId) {
15448
- if (this.isBrowserEnvironment) {
15449
- this.logger.verbose("TokenCache - loading account");
15450
- let homeAccountId;
15451
- if (requestHomeAccountId) {
15452
- homeAccountId = requestHomeAccountId;
15453
- }
15454
- else if (authority.authorityType !== undefined && clientInfo) {
15455
- homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15456
- }
15457
- if (!homeAccountId) {
15458
- throw createBrowserAuthError(unableToLoadToken);
15459
- }
15460
- const claimsTenantId = idTokenClaims.tid;
15461
- const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15462
- undefined, // nativeAccountId
15463
- this.logger);
15464
- this.storage.setAccount(cachedAccount);
15465
- return cachedAccount;
15487
+ loadAccount(request, clientInfo, idTokenClaims, authority) {
15488
+ this.logger.verbose("TokenCache - loading account");
15489
+ if (request.account) {
15490
+ const accountEntity = AccountEntity.createFromAccountInfo(request.account);
15491
+ this.storage.setAccount(accountEntity);
15492
+ return accountEntity;
15466
15493
  }
15467
- else {
15494
+ else if (!authority || (!clientInfo && !idTokenClaims)) {
15495
+ this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead.");
15468
15496
  throw createBrowserAuthError(unableToLoadToken);
15469
15497
  }
15498
+ const homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15499
+ const claimsTenantId = idTokenClaims?.tid;
15500
+ const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15501
+ undefined, // nativeAccountId
15502
+ this.logger);
15503
+ this.storage.setAccount(cachedAccount);
15504
+ return cachedAccount;
15470
15505
  }
15471
15506
  /**
15472
15507
  * Helper function to load id tokens to msal-browser cache
@@ -15476,16 +15511,15 @@
15476
15511
  * @param tenantId
15477
15512
  * @returns `IdTokenEntity`
15478
15513
  */
15479
- loadIdToken(idToken, homeAccountId, environment, tenantId) {
15480
- const idTokenEntity = createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
15481
- if (this.isBrowserEnvironment) {
15482
- this.logger.verbose("TokenCache - loading id token");
15483
- this.storage.setIdTokenCredential(idTokenEntity);
15484
- return idTokenEntity;
15485
- }
15486
- else {
15487
- throw createBrowserAuthError(unableToLoadToken);
15514
+ loadIdToken(response, homeAccountId, environment, tenantId) {
15515
+ if (!response.id_token) {
15516
+ this.logger.verbose("TokenCache - no id token found in response");
15517
+ return null;
15488
15518
  }
15519
+ this.logger.verbose("TokenCache - loading id token");
15520
+ const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
15521
+ this.storage.setIdTokenCredential(idTokenEntity);
15522
+ return idTokenEntity;
15489
15523
  }
15490
15524
  /**
15491
15525
  * Helper function to load access tokens to msal-browser cache
@@ -15498,28 +15532,30 @@
15498
15532
  */
15499
15533
  loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
15500
15534
  if (!response.access_token) {
15501
- this.logger.verbose("TokenCache - No access token provided for caching");
15535
+ this.logger.verbose("TokenCache - no access token found in response");
15502
15536
  return null;
15503
15537
  }
15504
- if (!response.expires_in) {
15505
- throw createBrowserAuthError(unableToLoadToken);
15538
+ else if (!response.expires_in) {
15539
+ this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache.");
15540
+ return null;
15506
15541
  }
15507
- if (!options.extendedExpiresOn) {
15508
- throw createBrowserAuthError(unableToLoadToken);
15542
+ else if (!response.scope &&
15543
+ (!request.scopes || !request.scopes.length)) {
15544
+ this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache.");
15545
+ return null;
15509
15546
  }
15510
- const scopes = new ScopeSet(request.scopes).printScopes();
15547
+ this.logger.verbose("TokenCache - loading access token");
15548
+ const scopes = response.scope
15549
+ ? ScopeSet.fromString(response.scope)
15550
+ : new ScopeSet(request.scopes);
15511
15551
  const expiresOn = options.expiresOn ||
15512
15552
  response.expires_in + new Date().getTime() / 1000;
15513
- const extendedExpiresOn = options.extendedExpiresOn;
15514
- const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, base64Decode);
15515
- if (this.isBrowserEnvironment) {
15516
- this.logger.verbose("TokenCache - loading access token");
15517
- this.storage.setAccessTokenCredential(accessTokenEntity);
15518
- return accessTokenEntity;
15519
- }
15520
- else {
15521
- throw createBrowserAuthError(unableToLoadToken);
15522
- }
15553
+ const extendedExpiresOn = options.extendedExpiresOn ||
15554
+ (response.ext_expires_in || response.expires_in) +
15555
+ new Date().getTime() / 1000;
15556
+ const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
15557
+ this.storage.setAccessTokenCredential(accessTokenEntity);
15558
+ return accessTokenEntity;
15523
15559
  }
15524
15560
  /**
15525
15561
  * Helper function to load refresh tokens to msal-browser cache
@@ -15529,20 +15565,16 @@
15529
15565
  * @param environment
15530
15566
  * @returns `RefreshTokenEntity`
15531
15567
  */
15532
- loadRefreshToken(request, response, homeAccountId, environment) {
15568
+ loadRefreshToken(response, homeAccountId, environment) {
15533
15569
  if (!response.refresh_token) {
15534
- this.logger.verbose("TokenCache - No refresh token provided for caching");
15570
+ this.logger.verbose("TokenCache - no refresh token found in response");
15535
15571
  return null;
15536
15572
  }
15537
- const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);
15538
- if (this.isBrowserEnvironment) {
15539
- this.logger.verbose("TokenCache - loading refresh token");
15540
- this.storage.setRefreshTokenCredential(refreshTokenEntity);
15541
- return refreshTokenEntity;
15542
- }
15543
- else {
15544
- throw createBrowserAuthError(unableToLoadToken);
15545
- }
15573
+ this.logger.verbose("TokenCache - loading refresh token");
15574
+ const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
15575
+ response.refresh_token_expires_in);
15576
+ this.storage.setRefreshTokenCredential(refreshTokenEntity);
15577
+ return refreshTokenEntity;
15546
15578
  }
15547
15579
  /**
15548
15580
  * Helper function to generate an `AuthenticationResult` for the result.
@@ -15552,8 +15584,8 @@
15552
15584
  * @param authority
15553
15585
  * @returns `AuthenticationResult`
15554
15586
  */
15555
- generateAuthenticationResult(request, idTokenClaims, cacheRecord, accountEntity, authority) {
15556
- let accessToken = Constants.EMPTY_STRING;
15587
+ generateAuthenticationResult(request, cacheRecord, idTokenClaims, authority) {
15588
+ let accessToken = "";
15557
15589
  let responseScopes = [];
15558
15590
  let expiresOn = null;
15559
15591
  let extExpiresOn;
@@ -15563,14 +15595,11 @@
15563
15595
  expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
15564
15596
  extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
15565
15597
  }
15566
- const uid = idTokenClaims.oid || idTokenClaims.sub || Constants.EMPTY_STRING;
15567
- const tid = idTokenClaims.tid || Constants.EMPTY_STRING;
15598
+ const accountEntity = cacheRecord.account;
15568
15599
  return {
15569
- authority: authority
15570
- ? authority.canonicalAuthority
15571
- : Constants.EMPTY_STRING,
15572
- uniqueId: uid,
15573
- tenantId: tid,
15600
+ authority: authority ? authority.canonicalAuthority : "",
15601
+ uniqueId: cacheRecord.account.localAccountId,
15602
+ tenantId: cacheRecord.account.realm,
15574
15603
  scopes: responseScopes,
15575
15604
  account: accountEntity.getAccountInfo(),
15576
15605
  idToken: cacheRecord.idToken?.secret || "",
@@ -15578,15 +15607,14 @@
15578
15607
  accessToken: accessToken,
15579
15608
  fromCache: true,
15580
15609
  expiresOn: expiresOn,
15581
- correlationId: request.correlationId || Constants.EMPTY_STRING,
15582
- requestId: Constants.EMPTY_STRING,
15610
+ correlationId: request.correlationId || "",
15611
+ requestId: "",
15583
15612
  extExpiresOn: extExpiresOn,
15584
- familyId: Constants.EMPTY_STRING,
15585
- tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,
15586
- state: Constants.EMPTY_STRING,
15587
- cloudGraphHostName: accountEntity.cloudGraphHostName || Constants.EMPTY_STRING,
15588
- msGraphHost: accountEntity.msGraphHost || Constants.EMPTY_STRING,
15589
- code: undefined,
15613
+ familyId: cacheRecord.refreshToken?.familyId || "",
15614
+ tokenType: cacheRecord?.accessToken?.tokenType || "",
15615
+ state: request.state || "",
15616
+ cloudGraphHostName: accountEntity.cloudGraphHostName || "",
15617
+ msGraphHost: accountEntity.msGraphHost || "",
15590
15618
  fromNativeBroker: false,
15591
15619
  };
15592
15620
  }
@@ -16828,12 +16856,13 @@
16828
16856
  * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
16829
16857
  */
16830
16858
  async acquireTokenSilentAsync(request, account) {
16859
+ const trackPageVisibility = () => this.trackPageVisibility(request.correlationId);
16831
16860
  this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
16832
16861
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
16833
16862
  if (request.correlationId) {
16834
16863
  this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
16835
16864
  }
16836
- document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16865
+ document.addEventListener("visibilitychange", trackPageVisibility);
16837
16866
  const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
16838
16867
  const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
16839
16868
  const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
@@ -16912,7 +16941,7 @@
16912
16941
  throw tokenRenewalError;
16913
16942
  })
16914
16943
  .finally(() => {
16915
- document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16944
+ document.removeEventListener("visibilitychange", trackPageVisibility);
16916
16945
  });
16917
16946
  }
16918
16947
  /**
@@ -17173,7 +17202,7 @@
17173
17202
  const NestedAppAuthErrorMessage = {
17174
17203
  unsupportedMethod: {
17175
17204
  code: "unsupported_method",
17176
- desc: "The PKCE code challenge and verifier could not be generated.",
17205
+ desc: "This method is not supported in nested app environment.",
17177
17206
  },
17178
17207
  };
17179
17208
  class NestedAppAuthError extends AuthError {