@azure/msal-browser 2.27.0 → 2.28.2

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 (97) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_tslib.js +14 -2
  3. package/dist/_virtual/_tslib.js.map +1 -1
  4. package/dist/app/ClientApplication.d.ts +1 -0
  5. package/dist/app/ClientApplication.d.ts.map +1 -1
  6. package/dist/app/ClientApplication.js +34 -13
  7. package/dist/app/ClientApplication.js.map +1 -1
  8. package/dist/app/IPublicClientApplication.js +1 -1
  9. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  10. package/dist/app/PublicClientApplication.js +5 -3
  11. package/dist/app/PublicClientApplication.js.map +1 -1
  12. package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
  13. package/dist/broker/nativeBroker/NativeRequest.d.ts +1 -1
  14. package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
  15. package/dist/broker/nativeBroker/NativeResponse.d.ts +1 -1
  16. package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -1
  17. package/dist/cache/AsyncMemoryStorage.js +1 -1
  18. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  19. package/dist/cache/BrowserCacheManager.js +39 -8
  20. package/dist/cache/BrowserCacheManager.js.map +1 -1
  21. package/dist/cache/BrowserStorage.js +1 -1
  22. package/dist/cache/DatabaseStorage.js +1 -1
  23. package/dist/cache/MemoryStorage.js +1 -1
  24. package/dist/cache/TokenCache.js +1 -1
  25. package/dist/config/Configuration.js +1 -1
  26. package/dist/crypto/BrowserCrypto.js +1 -1
  27. package/dist/crypto/CryptoOps.js +1 -1
  28. package/dist/crypto/GuidGenerator.js +1 -1
  29. package/dist/crypto/PkceGenerator.js +1 -1
  30. package/dist/crypto/SignedHttpRequest.js +1 -1
  31. package/dist/encode/Base64Decode.js +1 -1
  32. package/dist/encode/Base64Encode.js +1 -1
  33. package/dist/error/BrowserAuthError.js +1 -1
  34. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  35. package/dist/error/NativeAuthError.d.ts +9 -0
  36. package/dist/error/NativeAuthError.d.ts.map +1 -1
  37. package/dist/error/NativeAuthError.js +12 -1
  38. package/dist/error/NativeAuthError.js.map +1 -1
  39. package/dist/event/EventHandler.js +1 -1
  40. package/dist/event/EventMessage.js +1 -1
  41. package/dist/event/EventType.js +1 -1
  42. package/dist/index.cjs.js +676 -369
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  46. package/dist/interaction_client/BaseInteractionClient.js +2 -3
  47. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  48. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  49. package/dist/interaction_client/NativeInteractionClient.d.ts +18 -1
  50. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  51. package/dist/interaction_client/NativeInteractionClient.js +101 -22
  52. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  53. package/dist/interaction_client/PopupClient.d.ts +2 -1
  54. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  55. package/dist/interaction_client/PopupClient.js +4 -3
  56. package/dist/interaction_client/PopupClient.js.map +1 -1
  57. package/dist/interaction_client/RedirectClient.d.ts +8 -1
  58. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  59. package/dist/interaction_client/RedirectClient.js +6 -4
  60. package/dist/interaction_client/RedirectClient.js.map +1 -1
  61. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  62. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  63. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  64. package/dist/interaction_client/SilentCacheClient.js +2 -2
  65. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  66. package/dist/interaction_client/SilentIframeClient.d.ts +2 -1
  67. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  68. package/dist/interaction_client/SilentIframeClient.js +4 -3
  69. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  70. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  71. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  72. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  73. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  74. package/dist/interaction_handler/InteractionHandler.js +1 -1
  75. package/dist/interaction_handler/RedirectHandler.js +1 -1
  76. package/dist/interaction_handler/SilentHandler.js +1 -1
  77. package/dist/internals.js +1 -1
  78. package/dist/navigation/NavigationClient.js +1 -1
  79. package/dist/network/FetchClient.js +1 -1
  80. package/dist/network/XhrClient.js +1 -1
  81. package/dist/packageMetadata.d.ts +1 -1
  82. package/dist/packageMetadata.js +2 -2
  83. package/dist/packageMetadata.js.map +1 -1
  84. package/dist/request/PopupRequest.d.ts +1 -1
  85. package/dist/request/RedirectRequest.d.ts +1 -1
  86. package/dist/request/SsoSilentRequest.d.ts +1 -1
  87. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  88. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  89. package/dist/utils/BrowserConstants.js +1 -1
  90. package/dist/utils/BrowserProtocolUtils.js +1 -1
  91. package/dist/utils/BrowserStringUtils.js +1 -1
  92. package/dist/utils/BrowserUtils.js +1 -1
  93. package/dist/utils/MathUtils.js +1 -1
  94. package/lib/msal-browser.js +676 -369
  95. package/lib/msal-browser.js.map +1 -1
  96. package/lib/msal-browser.min.js +42 -42
  97. package/package.json +3 -4
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.27.0 2022-07-05 */
1
+ /*! @azure/msal-browser v2.28.2 2022-09-06 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -44,6 +44,18 @@ var __assign$1 = function() {
44
44
  return __assign$1.apply(this, arguments);
45
45
  };
46
46
 
47
+ function __rest(s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ }
58
+
47
59
  function __awaiter$1(thisArg, _arguments, P, generator) {
48
60
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49
61
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -105,7 +117,7 @@ function __spread() {
105
117
  return ar;
106
118
  }
107
119
 
108
- /*! @azure/msal-common v7.1.0 2022-07-05 */
120
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
109
121
  /*! *****************************************************************************
110
122
  Copyright (c) Microsoft Corporation.
111
123
 
@@ -192,7 +204,7 @@ function __spreadArrays() {
192
204
  return r;
193
205
  }
194
206
 
195
- /*! @azure/msal-common v7.1.0 2022-07-05 */
207
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
196
208
 
197
209
  /*
198
210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -242,7 +254,8 @@ var Constants = {
242
254
  REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
243
255
  KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
244
256
  TOKEN_RESPONSE_TYPE: "token",
245
- ID_TOKEN_RESPONSE_TYPE: "id_token"
257
+ ID_TOKEN_RESPONSE_TYPE: "id_token",
258
+ SHR_NONCE_VALIDITY: 240
246
259
  };
247
260
  var OIDC_DEFAULT_SCOPES = [
248
261
  Constants.OPENID_SCOPE,
@@ -274,6 +287,7 @@ var PersistentCacheKeys;
274
287
  PersistentCacheKeys["ERROR"] = "error";
275
288
  PersistentCacheKeys["ERROR_DESC"] = "error.description";
276
289
  PersistentCacheKeys["ACTIVE_ACCOUNT"] = "active-account";
290
+ PersistentCacheKeys["ACTIVE_ACCOUNT_FILTERS"] = "active-account-filters"; // new cache entry for active_account for a more robust version for browser
277
291
  })(PersistentCacheKeys || (PersistentCacheKeys = {}));
278
292
  /**
279
293
  * String constants related to AAD Authority
@@ -567,7 +581,7 @@ var JsonTypes;
567
581
  JsonTypes["Jwk"] = "JWK";
568
582
  })(JsonTypes || (JsonTypes = {}));
569
583
 
570
- /*! @azure/msal-common v7.1.0 2022-07-05 */
584
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
571
585
 
572
586
  /*
573
587
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -580,6 +594,10 @@ var AuthErrorMessage = {
580
594
  unexpectedError: {
581
595
  code: "unexpected_error",
582
596
  desc: "Unexpected error in authentication."
597
+ },
598
+ postRequestFailed: {
599
+ code: "post_request_failed",
600
+ desc: "Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."
583
601
  }
584
602
  };
585
603
  /**
@@ -608,10 +626,18 @@ var AuthError = /** @class */ (function (_super) {
608
626
  AuthError.createUnexpectedError = function (errDesc) {
609
627
  return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + ": " + errDesc);
610
628
  };
629
+ /**
630
+ * Creates an error for post request failures.
631
+ * @param errDesc
632
+ * @returns
633
+ */
634
+ AuthError.createPostRequestFailed = function (errDesc) {
635
+ return new AuthError(AuthErrorMessage.postRequestFailed.code, AuthErrorMessage.postRequestFailed.desc + ": " + errDesc);
636
+ };
611
637
  return AuthError;
612
638
  }(Error));
613
639
 
614
- /*! @azure/msal-common v7.1.0 2022-07-05 */
640
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
615
641
 
616
642
  /*
617
643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -686,7 +712,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
686
712
  }
687
713
  };
688
714
 
689
- /*! @azure/msal-common v7.1.0 2022-07-05 */
715
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
690
716
 
691
717
  /*
692
718
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1158,7 +1184,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1158
1184
  return ClientAuthError;
1159
1185
  }(AuthError));
1160
1186
 
1161
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1187
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1162
1188
 
1163
1189
  /*
1164
1190
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1283,7 +1309,7 @@ var StringUtils = /** @class */ (function () {
1283
1309
  return StringUtils;
1284
1310
  }());
1285
1311
 
1286
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1312
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1287
1313
 
1288
1314
  /*
1289
1315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1463,12 +1489,12 @@ var Logger = /** @class */ (function () {
1463
1489
  return Logger;
1464
1490
  }());
1465
1491
 
1466
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1492
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1467
1493
  /* eslint-disable header/header */
1468
1494
  var name$1 = "@azure/msal-common";
1469
- var version$1 = "7.1.0";
1495
+ var version$1 = "7.4.0";
1470
1496
 
1471
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1497
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1472
1498
  /*
1473
1499
  * Copyright (c) Microsoft Corporation. All rights reserved.
1474
1500
  * Licensed under the MIT License.
@@ -1489,7 +1515,7 @@ exports.AzureCloudInstance = void 0;
1489
1515
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1490
1516
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1491
1517
 
1492
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1518
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1493
1519
 
1494
1520
  /*
1495
1521
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1648,7 +1674,7 @@ var CredentialEntity = /** @class */ (function () {
1648
1674
  return CredentialEntity;
1649
1675
  }());
1650
1676
 
1651
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1677
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1652
1678
 
1653
1679
  /*
1654
1680
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1903,7 +1929,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1903
1929
  return ClientConfigurationError;
1904
1930
  }(ClientAuthError));
1905
1931
 
1906
- /*! @azure/msal-common v7.1.0 2022-07-05 */
1932
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
1907
1933
 
1908
1934
  /*
1909
1935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2087,7 +2113,7 @@ var ScopeSet = /** @class */ (function () {
2087
2113
  return ScopeSet;
2088
2114
  }());
2089
2115
 
2090
- /*! @azure/msal-common v7.1.0 2022-07-05 */
2116
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
2091
2117
 
2092
2118
  /*
2093
2119
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2107,7 +2133,7 @@ function buildClientInfo(rawClientInfo, crypto) {
2107
2133
  return JSON.parse(decodedClientInfo);
2108
2134
  }
2109
2135
  catch (e) {
2110
- throw ClientAuthError.createClientInfoDecodingError(e);
2136
+ throw ClientAuthError.createClientInfoDecodingError(e.message);
2111
2137
  }
2112
2138
  }
2113
2139
  /**
@@ -2125,7 +2151,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2125
2151
  };
2126
2152
  }
2127
2153
 
2128
- /*! @azure/msal-common v7.1.0 2022-07-05 */
2154
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
2129
2155
  /*
2130
2156
  * Copyright (c) Microsoft Corporation. All rights reserved.
2131
2157
  * Licensed under the MIT License.
@@ -2139,7 +2165,7 @@ var AuthorityType;
2139
2165
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2140
2166
  })(AuthorityType || (AuthorityType = {}));
2141
2167
 
2142
- /*! @azure/msal-common v7.1.0 2022-07-05 */
2168
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
2143
2169
 
2144
2170
  /*
2145
2171
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2374,7 +2400,7 @@ var AccountEntity = /** @class */ (function () {
2374
2400
  return AccountEntity;
2375
2401
  }());
2376
2402
 
2377
- /*! @azure/msal-common v7.1.0 2022-07-05 */
2403
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
2378
2404
 
2379
2405
  /*
2380
2406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2412,7 +2438,7 @@ var AuthToken = /** @class */ (function () {
2412
2438
  return AuthToken;
2413
2439
  }());
2414
2440
 
2415
- /*! @azure/msal-common v7.1.0 2022-07-05 */
2441
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
2416
2442
 
2417
2443
  /*
2418
2444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2443,6 +2469,7 @@ var CacheManager = /** @class */ (function () {
2443
2469
  var accountInfo = accountEntity.getAccountInfo();
2444
2470
  var idToken = _this.readIdTokenFromCache(_this.clientId, accountInfo);
2445
2471
  if (idToken && !accountInfo.idTokenClaims) {
2472
+ accountInfo.idToken = idToken.secret;
2446
2473
  accountInfo.idTokenClaims = new AuthToken(idToken.secret, _this.cryptoImpl).claims;
2447
2474
  }
2448
2475
  return accountInfo;
@@ -2534,7 +2561,7 @@ var CacheManager = /** @class */ (function () {
2534
2561
  * @param realm
2535
2562
  */
2536
2563
  CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {
2537
- return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING, accountFilter ? accountFilter.environment : Constants.EMPTY_STRING, accountFilter ? accountFilter.realm : Constants.EMPTY_STRING);
2564
+ return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING, accountFilter ? accountFilter.environment : Constants.EMPTY_STRING, accountFilter ? accountFilter.realm : Constants.EMPTY_STRING, accountFilter ? accountFilter.nativeAccountId : Constants.EMPTY_STRING);
2538
2565
  };
2539
2566
  /**
2540
2567
  * retrieve accounts matching all provided filters; if no filter is set, get all accounts
@@ -2543,7 +2570,7 @@ var CacheManager = /** @class */ (function () {
2543
2570
  * @param environment
2544
2571
  * @param realm
2545
2572
  */
2546
- CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm) {
2573
+ CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm, nativeAccountId) {
2547
2574
  var _this = this;
2548
2575
  var allCacheKeys = this.getKeys();
2549
2576
  var matchingAccounts = {};
@@ -2561,6 +2588,9 @@ var CacheManager = /** @class */ (function () {
2561
2588
  if (!!realm && !_this.matchRealm(entity, realm)) {
2562
2589
  return;
2563
2590
  }
2591
+ if (!!nativeAccountId && !_this.matchNativeAccountId(entity, nativeAccountId)) {
2592
+ return;
2593
+ }
2564
2594
  matchingAccounts[cacheKey] = entity;
2565
2595
  });
2566
2596
  return matchingAccounts;
@@ -2889,6 +2919,26 @@ var CacheManager = /** @class */ (function () {
2889
2919
  var accountKey = AccountEntity.generateAccountCacheKey(account);
2890
2920
  return this.getAccount(accountKey);
2891
2921
  };
2922
+ /**
2923
+ * Retrieve AccountEntity from cache
2924
+ * @param nativeAccountId
2925
+ * @returns AccountEntity or Null
2926
+ */
2927
+ CacheManager.prototype.readAccountFromCacheWithNativeAccountId = function (nativeAccountId) {
2928
+ // fetch account from memory
2929
+ var accountFilter = {
2930
+ nativeAccountId: nativeAccountId
2931
+ };
2932
+ var accountCache = this.getAccountsFilteredBy(accountFilter);
2933
+ var accounts = Object.keys(accountCache).map(function (key) { return accountCache[key]; });
2934
+ if (accounts.length < 1) {
2935
+ return null;
2936
+ }
2937
+ else if (accounts.length > 1) {
2938
+ throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
2939
+ }
2940
+ return accountCache[0];
2941
+ };
2892
2942
  /**
2893
2943
  * Retrieve IdTokenEntity from cache
2894
2944
  * @param clientId
@@ -3063,6 +3113,15 @@ var CacheManager = /** @class */ (function () {
3063
3113
  CacheManager.prototype.matchRealm = function (entity, realm) {
3064
3114
  return !!(entity.realm && realm === entity.realm);
3065
3115
  };
3116
+ /**
3117
+ * helper to match nativeAccountId
3118
+ * @param entity
3119
+ * @param nativeAccountId
3120
+ * @returns boolean indicating the match result
3121
+ */
3122
+ CacheManager.prototype.matchNativeAccountId = function (entity, nativeAccountId) {
3123
+ return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);
3124
+ };
3066
3125
  /**
3067
3126
  * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.
3068
3127
  * @param entity
@@ -3254,7 +3313,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3254
3313
  return DefaultStorageClass;
3255
3314
  }(CacheManager));
3256
3315
 
3257
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3316
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3258
3317
 
3259
3318
  /*
3260
3319
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3337,7 +3396,7 @@ function buildClientConfiguration(_a) {
3337
3396
  telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), telemetry),
3338
3397
  serverTelemetryManager: serverTelemetryManager || null,
3339
3398
  persistencePlugin: persistencePlugin || null,
3340
- serializableCache: serializableCache || null
3399
+ serializableCache: serializableCache || null,
3341
3400
  };
3342
3401
  }
3343
3402
  /**
@@ -3348,7 +3407,7 @@ function buildAuthOptions(authOptions) {
3348
3407
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3349
3408
  }
3350
3409
 
3351
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3410
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3352
3411
 
3353
3412
  /*
3354
3413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3368,7 +3427,7 @@ var ServerError = /** @class */ (function (_super) {
3368
3427
  return ServerError;
3369
3428
  }(AuthError));
3370
3429
 
3371
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3430
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3372
3431
 
3373
3432
  /*
3374
3433
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3464,7 +3523,7 @@ var ThrottlingUtils = /** @class */ (function () {
3464
3523
  return ThrottlingUtils;
3465
3524
  }());
3466
3525
 
3467
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3526
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3468
3527
 
3469
3528
  /*
3470
3529
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3513,7 +3572,7 @@ var NetworkManager = /** @class */ (function () {
3513
3572
  return NetworkManager;
3514
3573
  }());
3515
3574
 
3516
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3575
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3517
3576
  /*
3518
3577
  * Copyright (c) Microsoft Corporation. All rights reserved.
3519
3578
  * Licensed under the MIT License.
@@ -3524,7 +3583,7 @@ var CcsCredentialType;
3524
3583
  CcsCredentialType["UPN"] = "UPN";
3525
3584
  })(CcsCredentialType || (CcsCredentialType = {}));
3526
3585
 
3527
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3586
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3528
3587
 
3529
3588
  /*
3530
3589
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3534,7 +3593,7 @@ var CcsCredentialType;
3534
3593
  * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
3535
3594
  */
3536
3595
  var BaseClient = /** @class */ (function () {
3537
- function BaseClient(configuration) {
3596
+ function BaseClient(configuration, performanceClient) {
3538
3597
  // Set the configuration
3539
3598
  this.config = buildClientConfiguration(configuration);
3540
3599
  // Initialize the logger
@@ -3551,6 +3610,8 @@ var BaseClient = /** @class */ (function () {
3551
3610
  this.serverTelemetryManager = this.config.serverTelemetryManager;
3552
3611
  // set Authority
3553
3612
  this.authority = this.config.authOptions.authority;
3613
+ // set performance telemetry client
3614
+ this.performanceClient = performanceClient;
3554
3615
  }
3555
3616
  /**
3556
3617
  * Creates default headers for requests to token endpoint
@@ -3613,7 +3674,7 @@ var BaseClient = /** @class */ (function () {
3613
3674
  return BaseClient;
3614
3675
  }());
3615
3676
 
3616
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3677
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3617
3678
 
3618
3679
  /*
3619
3680
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3699,7 +3760,7 @@ var RequestValidator = /** @class */ (function () {
3699
3760
  return RequestValidator;
3700
3761
  }());
3701
3762
 
3702
- /*! @azure/msal-common v7.1.0 2022-07-05 */
3763
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
3703
3764
 
3704
3765
  /*
3705
3766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4077,7 +4138,7 @@ var RequestParameterBuilder = /** @class */ (function () {
4077
4138
  return RequestParameterBuilder;
4078
4139
  }());
4079
4140
 
4080
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4141
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4081
4142
 
4082
4143
  /*
4083
4144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4141,7 +4202,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4141
4202
  return IdTokenEntity;
4142
4203
  }(CredentialEntity));
4143
4204
 
4144
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4205
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4145
4206
  /*
4146
4207
  * Copyright (c) Microsoft Corporation. All rights reserved.
4147
4208
  * Licensed under the MIT License.
@@ -4191,7 +4252,7 @@ var TimeUtils = /** @class */ (function () {
4191
4252
  return TimeUtils;
4192
4253
  }());
4193
4254
 
4194
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4255
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4195
4256
 
4196
4257
  /*
4197
4258
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4305,7 +4366,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4305
4366
  return AccessTokenEntity;
4306
4367
  }(CredentialEntity));
4307
4368
 
4308
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4369
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4309
4370
 
4310
4371
  /*
4311
4372
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4372,7 +4433,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4372
4433
  return RefreshTokenEntity;
4373
4434
  }(CredentialEntity));
4374
4435
 
4375
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4436
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4376
4437
 
4377
4438
  /*
4378
4439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4447,7 +4508,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4447
4508
  return InteractionRequiredAuthError;
4448
4509
  }(AuthError));
4449
4510
 
4450
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4511
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4451
4512
  /*
4452
4513
  * Copyright (c) Microsoft Corporation. All rights reserved.
4453
4514
  * Licensed under the MIT License.
@@ -4463,7 +4524,7 @@ var CacheRecord = /** @class */ (function () {
4463
4524
  return CacheRecord;
4464
4525
  }());
4465
4526
 
4466
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4527
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4467
4528
 
4468
4529
  /*
4469
4530
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4534,7 +4595,7 @@ var ProtocolUtils = /** @class */ (function () {
4534
4595
  return ProtocolUtils;
4535
4596
  }());
4536
4597
 
4537
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4598
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4538
4599
 
4539
4600
  /*
4540
4601
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4697,6 +4758,21 @@ var UrlString = /** @class */ (function () {
4697
4758
  }
4698
4759
  return Constants.EMPTY_STRING;
4699
4760
  };
4761
+ /**
4762
+ * Parses query string from given string. Returns empty string if no query symbol is found.
4763
+ * @param queryString
4764
+ */
4765
+ UrlString.parseQueryString = function (queryString) {
4766
+ var queryIndex1 = queryString.indexOf("?");
4767
+ var queryIndex2 = queryString.indexOf("/?");
4768
+ if (queryIndex2 > -1) {
4769
+ return queryString.substring(queryIndex2 + 2);
4770
+ }
4771
+ else if (queryIndex1 > -1) {
4772
+ return queryString.substring(queryIndex1 + 1);
4773
+ }
4774
+ return Constants.EMPTY_STRING;
4775
+ };
4700
4776
  UrlString.constructAuthorityUriFromObject = function (urlObject) {
4701
4777
  return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
4702
4778
  };
@@ -4718,6 +4794,24 @@ var UrlString = /** @class */ (function () {
4718
4794
  }
4719
4795
  return deserializedHash;
4720
4796
  };
4797
+ /**
4798
+ * Returns URL query string as server auth code response object.
4799
+ */
4800
+ UrlString.getDeserializedQueryString = function (query) {
4801
+ // Check if given query is empty
4802
+ if (StringUtils.isEmpty(query)) {
4803
+ return {};
4804
+ }
4805
+ // Strip the ? symbol if present
4806
+ var parsedQueryString = UrlString.parseQueryString(query);
4807
+ // If ? symbol was not present, above will return empty string, so give original query value
4808
+ var deserializedQueryString = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);
4809
+ // Check if deserialization didn't work
4810
+ if (!deserializedQueryString) {
4811
+ throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));
4812
+ }
4813
+ return deserializedQueryString;
4814
+ };
4721
4815
  /**
4722
4816
  * Check if the hash of the URL string contains known properties
4723
4817
  */
@@ -4735,7 +4829,7 @@ var UrlString = /** @class */ (function () {
4735
4829
  return UrlString;
4736
4830
  }());
4737
4831
 
4738
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4832
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4739
4833
 
4740
4834
  /*
4741
4835
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4836,7 +4930,7 @@ var PopTokenGenerator = /** @class */ (function () {
4836
4930
  return PopTokenGenerator;
4837
4931
  }());
4838
4932
 
4839
- /*! @azure/msal-common v7.1.0 2022-07-05 */
4933
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4840
4934
 
4841
4935
  /*
4842
4936
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4906,7 +5000,7 @@ var AppMetadataEntity = /** @class */ (function () {
4906
5000
  return AppMetadataEntity;
4907
5001
  }());
4908
5002
 
4909
- /*! @azure/msal-common v7.1.0 2022-07-05 */
5003
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4910
5004
  /*
4911
5005
  * Copyright (c) Microsoft Corporation. All rights reserved.
4912
5006
  * Licensed under the MIT License.
@@ -4942,7 +5036,7 @@ var AppMetadataEntity = /** @class */ (function () {
4942
5036
  return TokenCacheContext;
4943
5037
  }());
4944
5038
 
4945
- /*! @azure/msal-common v7.1.0 2022-07-05 */
5039
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
4946
5040
 
4947
5041
  /*
4948
5042
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5003,7 +5097,7 @@ var ResponseHandler = /** @class */ (function () {
5003
5097
  * @param serverTokenResponse
5004
5098
  * @param authority
5005
5099
  */
5006
- ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse) {
5100
+ ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse) {
5007
5101
  return __awaiter(this, void 0, void 0, function () {
5008
5102
  var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;
5009
5103
  return __generator(this, function (_a) {
@@ -5040,14 +5134,15 @@ var ResponseHandler = /** @class */ (function () {
5040
5134
  /*
5041
5135
  * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.
5042
5136
  * If not present, we should return null, as it's the case that another application called removeAccount in between
5043
- * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.
5137
+ * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal, unless explicitly flagged by
5138
+ * the developer, as in the case of refresh token flow used in ADAL Node to MSAL Node migration.
5044
5139
  */
5045
- if (handlingRefreshTokenResponse && cacheRecord.account) {
5140
+ if (handlingRefreshTokenResponse && !forceCacheRefreshTokenResponse && cacheRecord.account) {
5046
5141
  key = cacheRecord.account.generateAccountKey();
5047
5142
  account = this.cacheStorage.getAccount(key);
5048
5143
  if (!account) {
5049
5144
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
5050
- return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
5145
+ return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined)];
5051
5146
  }
5052
5147
  }
5053
5148
  return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];
@@ -5212,7 +5307,7 @@ var ResponseHandler = /** @class */ (function () {
5212
5307
  return ResponseHandler;
5213
5308
  }());
5214
5309
 
5215
- /*! @azure/msal-common v7.1.0 2022-07-05 */
5310
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5216
5311
 
5217
5312
  /*
5218
5313
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5313,7 +5408,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5313
5408
  throw ClientConfigurationError.createEmptyLogoutRequestError();
5314
5409
  }
5315
5410
  var queryString = this.createLogoutUrlQueryString(logoutRequest);
5316
- // Construct logout URI.
5411
+ // Construct logout URI
5317
5412
  return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);
5318
5413
  };
5319
5414
  /**
@@ -5500,7 +5595,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5500
5595
  */
5501
5596
  AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
5502
5597
  return __awaiter(this, void 0, void 0, function () {
5503
- var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5598
+ var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5504
5599
  return __generator(this, function (_a) {
5505
5600
  switch (_a.label) {
5506
5601
  case 0:
@@ -5530,7 +5625,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5530
5625
  if (request.domainHint) {
5531
5626
  parameterBuilder.addDomainHint(request.domainHint);
5532
5627
  }
5533
- // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
5628
+ // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
5534
5629
  if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
5535
5630
  // AAD will throw if prompt=select_account is passed with an account hint
5536
5631
  if (request.sid && request.prompt === PromptValue.NONE) {
@@ -5540,9 +5635,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5540
5635
  }
5541
5636
  else if (request.account) {
5542
5637
  accountSid = this.extractAccountSid(request.account);
5543
- // If account and loginHint are provided, we will check account first for sid before adding loginHint
5544
- if (accountSid && request.prompt === PromptValue.NONE) {
5545
- // SessionId is only used in silent calls
5638
+ accountLoginHintClaim = this.extractLoginHint(request.account);
5639
+ // If login_hint claim is present, use it over sid/username
5640
+ if (accountLoginHintClaim) {
5641
+ this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
5642
+ parameterBuilder.addLoginHint(accountLoginHintClaim);
5643
+ try {
5644
+ clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
5645
+ parameterBuilder.addCcsOid(clientInfo);
5646
+ }
5647
+ catch (e) {
5648
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5649
+ }
5650
+ }
5651
+ else if (accountSid && request.prompt === PromptValue.NONE) {
5652
+ /*
5653
+ * If account and loginHint are provided, we will check account first for sid before adding loginHint
5654
+ * SessionId is only used in silent calls
5655
+ */
5546
5656
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
5547
5657
  parameterBuilder.addSid(accountSid);
5548
5658
  try {
@@ -5550,7 +5660,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5550
5660
  parameterBuilder.addCcsOid(clientInfo);
5551
5661
  }
5552
5662
  catch (e) {
5553
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5663
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5554
5664
  }
5555
5665
  }
5556
5666
  else if (request.loginHint) {
@@ -5567,7 +5677,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5567
5677
  parameterBuilder.addCcsOid(clientInfo);
5568
5678
  }
5569
5679
  catch (e) {
5570
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5680
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5571
5681
  }
5572
5682
  }
5573
5683
  }
@@ -5638,16 +5748,135 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5638
5748
  * @param account
5639
5749
  */
5640
5750
  AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
5641
- if (account.idTokenClaims) {
5642
- var tokenClaims = account.idTokenClaims;
5643
- return tokenClaims.sid || null;
5644
- }
5645
- return null;
5751
+ var _a;
5752
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
5753
+ };
5754
+ AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
5755
+ var _a;
5756
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
5646
5757
  };
5647
5758
  return AuthorizationCodeClient;
5648
5759
  }(BaseClient));
5649
5760
 
5650
- /*! @azure/msal-common v7.1.0 2022-07-05 */
5761
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5762
+ /*
5763
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5764
+ * Licensed under the MIT License.
5765
+ */
5766
+ /**
5767
+ * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
5768
+ *
5769
+ * @export
5770
+ * @enum {number}
5771
+ */
5772
+ exports.PerformanceEvents = void 0;
5773
+ (function (PerformanceEvents) {
5774
+ /**
5775
+ * acquireTokenByCode API (msal-browser and msal-node).
5776
+ * Used to acquire tokens by trading an authorization code against the token endpoint.
5777
+ */
5778
+ PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
5779
+ /**
5780
+ * acquireTokenByRefreshToken API (msal-browser and msal-node).
5781
+ * Used to renew an access token using a refresh token against the token endpoint.
5782
+ */
5783
+ PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
5784
+ /**
5785
+ * acquireTokenSilent API (msal-browser and msal-node).
5786
+ * Used to silently acquire a new access token (from the cache or the network).
5787
+ */
5788
+ PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
5789
+ /**
5790
+ * acquireTokenSilentAsync (msal-browser).
5791
+ * Internal API for acquireTokenSilent.
5792
+ */
5793
+ PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
5794
+ /**
5795
+ * acquireTokenPopup (msal-browser).
5796
+ * Used to acquire a new access token interactively through pop ups
5797
+ */
5798
+ PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
5799
+ /**
5800
+ * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
5801
+ * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
5802
+ */
5803
+ PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
5804
+ /**
5805
+ * signJwt API in CryptoOpts class (msal-browser).
5806
+ * Used to signed a pop token.
5807
+ */
5808
+ PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
5809
+ /**
5810
+ * acquireToken API in the SilentCacheClient class (msal-browser).
5811
+ * Used to read access tokens from the cache.
5812
+ */
5813
+ PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
5814
+ /**
5815
+ * acquireToken API in the SilentIframeClient class (msal-browser).
5816
+ * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
5817
+ */
5818
+ PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
5819
+ /**
5820
+ * acquireToken API in SilentRereshClient (msal-browser).
5821
+ * Used to acquire a new set of tokens from the token endpoint using a refresh token.
5822
+ */
5823
+ PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
5824
+ /**
5825
+ * ssoSilent API (msal-browser).
5826
+ * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
5827
+ */
5828
+ PerformanceEvents["SsoSilent"] = "ssoSilent";
5829
+ /**
5830
+ * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
5831
+ * Used to load authority metadata for a request.
5832
+ */
5833
+ PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
5834
+ /**
5835
+ * acquireToken APIs in msal-browser.
5836
+ * Used to make an /authorize endpoint call with native brokering enabled.
5837
+ */
5838
+ PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
5839
+ /**
5840
+ * acquireToken API in NativeInteractionClient class (msal-browser).
5841
+ * Used to acquire a token from Native component when native brokering is enabled.
5842
+ */
5843
+ PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
5844
+ /**
5845
+ * Time spent on the network for refresh token acquisition
5846
+ */
5847
+ PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
5848
+ /**
5849
+ * Time spent creating default headers for requests to token endpoint
5850
+ */
5851
+ PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
5852
+ /**
5853
+ * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
5854
+ */
5855
+ PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
5856
+ /**
5857
+ * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
5858
+ */
5859
+ PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
5860
+ /**
5861
+ * acquireToken API in BrokerClientApplication.
5862
+ * Used to acquire a token on behalf of the embedded application (PW-Broker).
5863
+ */
5864
+ PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
5865
+ })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
5866
+ /**
5867
+ * State of the performance event.
5868
+ *
5869
+ * @export
5870
+ * @enum {number}
5871
+ */
5872
+ var PerformanceEventStatus;
5873
+ (function (PerformanceEventStatus) {
5874
+ PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
5875
+ PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
5876
+ PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
5877
+ })(PerformanceEventStatus || (PerformanceEventStatus = {}));
5878
+
5879
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5651
5880
 
5652
5881
  /*
5653
5882
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5658,8 +5887,8 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5658
5887
  */
5659
5888
  var RefreshTokenClient = /** @class */ (function (_super) {
5660
5889
  __extends(RefreshTokenClient, _super);
5661
- function RefreshTokenClient(configuration) {
5662
- return _super.call(this, configuration) || this;
5890
+ function RefreshTokenClient(configuration, performanceClient) {
5891
+ return _super.call(this, configuration, performanceClient) || this;
5663
5892
  }
5664
5893
  RefreshTokenClient.prototype.acquireToken = function (request) {
5665
5894
  return __awaiter(this, void 0, void 0, function () {
@@ -5673,7 +5902,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5673
5902
  response = _a.sent();
5674
5903
  responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
5675
5904
  responseHandler.validateTokenResponse(response.body);
5676
- return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true)];
5905
+ return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache)];
5677
5906
  }
5678
5907
  });
5679
5908
  });
@@ -5745,13 +5974,16 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5745
5974
  * @param authority
5746
5975
  */
5747
5976
  RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
5977
+ var _a;
5748
5978
  return __awaiter(this, void 0, void 0, function () {
5749
- var requestBody, queryParameters, headers, thumbprint, endpoint;
5750
- return __generator(this, function (_a) {
5751
- switch (_a.label) {
5752
- case 0: return [4 /*yield*/, this.createTokenRequestBody(request)];
5979
+ var acquireTokenMeasurement, requestBody, queryParameters, headers, thumbprint, endpoint;
5980
+ return __generator(this, function (_b) {
5981
+ switch (_b.label) {
5982
+ case 0:
5983
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
5984
+ return [4 /*yield*/, this.createTokenRequestBody(request)];
5753
5985
  case 1:
5754
- requestBody = _a.sent();
5986
+ requestBody = _b.sent();
5755
5987
  queryParameters = this.createTokenQueryParameters(request);
5756
5988
  headers = this.createTokenRequestHeaders(request.ccsCredential);
5757
5989
  thumbprint = {
@@ -5766,7 +5998,19 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5766
5998
  sshKid: request.sshKid
5767
5999
  };
5768
6000
  endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
5769
- return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
6001
+ return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
6002
+ .then(function (result) {
6003
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6004
+ success: true
6005
+ });
6006
+ return result;
6007
+ })
6008
+ .catch(function (error) {
6009
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6010
+ success: false
6011
+ });
6012
+ throw error;
6013
+ })];
5770
6014
  }
5771
6015
  });
5772
6016
  });
@@ -5787,11 +6031,14 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5787
6031
  * @param request
5788
6032
  */
5789
6033
  RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
6034
+ var _a;
5790
6035
  return __awaiter(this, void 0, void 0, function () {
5791
- var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
5792
- return __generator(this, function (_a) {
5793
- switch (_a.label) {
6036
+ var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
6037
+ return __generator(this, function (_b) {
6038
+ switch (_b.label) {
5794
6039
  case 0:
6040
+ correlationId = request.correlationId;
6041
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
5795
6042
  parameterBuilder = new RequestParameterBuilder();
5796
6043
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5797
6044
  parameterBuilder.addScopes(request.scopes);
@@ -5803,7 +6050,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5803
6050
  if (this.serverTelemetryManager) {
5804
6051
  parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
5805
6052
  }
5806
- correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5807
6053
  parameterBuilder.addCorrelationId(correlationId);
5808
6054
  parameterBuilder.addRefreshToken(request.refreshToken);
5809
6055
  if (this.config.clientCredentials.clientSecret) {
@@ -5818,7 +6064,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5818
6064
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5819
6065
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5820
6066
  case 1:
5821
- reqCnfData = _a.sent();
6067
+ reqCnfData = _b.sent();
5822
6068
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
5823
6069
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
5824
6070
  return [3 /*break*/, 3];
@@ -5828,10 +6074,13 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5828
6074
  parameterBuilder.addSshJwk(request.sshJwk);
5829
6075
  }
5830
6076
  else {
6077
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6078
+ success: false
6079
+ });
5831
6080
  throw ClientConfigurationError.createMissingSshJwkError();
5832
6081
  }
5833
6082
  }
5834
- _a.label = 3;
6083
+ _b.label = 3;
5835
6084
  case 3:
5836
6085
  if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
5837
6086
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
@@ -5852,6 +6101,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5852
6101
  break;
5853
6102
  }
5854
6103
  }
6104
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6105
+ success: true
6106
+ });
5855
6107
  return [2 /*return*/, parameterBuilder.createQueryString()];
5856
6108
  }
5857
6109
  });
@@ -5860,7 +6112,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5860
6112
  return RefreshTokenClient;
5861
6113
  }(BaseClient));
5862
6114
 
5863
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6115
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5864
6116
 
5865
6117
  /*
5866
6118
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5868,8 +6120,8 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5868
6120
  */
5869
6121
  var SilentFlowClient = /** @class */ (function (_super) {
5870
6122
  __extends(SilentFlowClient, _super);
5871
- function SilentFlowClient(configuration) {
5872
- return _super.call(this, configuration) || this;
6123
+ function SilentFlowClient(configuration, performanceClient) {
6124
+ return _super.call(this, configuration, performanceClient) || this;
5873
6125
  }
5874
6126
  /**
5875
6127
  * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew
@@ -5888,7 +6140,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5888
6140
  case 2:
5889
6141
  e_1 = _a.sent();
5890
6142
  if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
5891
- refreshTokenClient = new RefreshTokenClient(this.config);
6143
+ refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
5892
6144
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];
5893
6145
  }
5894
6146
  else {
@@ -5976,7 +6228,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5976
6228
  return SilentFlowClient;
5977
6229
  }(BaseClient));
5978
6230
 
5979
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6231
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5980
6232
  /*
5981
6233
  * Copyright (c) Microsoft Corporation. All rights reserved.
5982
6234
  * Licensed under the MIT License.
@@ -5988,7 +6240,7 @@ function isOpenIdConfigResponse(response) {
5988
6240
  response.hasOwnProperty("jwks_uri"));
5989
6241
  }
5990
6242
 
5991
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6243
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
5992
6244
  /*
5993
6245
  * Copyright (c) Microsoft Corporation. All rights reserved.
5994
6246
  * Licensed under the MIT License.
@@ -5997,7 +6249,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
5997
6249
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
5998
6250
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
5999
6251
 
6000
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6252
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6001
6253
  /*
6002
6254
  * Copyright (c) Microsoft Corporation. All rights reserved.
6003
6255
  * Licensed under the MIT License.
@@ -6011,7 +6263,7 @@ exports.ProtocolMode = void 0;
6011
6263
  ProtocolMode["OIDC"] = "OIDC";
6012
6264
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6013
6265
 
6014
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6266
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6015
6267
 
6016
6268
  /*
6017
6269
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6088,7 +6340,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
6088
6340
  return AuthorityMetadataEntity;
6089
6341
  }());
6090
6342
 
6091
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6343
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6092
6344
  /*
6093
6345
  * Copyright (c) Microsoft Corporation. All rights reserved.
6094
6346
  * Licensed under the MIT License.
@@ -6098,7 +6350,7 @@ function isCloudInstanceDiscoveryResponse(response) {
6098
6350
  response.hasOwnProperty("metadata"));
6099
6351
  }
6100
6352
 
6101
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6353
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6102
6354
 
6103
6355
  /*
6104
6356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6220,7 +6472,7 @@ var RegionDiscovery = /** @class */ (function () {
6220
6472
  return RegionDiscovery;
6221
6473
  }());
6222
6474
 
6223
- /*! @azure/msal-common v7.1.0 2022-07-05 */
6475
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6224
6476
 
6225
6477
  /*
6226
6478
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6882,7 +7134,7 @@ var Authority = /** @class */ (function () {
6882
7134
  return Authority;
6883
7135
  }());
6884
7136
 
6885
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7137
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6886
7138
 
6887
7139
  /*
6888
7140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6943,7 +7195,7 @@ var AuthorityFactory = /** @class */ (function () {
6943
7195
  return AuthorityFactory;
6944
7196
  }());
6945
7197
 
6946
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7198
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6947
7199
 
6948
7200
  /*
6949
7201
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6974,7 +7226,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
6974
7226
  return ServerTelemetryEntity;
6975
7227
  }());
6976
7228
 
6977
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7229
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
6978
7230
 
6979
7231
  /*
6980
7232
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7002,7 +7254,7 @@ var ThrottlingEntity = /** @class */ (function () {
7002
7254
  return ThrottlingEntity;
7003
7255
  }());
7004
7256
 
7005
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7257
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7006
7258
 
7007
7259
  /*
7008
7260
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7019,7 +7271,7 @@ var StubbedNetworkModule = {
7019
7271
  }
7020
7272
  };
7021
7273
 
7022
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7274
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7023
7275
 
7024
7276
  /*
7025
7277
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7064,7 +7316,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
7064
7316
  return JoseHeaderError;
7065
7317
  }(AuthError));
7066
7318
 
7067
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7319
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7068
7320
 
7069
7321
  /*
7070
7322
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7104,7 +7356,7 @@ var JoseHeader = /** @class */ (function () {
7104
7356
  return JoseHeader;
7105
7357
  }());
7106
7358
 
7107
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7359
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7108
7360
 
7109
7361
  /*
7110
7362
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7163,7 +7415,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
7163
7415
  return AuthenticationHeaderParser;
7164
7416
  }());
7165
7417
 
7166
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7418
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7167
7419
 
7168
7420
  /*
7169
7421
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7325,138 +7577,41 @@ var ServerTelemetryManager = /** @class */ (function () {
7325
7577
  return ServerTelemetryManager;
7326
7578
  }());
7327
7579
 
7328
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7580
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7581
+
7329
7582
  /*
7330
7583
  * Copyright (c) Microsoft Corporation. All rights reserved.
7331
7584
  * Licensed under the MIT License.
7332
7585
  */
7333
- /**
7334
- * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
7335
- *
7336
- * @export
7337
- * @enum {number}
7338
- */
7339
- exports.PerformanceEvents = void 0;
7340
- (function (PerformanceEvents) {
7341
- /**
7342
- * acquireTokenByCode API (msal-browser and msal-node).
7343
- * Used to acquire tokens by trading an authorization code against the token endpoint.
7344
- */
7345
- PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
7346
- /**
7347
- * acquireTokenByRefreshToken API (msal-browser and msal-node).
7348
- * Used to renew an access token using a refresh token against the token endpoint.
7349
- */
7350
- PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
7351
- /**
7352
- * acquireTokenSilent API (msal-browser and msal-node).
7353
- * Used to silently acquire a new access token (from the cache or the network).
7354
- */
7355
- PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
7356
- /**
7357
- * acquireTokenSilentAsync (msal-browser).
7358
- * Internal API for acquireTokenSilent.
7359
- */
7360
- PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
7586
+ var PerformanceClient = /** @class */ (function () {
7361
7587
  /**
7362
- * acquireTokenPopup (msal-browser).
7363
- * Used to acquire a new access token interactively through pop ups
7588
+ * Creates an instance of PerformanceClient,
7589
+ * an abstract class containing core performance telemetry logic.
7590
+ *
7591
+ * @constructor
7592
+ * @param {string} clientId Client ID of the application
7593
+ * @param {string} authority Authority used by the application
7594
+ * @param {Logger} logger Logger used by the application
7595
+ * @param {string} libraryName Name of the library
7596
+ * @param {string} libraryVersion Version of the library
7364
7597
  */
7365
- PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
7598
+ function PerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
7599
+ this.authority = authority;
7600
+ this.libraryName = libraryName;
7601
+ this.libraryVersion = libraryVersion;
7602
+ this.applicationTelemetry = applicationTelemetry;
7603
+ this.clientId = clientId;
7604
+ this.logger = logger;
7605
+ this.callbacks = new Map();
7606
+ this.eventsByCorrelationId = new Map();
7607
+ this.measurementsById = new Map();
7608
+ }
7366
7609
  /**
7367
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
7368
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
7369
- */
7370
- PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
7371
- /**
7372
- * signJwt API in CryptoOpts class (msal-browser).
7373
- * Used to signed a pop token.
7374
- */
7375
- PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
7376
- /**
7377
- * acquireToken API in the SilentCacheClient class (msal-browser).
7378
- * Used to read access tokens from the cache.
7379
- */
7380
- PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
7381
- /**
7382
- * acquireToken API in the SilentIframeClient class (msal-browser).
7383
- * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
7384
- */
7385
- PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
7386
- /**
7387
- * acquireToken API in SilentRereshClient (msal-browser).
7388
- * Used to acquire a new set of tokens from the token endpoint using a refresh token.
7389
- */
7390
- PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
7391
- /**
7392
- * ssoSilent API (msal-browser).
7393
- * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
7394
- */
7395
- PerformanceEvents["SsoSilent"] = "ssoSilent";
7396
- /**
7397
- * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
7398
- * Used to load authority metadata for a request.
7399
- */
7400
- PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
7401
- /**
7402
- * acquireToken APIs in msal-browser.
7403
- * Used to make an /authorize endpoint call with native brokering enabled.
7404
- */
7405
- PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
7406
- /**
7407
- * acquireToken API in NativeInteractionClient class (msal-browser).
7408
- * Used to acquire a token from Native component when native brokering is enabled.
7409
- */
7410
- PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
7411
- })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
7412
- /**
7413
- * State of the performance event.
7414
- *
7415
- * @export
7416
- * @enum {number}
7417
- */
7418
- var PerformanceEventStatus;
7419
- (function (PerformanceEventStatus) {
7420
- PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
7421
- PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
7422
- PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
7423
- })(PerformanceEventStatus || (PerformanceEventStatus = {}));
7424
-
7425
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7426
-
7427
- /*
7428
- * Copyright (c) Microsoft Corporation. All rights reserved.
7429
- * Licensed under the MIT License.
7430
- */
7431
- var PerformanceClient = /** @class */ (function () {
7432
- /**
7433
- * Creates an instance of PerformanceClient,
7434
- * an abstract class containing core performance telemetry logic.
7435
- *
7436
- * @constructor
7437
- * @param {string} clientId Client ID of the application
7438
- * @param {string} authority Authority used by the application
7439
- * @param {Logger} logger Logger used by the application
7440
- * @param {string} libraryName Name of the library
7441
- * @param {string} libraryVersion Version of the library
7442
- */
7443
- function PerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
7444
- this.authority = authority;
7445
- this.libraryName = libraryName;
7446
- this.libraryVersion = libraryVersion;
7447
- this.applicationTelemetry = applicationTelemetry;
7448
- this.clientId = clientId;
7449
- this.logger = logger;
7450
- this.callbacks = new Map();
7451
- this.eventsByCorrelationId = new Map();
7452
- this.measurementsById = new Map();
7453
- }
7454
- /**
7455
- * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
7456
- *
7457
- * @param {PerformanceEvents} measureName
7458
- * @param {?string} [correlationId]
7459
- * @returns {InProgressPerformanceEvent}
7610
+ * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
7611
+ *
7612
+ * @param {PerformanceEvents} measureName
7613
+ * @param {?string} [correlationId]
7614
+ * @returns {InProgressPerformanceEvent}
7460
7615
  */
7461
7616
  PerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
7462
7617
  var _this = this;
@@ -7480,7 +7635,7 @@ var PerformanceClient = /** @class */ (function () {
7480
7635
  clientId: this.clientId,
7481
7636
  name: measureName,
7482
7637
  startTimeMs: Date.now(),
7483
- correlationId: eventCorrelationId
7638
+ correlationId: eventCorrelationId,
7484
7639
  };
7485
7640
  // Store in progress events so they can be discarded if not ended properly
7486
7641
  this.cacheEventByCorrelationId(inProgressEvent);
@@ -7625,6 +7780,12 @@ var PerformanceClient = /** @class */ (function () {
7625
7780
  else {
7626
7781
  _this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
7627
7782
  }
7783
+ if (current.accessTokenSize) {
7784
+ previous.accessTokenSize = current.accessTokenSize;
7785
+ }
7786
+ if (current.idTokenSize) {
7787
+ previous.idTokenSize = current.idTokenSize;
7788
+ }
7628
7789
  }
7629
7790
  return previous;
7630
7791
  }, topLevelEvent);
@@ -7692,7 +7853,7 @@ var PerformanceClient = /** @class */ (function () {
7692
7853
  return PerformanceClient;
7693
7854
  }());
7694
7855
 
7695
- /*! @azure/msal-common v7.1.0 2022-07-05 */
7856
+ /*! @azure/msal-common v7.4.0 2022-09-06 */
7696
7857
 
7697
7858
  /*
7698
7859
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8912,26 +9073,57 @@ var BrowserCacheManager = /** @class */ (function (_super) {
8912
9073
  * Gets the active account
8913
9074
  */
8914
9075
  BrowserCacheManager.prototype.getActiveAccount = function () {
8915
- var activeAccountIdKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
8916
- var activeAccountId = this.browserStorage.getItem(activeAccountIdKey);
8917
- if (!activeAccountId) {
9076
+ var activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
9077
+ var activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
9078
+ if (!activeAccountValueFilters) {
9079
+ // if new active account cache type isn't found, it's an old version, so look for that instead
9080
+ this.logger.trace("No active account filters cache schema found, looking for legacy schema");
9081
+ var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
9082
+ var activeAccountValueLocal = this.getItem(activeAccountKeyLocal);
9083
+ if (!activeAccountValueLocal) {
9084
+ this.logger.trace("No active account found");
9085
+ return null;
9086
+ }
9087
+ var activeAccount = this.getAccountInfoByFilter({ localAccountId: activeAccountValueLocal })[0] || null;
9088
+ if (activeAccount) {
9089
+ this.logger.trace("Legacy active account cache schema found");
9090
+ this.logger.trace("Adding active account filters cache schema");
9091
+ this.setActiveAccount(activeAccount);
9092
+ return activeAccount;
9093
+ }
8918
9094
  return null;
8919
9095
  }
8920
- return this.getAccountInfoByFilter({ localAccountId: activeAccountId })[0] || null;
9096
+ var activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);
9097
+ if (activeAccountValueObj) {
9098
+ this.logger.trace("Active account filters schema found");
9099
+ return this.getAccountInfoByFilter({
9100
+ homeAccountId: activeAccountValueObj.homeAccountId,
9101
+ localAccountId: activeAccountValueObj.localAccountId
9102
+ })[0] || null;
9103
+ }
9104
+ this.logger.trace("No active account found");
9105
+ return null;
8921
9106
  };
8922
9107
  /**
8923
9108
  * Sets the active account's localAccountId in cache
8924
9109
  * @param account
8925
9110
  */
8926
9111
  BrowserCacheManager.prototype.setActiveAccount = function (account) {
8927
- var activeAccountIdKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
9112
+ var activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
9113
+ var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
8928
9114
  if (account) {
8929
9115
  this.logger.verbose("setActiveAccount: Active account set");
8930
- this.browserStorage.setItem(activeAccountIdKey, account.localAccountId);
9116
+ var activeAccountValue = {
9117
+ homeAccountId: account.homeAccountId,
9118
+ localAccountId: account.localAccountId
9119
+ };
9120
+ this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));
9121
+ this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);
8931
9122
  }
8932
9123
  else {
8933
9124
  this.logger.verbose("setActiveAccount: No account passed, active account not set");
8934
- this.browserStorage.removeItem(activeAccountIdKey);
9125
+ this.browserStorage.removeItem(activeAccountKey);
9126
+ this.browserStorage.removeItem(activeAccountKeyLocal);
8935
9127
  }
8936
9128
  };
8937
9129
  /**
@@ -9489,7 +9681,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
9489
9681
 
9490
9682
  /* eslint-disable header/header */
9491
9683
  var name = "@azure/msal-browser";
9492
- var version = "2.27.0";
9684
+ var version = "2.28.2";
9493
9685
 
9494
9686
  /*
9495
9687
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10038,8 +10230,7 @@ var BaseInteractionClient = /** @class */ (function () {
10038
10230
  protocolMode: this.config.auth.protocolMode,
10039
10231
  knownAuthorities: this.config.auth.knownAuthorities,
10040
10232
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
10041
- authorityMetadata: this.config.auth.authorityMetadata,
10042
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
10233
+ authorityMetadata: this.config.auth.authorityMetadata
10043
10234
  };
10044
10235
  if (!requestAuthority) return [3 /*break*/, 2];
10045
10236
  this.logger.verbose("Creating discovered authority with request authority");
@@ -10671,6 +10862,10 @@ var NativeAuthErrorMessage = {
10671
10862
  userSwitch: {
10672
10863
  code: "user_switch",
10673
10864
  desc: "User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."
10865
+ },
10866
+ tokensNotFoundInCache: {
10867
+ code: "tokens_not_found_in_internal_memory_cache",
10868
+ desc: "Tokens not cached in MSAL JS internal memory, please make the WAM request"
10674
10869
  }
10675
10870
  };
10676
10871
  var NativeAuthError = /** @class */ (function (_super) {
@@ -10725,20 +10920,122 @@ var NativeAuthError = /** @class */ (function (_super) {
10725
10920
  NativeAuthError.createUserSwitchError = function () {
10726
10921
  return new NativeAuthError(NativeAuthErrorMessage.userSwitch.code, NativeAuthErrorMessage.userSwitch.desc);
10727
10922
  };
10923
+ /**
10924
+ * Creates a tokens not found error when the internal cache look up fails
10925
+ * @returns NativeAuthError: tokensNotFoundInCache
10926
+ */
10927
+ NativeAuthError.createTokensNotFoundInCacheError = function () {
10928
+ return new NativeAuthError(NativeAuthErrorMessage.tokensNotFoundInCache.code, NativeAuthErrorMessage.tokensNotFoundInCache.desc);
10929
+ };
10728
10930
  return NativeAuthError;
10729
10931
  }(AuthError));
10730
10932
 
10933
+ /*
10934
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10935
+ * Licensed under the MIT License.
10936
+ */
10937
+ var SilentCacheClient = /** @class */ (function (_super) {
10938
+ __extends$1(SilentCacheClient, _super);
10939
+ function SilentCacheClient() {
10940
+ return _super !== null && _super.apply(this, arguments) || this;
10941
+ }
10942
+ /**
10943
+ * Returns unexpired tokens from the cache, if available
10944
+ * @param silentRequest
10945
+ */
10946
+ SilentCacheClient.prototype.acquireToken = function (silentRequest) {
10947
+ return __awaiter$1(this, void 0, void 0, function () {
10948
+ var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
10949
+ return __generator$1(this, function (_a) {
10950
+ switch (_a.label) {
10951
+ case 0:
10952
+ acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
10953
+ serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
10954
+ return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
10955
+ case 1:
10956
+ silentAuthClient = _a.sent();
10957
+ this.logger.verbose("Silent auth client created");
10958
+ _a.label = 2;
10959
+ case 2:
10960
+ _a.trys.push([2, 4, , 5]);
10961
+ return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];
10962
+ case 3:
10963
+ cachedToken = _a.sent();
10964
+ acquireTokenMeasurement.endMeasurement({
10965
+ success: true,
10966
+ fromCache: true
10967
+ });
10968
+ return [2 /*return*/, cachedToken];
10969
+ case 4:
10970
+ error_1 = _a.sent();
10971
+ if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
10972
+ this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
10973
+ }
10974
+ acquireTokenMeasurement.endMeasurement({
10975
+ errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,
10976
+ subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,
10977
+ success: false
10978
+ });
10979
+ throw error_1;
10980
+ case 5: return [2 /*return*/];
10981
+ }
10982
+ });
10983
+ });
10984
+ };
10985
+ /**
10986
+ * Currently Unsupported
10987
+ */
10988
+ SilentCacheClient.prototype.logout = function () {
10989
+ // Synchronous so we must reject
10990
+ return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
10991
+ };
10992
+ /**
10993
+ * Creates an Silent Flow Client with the given authority, or the default authority.
10994
+ * @param serverTelemetryManager
10995
+ * @param authorityUrl
10996
+ */
10997
+ SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
10998
+ return __awaiter$1(this, void 0, void 0, function () {
10999
+ var clientConfig;
11000
+ return __generator$1(this, function (_a) {
11001
+ switch (_a.label) {
11002
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
11003
+ case 1:
11004
+ clientConfig = _a.sent();
11005
+ return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];
11006
+ }
11007
+ });
11008
+ });
11009
+ };
11010
+ SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
11011
+ return __awaiter$1(this, void 0, void 0, function () {
11012
+ var _a;
11013
+ return __generator$1(this, function (_b) {
11014
+ switch (_b.label) {
11015
+ case 0:
11016
+ _a = [__assign$1({}, request)];
11017
+ return [4 /*yield*/, this.initializeBaseRequest(request)];
11018
+ case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
11019
+ }
11020
+ });
11021
+ });
11022
+ };
11023
+ return SilentCacheClient;
11024
+ }(StandardInteractionClient));
11025
+
10731
11026
  /*
10732
11027
  * Copyright (c) Microsoft Corporation. All rights reserved.
10733
11028
  * Licensed under the MIT License.
10734
11029
  */
10735
11030
  var NativeInteractionClient = /** @class */ (function (_super) {
10736
11031
  __extends$1(NativeInteractionClient, _super);
10737
- function NativeInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, correlationId) {
11032
+ function NativeInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
10738
11033
  var _this = _super.call(this, config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId) || this;
10739
11034
  _this.apiId = apiId;
10740
11035
  _this.accountId = accountId;
10741
11036
  _this.nativeMessageHandler = provider;
11037
+ _this.nativeStorageManager = nativeStorageImpl;
11038
+ _this.silentCacheClient = new SilentCacheClient(config, _this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
10742
11039
  return _this;
10743
11040
  }
10744
11041
  /**
@@ -10747,22 +11044,40 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10747
11044
  */
10748
11045
  NativeInteractionClient.prototype.acquireToken = function (request) {
10749
11046
  return __awaiter$1(this, void 0, void 0, function () {
10750
- var nativeATMeasurement, nativeRequest, messageBody, reqTimestamp, response, validatedResponse;
11047
+ var nativeATMeasurement, reqTimestamp, nativeRequest, result, messageBody, response, validatedResponse;
10751
11048
  return __generator$1(this, function (_a) {
10752
11049
  switch (_a.label) {
10753
11050
  case 0:
10754
11051
  this.logger.trace("NativeInteractionClient - acquireToken called.");
10755
11052
  nativeATMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
11053
+ reqTimestamp = TimeUtils.nowSeconds();
10756
11054
  return [4 /*yield*/, this.initializeNativeRequest(request)];
10757
11055
  case 1:
10758
11056
  nativeRequest = _a.sent();
11057
+ _a.label = 2;
11058
+ case 2:
11059
+ _a.trys.push([2, 4, , 5]);
11060
+ return [4 /*yield*/, this.acquireTokensFromCache(this.accountId, nativeRequest)];
11061
+ case 3:
11062
+ result = _a.sent();
11063
+ nativeATMeasurement.endMeasurement({
11064
+ success: true,
11065
+ isNativeBroker: true,
11066
+ fromCache: true
11067
+ });
11068
+ return [2 /*return*/, result];
11069
+ case 4:
11070
+ _a.sent();
11071
+ // continue with a native call for any and all errors
11072
+ this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
11073
+ return [3 /*break*/, 5];
11074
+ case 5:
10759
11075
  messageBody = {
10760
11076
  method: NativeExtensionMethod.GetToken,
10761
11077
  request: nativeRequest
10762
11078
  };
10763
- reqTimestamp = TimeUtils.nowSeconds();
10764
11079
  return [4 /*yield*/, this.nativeMessageHandler.sendMessage(messageBody)];
10765
- case 2:
11080
+ case 6:
10766
11081
  response = _a.sent();
10767
11082
  validatedResponse = this.validateNativeResponse(response);
10768
11083
  return [2 /*return*/, this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)
@@ -10786,13 +11101,61 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10786
11101
  });
10787
11102
  });
10788
11103
  };
11104
+ /**
11105
+ * Creates silent flow request
11106
+ * @param request
11107
+ * @param cachedAccount
11108
+ * @returns CommonSilentFlowRequest
11109
+ */
11110
+ NativeInteractionClient.prototype.createSilentCacheRequest = function (request, cachedAccount) {
11111
+ return {
11112
+ authority: request.authority,
11113
+ correlationId: this.correlationId,
11114
+ scopes: ScopeSet.fromString(request.scope).asArray(),
11115
+ account: cachedAccount,
11116
+ forceRefresh: false,
11117
+ };
11118
+ };
11119
+ /**
11120
+ * Fetches the tokens from the cache if un-expired
11121
+ * @param nativeAccountId
11122
+ * @param request
11123
+ * @returns authenticationResult
11124
+ */
11125
+ NativeInteractionClient.prototype.acquireTokensFromCache = function (nativeAccountId, request) {
11126
+ return __awaiter$1(this, void 0, void 0, function () {
11127
+ var accountEntity, account, silentRequest, result, e_2;
11128
+ return __generator$1(this, function (_a) {
11129
+ switch (_a.label) {
11130
+ case 0:
11131
+ accountEntity = this.browserStorage.readAccountFromCacheWithNativeAccountId(nativeAccountId);
11132
+ if (!accountEntity) {
11133
+ throw ClientAuthError.createNoAccountFoundError();
11134
+ }
11135
+ account = accountEntity.getAccountInfo();
11136
+ _a.label = 1;
11137
+ case 1:
11138
+ _a.trys.push([1, 3, , 4]);
11139
+ silentRequest = this.createSilentCacheRequest(request, account);
11140
+ return [4 /*yield*/, this.silentCacheClient.acquireToken(silentRequest)];
11141
+ case 2:
11142
+ result = _a.sent();
11143
+ return [2 /*return*/, result];
11144
+ case 3:
11145
+ e_2 = _a.sent();
11146
+ throw e_2;
11147
+ case 4: return [2 /*return*/];
11148
+ }
11149
+ });
11150
+ });
11151
+ };
10789
11152
  /**
10790
11153
  * Acquires a token from native platform then redirects to the redirectUri instead of returning the response
10791
11154
  * @param request
10792
11155
  */
10793
11156
  NativeInteractionClient.prototype.acquireTokenRedirect = function (request) {
10794
11157
  return __awaiter$1(this, void 0, void 0, function () {
10795
- var nativeRequest, messageBody, response, e_1, navigationOptions, redirectUri;
11158
+ var nativeRequest, messageBody, response, e_3, navigationOptions, redirectUri;
10796
11159
  return __generator$1(this, function (_a) {
10797
11160
  switch (_a.label) {
10798
11161
  case 0:
@@ -10813,10 +11176,10 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10813
11176
  this.validateNativeResponse(response);
10814
11177
  return [3 /*break*/, 5];
10815
11178
  case 4:
10816
- e_1 = _a.sent();
11179
+ e_3 = _a.sent();
10817
11180
  // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
10818
- if (e_1 instanceof NativeAuthError && e_1.isFatal()) {
10819
- throw e_1;
11181
+ if (e_3 instanceof NativeAuthError && e_3.isFatal()) {
11182
+ throw e_3;
10820
11183
  }
10821
11184
  return [3 /*break*/, 5];
10822
11185
  case 5:
@@ -10840,7 +11203,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10840
11203
  */
10841
11204
  NativeInteractionClient.prototype.handleRedirectPromise = function () {
10842
11205
  return __awaiter$1(this, void 0, void 0, function () {
10843
- var cachedRequest, messageBody, reqTimestamp, response, result, e_2;
11206
+ var cachedRequest, messageBody, reqTimestamp, response, result, e_4;
10844
11207
  return __generator$1(this, function (_a) {
10845
11208
  switch (_a.label) {
10846
11209
  case 0:
@@ -10872,9 +11235,9 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10872
11235
  this.browserStorage.setInteractionInProgress(false);
10873
11236
  return [2 /*return*/, result];
10874
11237
  case 3:
10875
- e_2 = _a.sent();
11238
+ e_4 = _a.sent();
10876
11239
  this.browserStorage.setInteractionInProgress(false);
10877
- throw e_2;
11240
+ throw e_4;
10878
11241
  case 4: return [2 /*return*/];
10879
11242
  }
10880
11243
  });
@@ -10896,7 +11259,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10896
11259
  */
10897
11260
  NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {
10898
11261
  return __awaiter$1(this, void 0, void 0, function () {
10899
- var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result;
11262
+ var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result, idTokenEntity, expiresIn, tokenExpirationSeconds, accessTokenEntity;
10900
11263
  var _this = this;
10901
11264
  return __generator$1(this, function (_b) {
10902
11265
  switch (_b.label) {
@@ -10914,7 +11277,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10914
11277
  homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
10915
11278
  accountEntity = AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authorityPreferredCache, response.account.id);
10916
11279
  this.browserStorage.setAccount(accountEntity);
10917
- responseScopes = response.scopes ? ScopeSet.fromString(response.scopes) : ScopeSet.fromString(request.scopes);
11280
+ responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);
10918
11281
  accountProperties = response.account.properties || {};
10919
11282
  uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
10920
11283
  tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
@@ -10974,7 +11337,17 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10974
11337
  state: response.state,
10975
11338
  fromNativeBroker: true
10976
11339
  };
10977
- // Remove any existing cached tokens for this account
11340
+ idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
11341
+ this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
11342
+ expiresIn = (responseTokenType === exports.AuthenticationScheme.POP)
11343
+ ? Constants.SHR_NONCE_VALIDITY
11344
+ : (typeof response.expires_in === "string"
11345
+ ? parseInt(response.expires_in, 10)
11346
+ : response.expires_in) || 0;
11347
+ tokenExpirationSeconds = reqTimestamp + expiresIn;
11348
+ accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tid, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
11349
+ this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
11350
+ // Remove any existing cached tokens for this account in browser storage
10978
11351
  this.browserStorage.removeAccountContext(accountEntity).catch(function (e) {
10979
11352
  _this.logger.error("Error occurred while removing account context from browser storage. " + e);
10980
11353
  });
@@ -10992,7 +11365,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10992
11365
  response.hasOwnProperty("id_token") &&
10993
11366
  response.hasOwnProperty("client_info") &&
10994
11367
  response.hasOwnProperty("account") &&
10995
- response.hasOwnProperty("scopes") &&
11368
+ response.hasOwnProperty("scope") &&
10996
11369
  response.hasOwnProperty("expires_in")) {
10997
11370
  return response;
10998
11371
  }
@@ -11034,7 +11407,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11034
11407
  */
11035
11408
  NativeInteractionClient.prototype.initializeNativeRequest = function (request) {
11036
11409
  return __awaiter$1(this, void 0, void 0, function () {
11037
- var authority, canonicalAuthority, scopes, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11410
+ var authority, canonicalAuthority, scopes, remainingProperties, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11038
11411
  var _this = this;
11039
11412
  return __generator$1(this, function (_a) {
11040
11413
  switch (_a.label) {
@@ -11043,8 +11416,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11043
11416
  authority = request.authority || this.config.auth.authority;
11044
11417
  canonicalAuthority = new UrlString(authority);
11045
11418
  canonicalAuthority.validateAsUri();
11046
- scopes = request && request.scopes || [];
11047
- scopeSet = new ScopeSet(scopes);
11419
+ scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
11420
+ scopeSet = new ScopeSet(scopes || []);
11048
11421
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
11049
11422
  getPrompt = function () {
11050
11423
  // If request is silent, prompt is always none
@@ -11071,7 +11444,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11071
11444
  throw BrowserAuthError.createNativePromptParameterNotSupportedError();
11072
11445
  }
11073
11446
  };
11074
- validatedRequest = __assign$1(__assign$1({}, request), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scopes: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
11447
+ validatedRequest = __assign$1(__assign$1({}, remainingProperties), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scope: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
11075
11448
  });
11076
11449
  if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
11077
11450
  shrParameters = {
@@ -11338,8 +11711,10 @@ var NativeMessageHandler = /** @class */ (function () {
11338
11711
  */
11339
11712
  var RedirectClient = /** @class */ (function (_super) {
11340
11713
  __extends$1(RedirectClient, _super);
11341
- function RedirectClient() {
11342
- return _super !== null && _super.apply(this, arguments) || this;
11714
+ function RedirectClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
11715
+ var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
11716
+ _this.nativeStorage = nativeStorageImpl;
11717
+ return _this;
11343
11718
  }
11344
11719
  /**
11345
11720
  * Redirects the page to the /authorize endpoint of the IDP
@@ -11548,7 +11923,7 @@ var RedirectClient = /** @class */ (function (_super) {
11548
11923
  if (!this.nativeMessageHandler) {
11549
11924
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
11550
11925
  }
11551
- nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, cachedRequest.correlationId);
11926
+ nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, cachedRequest.correlationId);
11552
11927
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
11553
11928
  return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, cachedRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently
11554
11929
  })).finally(function () {
@@ -11666,10 +12041,11 @@ var RedirectClient = /** @class */ (function (_super) {
11666
12041
  */
11667
12042
  var PopupClient = /** @class */ (function (_super) {
11668
12043
  __extends$1(PopupClient, _super);
11669
- function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {
12044
+ function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
11670
12045
  var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
11671
12046
  // Properly sets this reference for the unload event.
11672
12047
  _this.unloadWindow = _this.unloadWindow.bind(_this);
12048
+ _this.nativeStorage = nativeStorageImpl;
11673
12049
  return _this;
11674
12050
  }
11675
12051
  /**
@@ -11794,7 +12170,7 @@ var PopupClient = /** @class */ (function (_super) {
11794
12170
  if (!this.nativeMessageHandler) {
11795
12171
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
11796
12172
  }
11797
- nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, validRequest.correlationId);
12173
+ nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, validRequest.correlationId);
11798
12174
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state_1).userRequestState;
11799
12175
  return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, validRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently
11800
12176
  })).finally(function () {
@@ -12422,9 +12798,10 @@ var SilentHandler = /** @class */ (function (_super) {
12422
12798
  */
12423
12799
  var SilentIframeClient = /** @class */ (function (_super) {
12424
12800
  __extends$1(SilentIframeClient, _super);
12425
- function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {
12801
+ function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
12426
12802
  var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
12427
12803
  _this.apiId = apiId;
12804
+ _this.nativeStorage = nativeStorageImpl;
12428
12805
  return _this;
12429
12806
  }
12430
12807
  /**
@@ -12527,7 +12904,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12527
12904
  if (!this.nativeMessageHandler) {
12528
12905
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
12529
12906
  }
12530
- nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.correlationId);
12907
+ nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, this.correlationId);
12531
12908
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
12532
12909
  return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, silentRequest), { state: userRequestState, prompt: PromptValue.NONE })).finally(function () {
12533
12910
  _this.browserStorage.cleanRequestByState(state);
@@ -12542,99 +12919,6 @@ var SilentIframeClient = /** @class */ (function (_super) {
12542
12919
  return SilentIframeClient;
12543
12920
  }(StandardInteractionClient));
12544
12921
 
12545
- /*
12546
- * Copyright (c) Microsoft Corporation. All rights reserved.
12547
- * Licensed under the MIT License.
12548
- */
12549
- var SilentCacheClient = /** @class */ (function (_super) {
12550
- __extends$1(SilentCacheClient, _super);
12551
- function SilentCacheClient() {
12552
- return _super !== null && _super.apply(this, arguments) || this;
12553
- }
12554
- /**
12555
- * Returns unexpired tokens from the cache, if available
12556
- * @param silentRequest
12557
- */
12558
- SilentCacheClient.prototype.acquireToken = function (silentRequest) {
12559
- return __awaiter$1(this, void 0, void 0, function () {
12560
- var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
12561
- return __generator$1(this, function (_a) {
12562
- switch (_a.label) {
12563
- case 0:
12564
- acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
12565
- serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12566
- return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12567
- case 1:
12568
- silentAuthClient = _a.sent();
12569
- this.logger.verbose("Silent auth client created");
12570
- _a.label = 2;
12571
- case 2:
12572
- _a.trys.push([2, 4, , 5]);
12573
- return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];
12574
- case 3:
12575
- cachedToken = _a.sent();
12576
- acquireTokenMeasurement.endMeasurement({
12577
- success: true,
12578
- fromCache: true
12579
- });
12580
- return [2 /*return*/, cachedToken];
12581
- case 4:
12582
- error_1 = _a.sent();
12583
- if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
12584
- this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
12585
- }
12586
- acquireTokenMeasurement.endMeasurement({
12587
- errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,
12588
- subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,
12589
- success: false
12590
- });
12591
- throw error_1;
12592
- case 5: return [2 /*return*/];
12593
- }
12594
- });
12595
- });
12596
- };
12597
- /**
12598
- * Currently Unsupported
12599
- */
12600
- SilentCacheClient.prototype.logout = function () {
12601
- // Synchronous so we must reject
12602
- return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
12603
- };
12604
- /**
12605
- * Creates an Silent Flow Client with the given authority, or the default authority.
12606
- * @param serverTelemetryManager
12607
- * @param authorityUrl
12608
- */
12609
- SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
12610
- return __awaiter$1(this, void 0, void 0, function () {
12611
- var clientConfig;
12612
- return __generator$1(this, function (_a) {
12613
- switch (_a.label) {
12614
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12615
- case 1:
12616
- clientConfig = _a.sent();
12617
- return [2 /*return*/, new SilentFlowClient(clientConfig)];
12618
- }
12619
- });
12620
- });
12621
- };
12622
- SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
12623
- return __awaiter$1(this, void 0, void 0, function () {
12624
- var _a;
12625
- return __generator$1(this, function (_b) {
12626
- switch (_b.label) {
12627
- case 0:
12628
- _a = [__assign$1({}, request)];
12629
- return [4 /*yield*/, this.initializeBaseRequest(request)];
12630
- case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
12631
- }
12632
- });
12633
- });
12634
- };
12635
- return SilentCacheClient;
12636
- }(StandardInteractionClient));
12637
-
12638
12922
  /*
12639
12923
  * Copyright (c) Microsoft Corporation. All rights reserved.
12640
12924
  * Licensed under the MIT License.
@@ -12710,7 +12994,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12710
12994
  case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12711
12995
  case 1:
12712
12996
  clientConfig = _a.sent();
12713
- return [2 /*return*/, new RefreshTokenClient(clientConfig)];
12997
+ return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];
12714
12998
  }
12715
12999
  });
12716
13000
  });
@@ -14652,6 +14936,13 @@ var ClientApplication = /** @class */ (function () {
14652
14936
  this.browserStorage = this.isBrowserEnvironment ?
14653
14937
  new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :
14654
14938
  DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
14939
+ // initialize in memory storage for native flows
14940
+ var nativeCacheOptions = {
14941
+ cacheLocation: exports.BrowserCacheLocation.MemoryStorage,
14942
+ storeAuthStateInCookie: false,
14943
+ secureCookies: false
14944
+ };
14945
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
14655
14946
  // Initialize the token cache
14656
14947
  this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
14657
14948
  }
@@ -14718,7 +15009,7 @@ var ClientApplication = /** @class */ (function () {
14718
15009
  redirectResponse = void 0;
14719
15010
  if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {
14720
15011
  this.logger.trace("handleRedirectPromise - acquiring token from native platform");
14721
- nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, request.correlationId);
15012
+ nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
14722
15013
  redirectResponse = nativeClient.handleRedirectPromise();
14723
15014
  }
14724
15015
  else {
@@ -14790,7 +15081,7 @@ var ClientApplication = /** @class */ (function () {
14790
15081
  this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Redirect, request);
14791
15082
  }
14792
15083
  if (this.nativeExtensionProvider && this.canUseNative(request)) {
14793
- nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), request.correlationId);
15084
+ nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
14794
15085
  result = nativeClient.acquireTokenRedirect(request).catch(function (e) {
14795
15086
  if (e instanceof NativeAuthError && e.isFatal()) {
14796
15087
  _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
@@ -14858,7 +15149,9 @@ var ClientApplication = /** @class */ (function () {
14858
15149
  _this.browserStorage.setInteractionInProgress(false);
14859
15150
  atPopupMeasurement.endMeasurement({
14860
15151
  success: true,
14861
- isNativeBroker: true
15152
+ isNativeBroker: true,
15153
+ accessTokenSize: response.accessToken.length,
15154
+ idTokenSize: response.idToken.length,
14862
15155
  });
14863
15156
  atPopupMeasurement.flushMeasurement();
14864
15157
  return response;
@@ -14882,7 +15175,9 @@ var ClientApplication = /** @class */ (function () {
14882
15175
  result = popupClient.acquireToken(request);
14883
15176
  }
14884
15177
  return result.then(function (result) {
14885
- // If logged in, emit acquire token events
15178
+ /*
15179
+ * If logged in, emit acquire token events
15180
+ */
14886
15181
  var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
14887
15182
  if (isLoggingIn) {
14888
15183
  _this.eventHandler.emitEvent(exports.EventType.LOGIN_SUCCESS, exports.InteractionType.Popup, result);
@@ -14891,7 +15186,9 @@ var ClientApplication = /** @class */ (function () {
14891
15186
  _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
14892
15187
  }
14893
15188
  atPopupMeasurement.endMeasurement({
14894
- success: true
15189
+ success: true,
15190
+ accessTokenSize: result.accessToken.length,
15191
+ idTokenSize: result.idToken.length,
14895
15192
  });
14896
15193
  atPopupMeasurement.flushMeasurement();
14897
15194
  return result;
@@ -14959,7 +15256,9 @@ var ClientApplication = /** @class */ (function () {
14959
15256
  _this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
14960
15257
  ssoSilentMeasurement.endMeasurement({
14961
15258
  success: true,
14962
- isNativeBroker: response.fromNativeBroker
15259
+ isNativeBroker: response.fromNativeBroker,
15260
+ accessTokenSize: response.accessToken.length,
15261
+ idTokenSize: response.idToken.length
14963
15262
  });
14964
15263
  ssoSilentMeasurement.flushMeasurement();
14965
15264
  return response;
@@ -15008,6 +15307,8 @@ var ClientApplication = /** @class */ (function () {
15008
15307
  _this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
15009
15308
  atbcMeasurement.endMeasurement({
15010
15309
  success: true,
15310
+ accessTokenSize: result.accessToken.length,
15311
+ idTokenSize: result.idToken.length,
15011
15312
  isNativeBroker: result.fromNativeBroker
15012
15313
  });
15013
15314
  atbcMeasurement.flushMeasurement();
@@ -15112,7 +15413,9 @@ var ClientApplication = /** @class */ (function () {
15112
15413
  .then(function (result) {
15113
15414
  atbrtMeasurement.endMeasurement({
15114
15415
  success: true,
15115
- fromCache: result.fromCache
15416
+ fromCache: result.fromCache,
15417
+ accessTokenSize: result.accessToken.length,
15418
+ idTokenSize: result.idToken.length,
15116
15419
  });
15117
15420
  return result;
15118
15421
  })
@@ -15127,7 +15430,9 @@ var ClientApplication = /** @class */ (function () {
15127
15430
  .then(function (result) {
15128
15431
  atbrtMeasurement.endMeasurement({
15129
15432
  success: true,
15130
- fromCache: result.fromCache
15433
+ fromCache: result.fromCache,
15434
+ accessTokenSize: result.accessToken.length,
15435
+ idTokenSize: result.idToken.length,
15131
15436
  });
15132
15437
  return result;
15133
15438
  })
@@ -15339,7 +15644,7 @@ var ClientApplication = /** @class */ (function () {
15339
15644
  if (!this.nativeExtensionProvider) {
15340
15645
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
15341
15646
  }
15342
- nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), request.correlationId);
15647
+ nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
15343
15648
  return [2 /*return*/, nativeClient.acquireToken(request)];
15344
15649
  });
15345
15650
  });
@@ -15386,21 +15691,21 @@ var ClientApplication = /** @class */ (function () {
15386
15691
  * @param correlationId
15387
15692
  */
15388
15693
  ClientApplication.prototype.createPopupClient = function (correlationId) {
15389
- return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
15694
+ return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
15390
15695
  };
15391
15696
  /**
15392
15697
  * Returns new instance of the Redirect Interaction Client
15393
15698
  * @param correlationId
15394
15699
  */
15395
15700
  ClientApplication.prototype.createRedirectClient = function (correlationId) {
15396
- return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
15701
+ return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
15397
15702
  };
15398
15703
  /**
15399
15704
  * Returns new instance of the Silent Iframe Interaction Client
15400
15705
  * @param correlationId
15401
15706
  */
15402
15707
  ClientApplication.prototype.createSilentIframeClient = function (correlationId) {
15403
- return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent, this.performanceClient, this.nativeExtensionProvider, correlationId);
15708
+ return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
15404
15709
  };
15405
15710
  /**
15406
15711
  * Returns new instance of the Silent Cache Interaction Client
@@ -15636,6 +15941,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
15636
15941
  atsMeasurement.endMeasurement({
15637
15942
  success: true,
15638
15943
  fromCache: result.fromCache,
15944
+ accessTokenSize: result.accessToken.length,
15945
+ idTokenSize: result.idToken.length,
15639
15946
  isNativeBroker: result.fromNativeBroker
15640
15947
  });
15641
15948
  atsMeasurement.flushMeasurement();
@@ -15644,8 +15951,6 @@ var PublicClientApplication = /** @class */ (function (_super) {
15644
15951
  .catch(function (error) {
15645
15952
  _this.activeSilentTokenRequests.delete(silentRequestKey);
15646
15953
  atsMeasurement.endMeasurement({
15647
- errorCode: error.errorCode,
15648
- subErrorCode: error.subError,
15649
15954
  success: false
15650
15955
  });
15651
15956
  atsMeasurement.flushMeasurement();
@@ -15715,6 +16020,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
15715
16020
  astsAsyncMeasurement.endMeasurement({
15716
16021
  success: true,
15717
16022
  fromCache: response.fromCache,
16023
+ accessTokenSize: response.accessToken.length,
16024
+ idTokenSize: response.idToken.length,
15718
16025
  isNativeBroker: response.fromNativeBroker
15719
16026
  });
15720
16027
  return response;