@azure/msal-browser 3.15.0 → 3.17.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 (95) 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.mjs +1 -1
  11. package/dist/cache/BrowserStorage.mjs +1 -1
  12. package/dist/cache/DatabaseStorage.mjs +1 -1
  13. package/dist/cache/MemoryStorage.mjs +1 -1
  14. package/dist/cache/TokenCache.mjs +1 -1
  15. package/dist/config/Configuration.mjs +1 -1
  16. package/dist/controllers/ControllerFactory.mjs +1 -1
  17. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  18. package/dist/controllers/StandardController.d.ts.map +1 -1
  19. package/dist/controllers/StandardController.mjs +58 -37
  20. package/dist/controllers/StandardController.mjs.map +1 -1
  21. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  22. package/dist/crypto/BrowserCrypto.mjs +1 -1
  23. package/dist/crypto/CryptoOps.d.ts +11 -0
  24. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  25. package/dist/crypto/CryptoOps.mjs +16 -1
  26. package/dist/crypto/CryptoOps.mjs.map +1 -1
  27. package/dist/crypto/PkceGenerator.mjs +1 -1
  28. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  29. package/dist/encode/Base64Decode.mjs +1 -1
  30. package/dist/encode/Base64Encode.mjs +1 -1
  31. package/dist/error/BrowserAuthError.d.ts +5 -0
  32. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  33. package/dist/error/BrowserAuthError.mjs +7 -2
  34. package/dist/error/BrowserAuthError.mjs.map +1 -1
  35. package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
  36. package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  37. package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
  38. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  39. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  40. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  41. package/dist/error/NativeAuthError.mjs +1 -1
  42. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  43. package/dist/error/NestedAppAuthError.mjs +1 -1
  44. package/dist/event/EventHandler.mjs +1 -1
  45. package/dist/event/EventMessage.mjs +1 -1
  46. package/dist/event/EventType.mjs +1 -1
  47. package/dist/index.mjs +1 -1
  48. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  49. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  50. package/dist/interaction_client/NativeInteractionClient.d.ts +4 -3
  51. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  52. package/dist/interaction_client/NativeInteractionClient.mjs +34 -14
  53. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  54. package/dist/interaction_client/PopupClient.mjs +1 -1
  55. package/dist/interaction_client/RedirectClient.mjs +1 -1
  56. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  57. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  58. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  59. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  60. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  61. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  62. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  63. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  64. package/dist/naa/BridgeError.mjs +1 -1
  65. package/dist/naa/BridgeProxy.mjs +1 -1
  66. package/dist/naa/BridgeStatusCode.mjs +1 -1
  67. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  68. package/dist/navigation/NavigationClient.mjs +1 -1
  69. package/dist/network/FetchClient.mjs +1 -1
  70. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  71. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  72. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  73. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  74. package/dist/packageMetadata.d.ts +1 -1
  75. package/dist/packageMetadata.mjs +2 -2
  76. package/dist/request/RequestHelpers.mjs +1 -1
  77. package/dist/response/ResponseHandler.mjs +1 -1
  78. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  79. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  80. package/dist/utils/BrowserConstants.mjs +1 -1
  81. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  82. package/dist/utils/BrowserUtils.mjs +1 -1
  83. package/lib/msal-browser.cjs +229 -127
  84. package/lib/msal-browser.cjs.map +1 -1
  85. package/lib/msal-browser.js +229 -127
  86. package/lib/msal-browser.js.map +1 -1
  87. package/lib/msal-browser.min.js +61 -61
  88. package/package.json +2 -2
  89. package/src/broker/nativeBroker/NativeRequest.ts +1 -0
  90. package/src/controllers/StandardController.ts +89 -63
  91. package/src/crypto/CryptoOps.ts +17 -0
  92. package/src/error/BrowserAuthError.ts +8 -0
  93. package/src/error/BrowserAuthErrorCodes.ts +1 -0
  94. package/src/interaction_client/NativeInteractionClient.ts +55 -18
  95. package/src/packageMetadata.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.15.0 2024-05-28 */
1
+ /*! @azure/msal-browser v3.17.0 2024-06-10 */
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.10.0 2024-05-28 */
9
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -314,7 +314,7 @@
314
314
  // Token renewal offset default in seconds
315
315
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
316
316
 
317
- /*! @azure/msal-common v14.10.0 2024-05-28 */
317
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
318
318
  /*
319
319
  * Copyright (c) Microsoft Corporation. All rights reserved.
320
320
  * Licensed under the MIT License.
@@ -331,7 +331,7 @@
331
331
  unexpectedError: unexpectedError
332
332
  });
333
333
 
334
- /*! @azure/msal-common v14.10.0 2024-05-28 */
334
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
335
335
 
336
336
  /*
337
337
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -380,7 +380,7 @@
380
380
  : AuthErrorMessages[code]);
381
381
  }
382
382
 
383
- /*! @azure/msal-common v14.10.0 2024-05-28 */
383
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
384
384
  /*
385
385
  * Copyright (c) Microsoft Corporation. All rights reserved.
386
386
  * Licensed under the MIT License.
@@ -478,7 +478,7 @@
478
478
  userTimeoutReached: userTimeoutReached
479
479
  });
480
480
 
481
- /*! @azure/msal-common v14.10.0 2024-05-28 */
481
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
482
482
 
483
483
  /*
484
484
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -730,7 +730,7 @@
730
730
  return new ClientAuthError(errorCode, additionalMessage);
731
731
  }
732
732
 
733
- /*! @azure/msal-common v14.10.0 2024-05-28 */
733
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
734
734
 
735
735
  /*
736
736
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -791,7 +791,7 @@
791
791
  }
792
792
  }
793
793
 
794
- /*! @azure/msal-common v14.10.0 2024-05-28 */
794
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
795
795
  /*
796
796
  * Copyright (c) Microsoft Corporation. All rights reserved.
797
797
  * Licensed under the MIT License.
@@ -806,7 +806,7 @@
806
806
  Ciam: 3,
807
807
  };
808
808
 
809
- /*! @azure/msal-common v14.10.0 2024-05-28 */
809
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
810
810
  /*
811
811
  * Copyright (c) Microsoft Corporation. All rights reserved.
812
812
  * Licensed under the MIT License.
@@ -818,7 +818,7 @@
818
818
  response.hasOwnProperty("jwks_uri"));
819
819
  }
820
820
 
821
- /*! @azure/msal-common v14.10.0 2024-05-28 */
821
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
822
822
  /*
823
823
  * Copyright (c) Microsoft Corporation. All rights reserved.
824
824
  * Licensed under the MIT License.
@@ -872,7 +872,7 @@
872
872
  urlParseError: urlParseError
873
873
  });
874
874
 
875
- /*! @azure/msal-common v14.10.0 2024-05-28 */
875
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
876
876
 
877
877
  /*
878
878
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1010,7 +1010,7 @@
1010
1010
  return new ClientConfigurationError(errorCode);
1011
1011
  }
1012
1012
 
1013
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1013
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1014
1014
  /*
1015
1015
  * Copyright (c) Microsoft Corporation. All rights reserved.
1016
1016
  * Licensed under the MIT License.
@@ -1107,7 +1107,7 @@
1107
1107
  }
1108
1108
  }
1109
1109
 
1110
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1110
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1111
1111
 
1112
1112
  /*
1113
1113
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1154,7 +1154,7 @@
1154
1154
  return null;
1155
1155
  }
1156
1156
 
1157
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1157
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1158
1158
 
1159
1159
  /*
1160
1160
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1318,7 +1318,7 @@
1318
1318
  }
1319
1319
  }
1320
1320
 
1321
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1321
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1322
1322
 
1323
1323
  /*
1324
1324
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1458,7 +1458,7 @@
1458
1458
  return null;
1459
1459
  }
1460
1460
 
1461
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1461
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1462
1462
  /*
1463
1463
  * Copyright (c) Microsoft Corporation. All rights reserved.
1464
1464
  * Licensed under the MIT License.
@@ -1471,7 +1471,7 @@
1471
1471
  OIDC: "OIDC",
1472
1472
  };
1473
1473
 
1474
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1474
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1475
1475
  /*
1476
1476
  * Copyright (c) Microsoft Corporation. All rights reserved.
1477
1477
  * Licensed under the MIT License.
@@ -1491,7 +1491,7 @@
1491
1491
  AzureUsGovernment: "https://login.microsoftonline.us",
1492
1492
  };
1493
1493
 
1494
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1494
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1495
1495
  /*
1496
1496
  * Copyright (c) Microsoft Corporation. All rights reserved.
1497
1497
  * Licensed under the MIT License.
@@ -1501,7 +1501,7 @@
1501
1501
  response.hasOwnProperty("metadata"));
1502
1502
  }
1503
1503
 
1504
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1504
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1505
1505
  /*
1506
1506
  * Copyright (c) Microsoft Corporation. All rights reserved.
1507
1507
  * Licensed under the MIT License.
@@ -1511,7 +1511,7 @@
1511
1511
  response.hasOwnProperty("error_description"));
1512
1512
  }
1513
1513
 
1514
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1514
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1515
1515
  /*
1516
1516
  * Copyright (c) Microsoft Corporation. All rights reserved.
1517
1517
  * Licensed under the MIT License.
@@ -1548,9 +1548,16 @@
1548
1548
  * Used to acquire a new access token interactively through pop ups
1549
1549
  */
1550
1550
  AcquireTokenPopup: "acquireTokenPopup",
1551
+ /**
1552
+ * acquireTokenPreRedirect (msal-browser).
1553
+ * First part of the redirect flow.
1554
+ * Used to acquire a new access token interactively through redirects.
1555
+ */
1556
+ AcquireTokenPreRedirect: "acquireTokenPreRedirect",
1551
1557
  /**
1552
1558
  * acquireTokenRedirect (msal-browser).
1553
- * Used to acquire a new access token interactively through redirects
1559
+ * Second part of the redirect flow.
1560
+ * Used to acquire a new access token interactively through redirects.
1554
1561
  */
1555
1562
  AcquireTokenRedirect: "acquireTokenRedirect",
1556
1563
  /**
@@ -1986,7 +1993,7 @@
1986
1993
  "multiMatchedRT",
1987
1994
  ]);
1988
1995
 
1989
- /*! @azure/msal-common v14.10.0 2024-05-28 */
1996
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
1990
1997
  /*
1991
1998
  * Copyright (c) Microsoft Corporation. All rights reserved.
1992
1999
  * Licensed under the MIT License.
@@ -2082,7 +2089,7 @@
2082
2089
  };
2083
2090
  };
2084
2091
 
2085
- /*! @azure/msal-common v14.10.0 2024-05-28 */
2092
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2086
2093
 
2087
2094
  /*
2088
2095
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2191,7 +2198,7 @@
2191
2198
  },
2192
2199
  };
2193
2200
 
2194
- /*! @azure/msal-common v14.10.0 2024-05-28 */
2201
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2195
2202
  /*
2196
2203
  * Copyright (c) Microsoft Corporation. All rights reserved.
2197
2204
  * Licensed under the MIT License.
@@ -2228,7 +2235,7 @@
2228
2235
  return cachedAtSec > nowSeconds();
2229
2236
  }
2230
2237
 
2231
- /*! @azure/msal-common v14.10.0 2024-05-28 */
2238
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2232
2239
 
2233
2240
  /*
2234
2241
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2555,7 +2562,7 @@
2555
2562
  return metadata.expiresAt <= nowSeconds();
2556
2563
  }
2557
2564
 
2558
- /*! @azure/msal-common v14.10.0 2024-05-28 */
2565
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2559
2566
 
2560
2567
  /*
2561
2568
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3394,7 +3401,7 @@
3394
3401
  };
3395
3402
  }
3396
3403
 
3397
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3404
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3398
3405
 
3399
3406
  /*
3400
3407
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3425,7 +3432,7 @@
3425
3432
  }
3426
3433
  }
3427
3434
 
3428
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3435
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3429
3436
  /*
3430
3437
  * Copyright (c) Microsoft Corporation. All rights reserved.
3431
3438
  * Licensed under the MIT License.
@@ -3443,7 +3450,7 @@
3443
3450
  }
3444
3451
  }
3445
3452
 
3446
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3453
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3447
3454
  /*
3448
3455
  * Copyright (c) Microsoft Corporation. All rights reserved.
3449
3456
  * Licensed under the MIT License.
@@ -3490,7 +3497,7 @@
3490
3497
  const LOGIN_HINT = "login_hint";
3491
3498
  const DOMAIN_HINT = "domain_hint";
3492
3499
 
3493
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3500
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3494
3501
 
3495
3502
  /*
3496
3503
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3506,6 +3513,12 @@
3506
3513
  base64Encode: () => {
3507
3514
  throw createClientAuthError(methodNotImplemented);
3508
3515
  },
3516
+ base64UrlEncode: () => {
3517
+ throw createClientAuthError(methodNotImplemented);
3518
+ },
3519
+ encodeKid: () => {
3520
+ throw createClientAuthError(methodNotImplemented);
3521
+ },
3509
3522
  async getPublicKeyThumbprint() {
3510
3523
  throw createClientAuthError(methodNotImplemented);
3511
3524
  },
@@ -3523,7 +3536,7 @@
3523
3536
  },
3524
3537
  };
3525
3538
 
3526
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3539
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3527
3540
 
3528
3541
  /*
3529
3542
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3714,12 +3727,12 @@
3714
3727
  }
3715
3728
  }
3716
3729
 
3717
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3730
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3718
3731
  /* eslint-disable header/header */
3719
3732
  const name$1 = "@azure/msal-common";
3720
- const version$1 = "14.10.0";
3733
+ const version$1 = "14.12.0";
3721
3734
 
3722
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3735
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3723
3736
 
3724
3737
  /*
3725
3738
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3919,7 +3932,7 @@
3919
3932
  }
3920
3933
  }
3921
3934
 
3922
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3935
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3923
3936
 
3924
3937
  /*
3925
3938
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3959,7 +3972,7 @@
3959
3972
  };
3960
3973
  }
3961
3974
 
3962
- /*! @azure/msal-common v14.10.0 2024-05-28 */
3975
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
3963
3976
  /*
3964
3977
  * Copyright (c) Microsoft Corporation. All rights reserved.
3965
3978
  * Licensed under the MIT License.
@@ -4021,7 +4034,7 @@
4021
4034
  return updatedAccountInfo;
4022
4035
  }
4023
4036
 
4024
- /*! @azure/msal-common v14.10.0 2024-05-28 */
4037
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
4025
4038
  /*
4026
4039
  * Copyright (c) Microsoft Corporation. All rights reserved.
4027
4040
  * Licensed under the MIT License.
@@ -4043,7 +4056,7 @@
4043
4056
  return null;
4044
4057
  }
4045
4058
 
4046
- /*! @azure/msal-common v14.10.0 2024-05-28 */
4059
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
4047
4060
 
4048
4061
  /*
4049
4062
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4290,7 +4303,7 @@
4290
4303
  }
4291
4304
  }
4292
4305
 
4293
- /*! @azure/msal-common v14.10.0 2024-05-28 */
4306
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
4294
4307
  /*
4295
4308
  * Copyright (c) Microsoft Corporation. All rights reserved.
4296
4309
  * Licensed under the MIT License.
@@ -4298,7 +4311,7 @@
4298
4311
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
4299
4312
  const cacheUnknownErrorCode = "cache_error_unknown";
4300
4313
 
4301
- /*! @azure/msal-common v14.10.0 2024-05-28 */
4314
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
4302
4315
 
4303
4316
  /*
4304
4317
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4325,7 +4338,7 @@
4325
4338
  }
4326
4339
  }
4327
4340
 
4328
- /*! @azure/msal-common v14.10.0 2024-05-28 */
4341
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
4329
4342
 
4330
4343
  /*
4331
4344
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5464,7 +5477,7 @@
5464
5477
  /**
5465
5478
  * Returns true if the credential's keyId matches the one in the request, false otherwise
5466
5479
  * @param entity
5467
- * @param tokenType
5480
+ * @param keyId
5468
5481
  */
5469
5482
  matchKeyId(entity, keyId) {
5470
5483
  return !!(entity.keyId && entity.keyId === keyId);
@@ -5580,7 +5593,7 @@
5580
5593
  }
5581
5594
  }
5582
5595
 
5583
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5596
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5584
5597
 
5585
5598
  /*
5586
5599
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5678,7 +5691,7 @@
5678
5691
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5679
5692
  }
5680
5693
 
5681
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5694
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5682
5695
 
5683
5696
  /*
5684
5697
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5696,7 +5709,7 @@
5696
5709
  }
5697
5710
  }
5698
5711
 
5699
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5712
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5700
5713
 
5701
5714
  /*
5702
5715
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5794,7 +5807,7 @@
5794
5807
  }
5795
5808
  }
5796
5809
 
5797
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5810
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5798
5811
 
5799
5812
  /*
5800
5813
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5831,7 +5844,7 @@
5831
5844
  }
5832
5845
  }
5833
5846
 
5834
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5847
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5835
5848
  /*
5836
5849
  * Copyright (c) Microsoft Corporation. All rights reserved.
5837
5850
  * Licensed under the MIT License.
@@ -5841,7 +5854,7 @@
5841
5854
  UPN: "UPN",
5842
5855
  };
5843
5856
 
5844
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5857
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5845
5858
 
5846
5859
  /*
5847
5860
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5925,7 +5938,7 @@
5925
5938
  }
5926
5939
  }
5927
5940
 
5928
- /*! @azure/msal-common v14.10.0 2024-05-28 */
5941
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
5929
5942
 
5930
5943
  /*
5931
5944
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6309,7 +6322,7 @@
6309
6322
  }
6310
6323
  }
6311
6324
 
6312
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6325
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6313
6326
 
6314
6327
  /*
6315
6328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6412,7 +6425,7 @@
6412
6425
  }
6413
6426
  }
6414
6427
 
6415
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6428
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6416
6429
  /*
6417
6430
  * Copyright (c) Microsoft Corporation. All rights reserved.
6418
6431
  * Licensed under the MIT License.
@@ -6438,7 +6451,7 @@
6438
6451
  refreshTokenExpired: refreshTokenExpired
6439
6452
  });
6440
6453
 
6441
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6454
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6442
6455
 
6443
6456
  /*
6444
6457
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6526,7 +6539,7 @@
6526
6539
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6527
6540
  }
6528
6541
 
6529
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6542
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6530
6543
  /*
6531
6544
  * Copyright (c) Microsoft Corporation. All rights reserved.
6532
6545
  * Licensed under the MIT License.
@@ -6542,7 +6555,7 @@
6542
6555
  }
6543
6556
  }
6544
6557
 
6545
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6558
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6546
6559
 
6547
6560
  /*
6548
6561
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6614,7 +6627,7 @@
6614
6627
  }
6615
6628
  }
6616
6629
 
6617
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6630
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6618
6631
 
6619
6632
  /*
6620
6633
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6639,11 +6652,10 @@
6639
6652
  async generateCnf(request, logger) {
6640
6653
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6641
6654
  const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
6642
- const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
6655
+ const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
6643
6656
  return {
6644
6657
  kid: reqCnf.kid,
6645
6658
  reqCnfString,
6646
- reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
6647
6659
  };
6648
6660
  }
6649
6661
  /**
@@ -6699,7 +6711,7 @@
6699
6711
  }
6700
6712
  }
6701
6713
 
6702
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6714
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6703
6715
  /*
6704
6716
  * Copyright (c) Microsoft Corporation. All rights reserved.
6705
6717
  * Licensed under the MIT License.
@@ -6726,7 +6738,7 @@
6726
6738
  }
6727
6739
  }
6728
6740
 
6729
- /*! @azure/msal-common v14.10.0 2024-05-28 */
6741
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
6730
6742
 
6731
6743
  /*
6732
6744
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6994,7 +7006,13 @@
6994
7006
  let refreshOn;
6995
7007
  let familyId = Constants.EMPTY_STRING;
6996
7008
  if (cacheRecord.accessToken) {
6997
- if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
7009
+ /*
7010
+ * if the request object has `popKid` property, `signPopToken` will be set to false and
7011
+ * the token will be returned unsigned
7012
+ */
7013
+ if (cacheRecord.accessToken.tokenType ===
7014
+ AuthenticationScheme.POP &&
7015
+ !request.popKid) {
6998
7016
  const popTokenGenerator = new PopTokenGenerator(cryptoObj);
6999
7017
  const { secret, keyId } = cacheRecord.accessToken;
7000
7018
  if (!keyId) {
@@ -7090,7 +7108,7 @@
7090
7108
  return baseAccount;
7091
7109
  }
7092
7110
 
7093
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7111
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7094
7112
 
7095
7113
  /*
7096
7114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7258,9 +7276,16 @@
7258
7276
  parameterBuilder.addClientInfo();
7259
7277
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7260
7278
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7261
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7279
+ let reqCnfData;
7280
+ if (!request.popKid) {
7281
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7282
+ reqCnfData = generatedReqCnfData.reqCnfString;
7283
+ }
7284
+ else {
7285
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7286
+ }
7262
7287
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7263
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7288
+ parameterBuilder.addPopToken(reqCnfData);
7264
7289
  }
7265
7290
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7266
7291
  if (request.sshJwk) {
@@ -7454,9 +7479,16 @@
7454
7479
  // pass the req_cnf for POP
7455
7480
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7456
7481
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
7457
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
7458
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7459
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
7482
+ // req_cnf is always sent as a string for SPAs
7483
+ let reqCnfData;
7484
+ if (!request.popKid) {
7485
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7486
+ reqCnfData = generatedReqCnfData.reqCnfString;
7487
+ }
7488
+ else {
7489
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7490
+ }
7491
+ parameterBuilder.addPopToken(reqCnfData);
7460
7492
  }
7461
7493
  }
7462
7494
  return parameterBuilder.createQueryString();
@@ -7499,7 +7531,7 @@
7499
7531
  }
7500
7532
  }
7501
7533
 
7502
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7534
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7503
7535
 
7504
7536
  /*
7505
7537
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7664,9 +7696,16 @@
7664
7696
  }
7665
7697
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7666
7698
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7667
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7699
+ let reqCnfData;
7700
+ if (!request.popKid) {
7701
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7702
+ reqCnfData = generatedReqCnfData.reqCnfString;
7703
+ }
7704
+ else {
7705
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7706
+ }
7668
7707
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7669
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7708
+ parameterBuilder.addPopToken(reqCnfData);
7670
7709
  }
7671
7710
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7672
7711
  if (request.sshJwk) {
@@ -7706,7 +7745,7 @@
7706
7745
  }
7707
7746
  }
7708
7747
 
7709
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7748
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7710
7749
 
7711
7750
  /*
7712
7751
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7842,7 +7881,7 @@
7842
7881
  }
7843
7882
  }
7844
7883
 
7845
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7884
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7846
7885
 
7847
7886
  /*
7848
7887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7857,7 +7896,7 @@
7857
7896
  },
7858
7897
  };
7859
7898
 
7860
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7899
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7861
7900
  /*
7862
7901
  * Copyright (c) Microsoft Corporation. All rights reserved.
7863
7902
  * Licensed under the MIT License.
@@ -7865,7 +7904,7 @@
7865
7904
  const missingKidError = "missing_kid_error";
7866
7905
  const missingAlgError = "missing_alg_error";
7867
7906
 
7868
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7907
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7869
7908
 
7870
7909
  /*
7871
7910
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7890,7 +7929,7 @@
7890
7929
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7891
7930
  }
7892
7931
 
7893
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7932
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7894
7933
 
7895
7934
  /*
7896
7935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7930,7 +7969,7 @@
7930
7969
  }
7931
7970
  }
7932
7971
 
7933
- /*! @azure/msal-common v14.10.0 2024-05-28 */
7972
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7934
7973
 
7935
7974
  /*
7936
7975
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7988,7 +8027,7 @@
7988
8027
  }
7989
8028
  }
7990
8029
 
7991
- /*! @azure/msal-common v14.10.0 2024-05-28 */
8030
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
7992
8031
 
7993
8032
  /*
7994
8033
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8192,7 +8231,7 @@
8192
8231
  }
8193
8232
  }
8194
8233
 
8195
- /*! @azure/msal-common v14.10.0 2024-05-28 */
8234
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
8196
8235
 
8197
8236
  /*
8198
8237
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8271,7 +8310,7 @@
8271
8310
  }
8272
8311
  }
8273
8312
 
8274
- /*! @azure/msal-common v14.10.0 2024-05-28 */
8313
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
8275
8314
 
8276
8315
  /*
8277
8316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8910,6 +8949,7 @@
8910
8949
  const uninitializedPublicClientApplication = "uninitialized_public_client_application";
8911
8950
  const nativePromptNotSupported = "native_prompt_not_supported";
8912
8951
  const invalidBase64String = "invalid_base64_string";
8952
+ const invalidPopTokenRequest = "invalid_pop_token_request";
8913
8953
 
8914
8954
  var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
8915
8955
  __proto__: null,
@@ -8932,6 +8972,7 @@
8932
8972
  interactionInProgress: interactionInProgress,
8933
8973
  invalidBase64String: invalidBase64String,
8934
8974
  invalidCacheType: invalidCacheType,
8975
+ invalidPopTokenRequest: invalidPopTokenRequest,
8935
8976
  monitorPopupTimeout: monitorPopupTimeout,
8936
8977
  monitorWindowTimeout: monitorWindowTimeout,
8937
8978
  nativeConnectionNotEstablished: nativeConnectionNotEstablished,
@@ -9014,6 +9055,7 @@
9014
9055
  [uninitializedPublicClientApplication]: `You must call and await the initialize function before attempting to call any other MSAL API. ${ErrorLink}`,
9015
9056
  [nativePromptNotSupported]: "The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",
9016
9057
  [invalidBase64String]: "Invalid base64 encoded string.",
9058
+ [invalidPopTokenRequest]: "Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",
9017
9059
  };
9018
9060
  /**
9019
9061
  * BrowserAuthErrorMessage class containing string constants used by error codes and messages.
@@ -9204,6 +9246,10 @@
9204
9246
  code: invalidBase64String,
9205
9247
  desc: BrowserAuthErrorMessages[invalidBase64String],
9206
9248
  },
9249
+ invalidPopTokenRequest: {
9250
+ code: invalidPopTokenRequest,
9251
+ desc: BrowserAuthErrorMessages[invalidPopTokenRequest],
9252
+ },
9207
9253
  };
9208
9254
  /**
9209
9255
  * Browser library error class thrown by the MSAL.js library for SPAs
@@ -10135,7 +10181,7 @@
10135
10181
 
10136
10182
  /* eslint-disable header/header */
10137
10183
  const name = "@azure/msal-browser";
10138
- const version = "3.15.0";
10184
+ const version = "3.17.0";
10139
10185
 
10140
10186
  /*
10141
10187
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10951,6 +10997,21 @@
10951
10997
  base64Decode(input) {
10952
10998
  return base64Decode(input);
10953
10999
  }
11000
+ /**
11001
+ * Encodes input string to base64 URL safe string.
11002
+ * @param input
11003
+ */
11004
+ base64UrlEncode(input) {
11005
+ return urlEncode(input);
11006
+ }
11007
+ /**
11008
+ * Stringifies and base64Url encodes input public key
11009
+ * @param inputKid
11010
+ * @returns Base64Url encoded public key
11011
+ */
11012
+ encodeKid(inputKid) {
11013
+ return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
11014
+ }
10954
11015
  /**
10955
11016
  * Generates a keypair, stores it and returns a thumbprint
10956
11017
  * @param request
@@ -13291,10 +13352,11 @@
13291
13352
  // continue with a native call for any and all errors
13292
13353
  this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
13293
13354
  }
13355
+ const { ...nativeTokenRequest } = nativeRequest;
13294
13356
  // fall back to native calls
13295
13357
  const messageBody = {
13296
13358
  method: NativeExtensionMethod.GetToken,
13297
- request: nativeRequest,
13359
+ request: nativeTokenRequest,
13298
13360
  };
13299
13361
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
13300
13362
  const validatedResponse = this.validateNativeResponse(response);
@@ -13370,14 +13432,16 @@
13370
13432
  }
13371
13433
  /**
13372
13434
  * Acquires a token from native platform then redirects to the redirectUri instead of returning the response
13373
- * @param request
13435
+ * @param {RedirectRequest} request
13436
+ * @param {InProgressPerformanceEvent} rootMeasurement
13374
13437
  */
13375
- async acquireTokenRedirect(request) {
13438
+ async acquireTokenRedirect(request, rootMeasurement) {
13376
13439
  this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");
13377
13440
  const nativeRequest = await this.initializeNativeRequest(request);
13441
+ const { ...nativeTokenRequest } = nativeRequest;
13378
13442
  const messageBody = {
13379
13443
  method: NativeExtensionMethod.GetToken,
13380
- request: nativeRequest,
13444
+ request: nativeTokenRequest,
13381
13445
  };
13382
13446
  try {
13383
13447
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
@@ -13398,6 +13462,7 @@
13398
13462
  const redirectUri = this.config.auth.navigateToLoginRequestUrl
13399
13463
  ? window.location.href
13400
13464
  : this.getRedirectUri(request.redirectUri);
13465
+ rootMeasurement.end({ success: true });
13401
13466
  await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
13402
13467
  }
13403
13468
  /**
@@ -13479,7 +13544,7 @@
13479
13544
  const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
13480
13545
  // cache accounts and tokens in the appropriate storage
13481
13546
  this.cacheAccount(baseAccount);
13482
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, result.accessToken, result.tenantId, reqTimestamp);
13547
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
13483
13548
  return result;
13484
13549
  }
13485
13550
  /**
@@ -13510,7 +13575,8 @@
13510
13575
  * @param response
13511
13576
  */
13512
13577
  async generatePopAccessToken(response, request) {
13513
- if (request.tokenType === AuthenticationScheme.POP) {
13578
+ if (request.tokenType === AuthenticationScheme.POP &&
13579
+ request.signPopToken) {
13514
13580
  /**
13515
13581
  * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
13516
13582
  * is still received, SHR is calculated locally
@@ -13630,7 +13696,7 @@
13630
13696
  : response.expires_in) || 0;
13631
13697
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13632
13698
  const responseScopes = this.generateScopes(response, request);
13633
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode);
13699
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
13634
13700
  const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
13635
13701
  void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13636
13702
  }
@@ -13760,8 +13826,13 @@
13760
13826
  ...request.extraQueryParameters,
13761
13827
  ...request.tokenQueryParameters,
13762
13828
  },
13763
- extendedExpiryToken: false, // Make this configurable?
13829
+ extendedExpiryToken: false,
13830
+ keyId: request.popKid,
13764
13831
  };
13832
+ // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
13833
+ if (validatedRequest.signPopToken && !!request.popKid) {
13834
+ throw createBrowserAuthError(invalidPopTokenRequest);
13835
+ }
13765
13836
  this.handleExtraBrokerParams(validatedRequest);
13766
13837
  validatedRequest.extraParameters =
13767
13838
  validatedRequest.extraParameters || {};
@@ -13776,10 +13847,20 @@
13776
13847
  shrNonce: request.shrNonce,
13777
13848
  };
13778
13849
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
13779
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
13780
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
13781
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
13782
- validatedRequest.keyId = reqCnfData.kid;
13850
+ // generate reqCnf if not provided in the request
13851
+ let reqCnfData;
13852
+ if (!validatedRequest.keyId) {
13853
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(shrParameters, this.logger);
13854
+ reqCnfData = generatedReqCnfData.reqCnfString;
13855
+ validatedRequest.keyId = generatedReqCnfData.kid;
13856
+ validatedRequest.signPopToken = true;
13857
+ }
13858
+ else {
13859
+ reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
13860
+ validatedRequest.signPopToken = false;
13861
+ }
13862
+ // SPAs require whole string to be passed to broker
13863
+ validatedRequest.reqCnf = reqCnfData;
13783
13864
  }
13784
13865
  return validatedRequest;
13785
13866
  }
@@ -15836,7 +15917,7 @@
15836
15917
  const correlationId = useNative
15837
15918
  ? request?.correlationId
15838
15919
  : this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
15839
- const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
15920
+ const rootMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenRedirect, correlationId);
15840
15921
  this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
15841
15922
  let redirectResponse;
15842
15923
  if (useNative && this.nativeExtensionProvider) {
@@ -15911,43 +15992,64 @@
15911
15992
  // Preflight request
15912
15993
  const correlationId = this.getRequestCorrelationId(request);
15913
15994
  this.logger.verbose("acquireTokenRedirect called", correlationId);
15914
- redirectPreflightCheck(this.initialized, this.config);
15915
- this.browserStorage.setInteractionInProgress(true);
15995
+ const atrMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPreRedirect, correlationId);
15996
+ atrMeasurement.add({
15997
+ accountType: getAccountType(request.account),
15998
+ scenarioId: request.scenarioId,
15999
+ });
16000
+ const onRedirectNavigateCb = request.onRedirectNavigate;
16001
+ request.onRedirectNavigate = (url) => {
16002
+ const navigate = typeof onRedirectNavigateCb === "function"
16003
+ ? onRedirectNavigateCb(url)
16004
+ : undefined;
16005
+ if (navigate !== false) {
16006
+ atrMeasurement.end({ success: true });
16007
+ }
16008
+ else {
16009
+ atrMeasurement.discard();
16010
+ }
16011
+ return navigate;
16012
+ };
15916
16013
  // If logged in, emit acquire token events
15917
16014
  const isLoggedIn = this.getAllAccounts().length > 0;
15918
- if (isLoggedIn) {
15919
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
15920
- }
15921
- else {
15922
- this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Redirect, request);
15923
- }
15924
- let result;
15925
- if (this.nativeExtensionProvider && this.canUseNative(request)) {
15926
- const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
15927
- result = nativeClient
15928
- .acquireTokenRedirect(request)
15929
- .catch((e) => {
15930
- if (e instanceof NativeAuthError &&
15931
- isFatalNativeAuthError(e)) {
15932
- this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
15933
- const redirectClient = this.createRedirectClient(correlationId);
15934
- return redirectClient.acquireToken(request);
15935
- }
15936
- else if (e instanceof InteractionRequiredAuthError) {
15937
- this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
15938
- const redirectClient = this.createRedirectClient(correlationId);
15939
- return redirectClient.acquireToken(request);
15940
- }
15941
- this.browserStorage.setInteractionInProgress(false);
15942
- throw e;
15943
- });
15944
- }
15945
- else {
15946
- const redirectClient = this.createRedirectClient(correlationId);
15947
- result = redirectClient.acquireToken(request);
16015
+ try {
16016
+ redirectPreflightCheck(this.initialized, this.config);
16017
+ this.browserStorage.setInteractionInProgress(true);
16018
+ if (isLoggedIn) {
16019
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
16020
+ }
16021
+ else {
16022
+ this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Redirect, request);
16023
+ }
16024
+ let result;
16025
+ if (this.nativeExtensionProvider && this.canUseNative(request)) {
16026
+ const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
16027
+ result = nativeClient
16028
+ .acquireTokenRedirect(request, atrMeasurement)
16029
+ .catch((e) => {
16030
+ if (e instanceof NativeAuthError &&
16031
+ isFatalNativeAuthError(e)) {
16032
+ this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
16033
+ const redirectClient = this.createRedirectClient(correlationId);
16034
+ return redirectClient.acquireToken(request);
16035
+ }
16036
+ else if (e instanceof InteractionRequiredAuthError) {
16037
+ this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
16038
+ const redirectClient = this.createRedirectClient(correlationId);
16039
+ return redirectClient.acquireToken(request);
16040
+ }
16041
+ this.browserStorage.setInteractionInProgress(false);
16042
+ throw e;
16043
+ });
16044
+ }
16045
+ else {
16046
+ const redirectClient = this.createRedirectClient(correlationId);
16047
+ result = redirectClient.acquireToken(request);
16048
+ }
16049
+ return await result;
15948
16050
  }
15949
- return result.catch((e) => {
15950
- // If logged in, emit acquire token events
16051
+ catch (e) {
16052
+ atrMeasurement.end({ success: false }, e);
15951
16053
  if (isLoggedIn) {
15952
16054
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
15953
16055
  }
@@ -15955,7 +16057,7 @@
15955
16057
  this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, e);
15956
16058
  }
15957
16059
  throw e;
15958
- });
16060
+ }
15959
16061
  }
15960
16062
  // #endregion
15961
16063
  // #region Popup Flow