@azure/msal-browser 2.26.0 → 2.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/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 +2 -1
  5. package/dist/app/ClientApplication.d.ts.map +1 -1
  6. package/dist/app/ClientApplication.js +49 -15
  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 +40 -9
  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.d.ts.map +1 -1
  25. package/dist/cache/TokenCache.js +2 -1
  26. package/dist/cache/TokenCache.js.map +1 -1
  27. package/dist/config/Configuration.d.ts +4 -0
  28. package/dist/config/Configuration.d.ts.map +1 -1
  29. package/dist/config/Configuration.js +2 -1
  30. package/dist/config/Configuration.js.map +1 -1
  31. package/dist/crypto/BrowserCrypto.js +1 -1
  32. package/dist/crypto/CryptoOps.js +1 -1
  33. package/dist/crypto/GuidGenerator.js +1 -1
  34. package/dist/crypto/PkceGenerator.js +1 -1
  35. package/dist/crypto/SignedHttpRequest.js +1 -1
  36. package/dist/encode/Base64Decode.js +1 -1
  37. package/dist/encode/Base64Encode.js +1 -1
  38. package/dist/error/BrowserAuthError.js +1 -1
  39. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  40. package/dist/error/NativeAuthError.d.ts +11 -1
  41. package/dist/error/NativeAuthError.d.ts.map +1 -1
  42. package/dist/error/NativeAuthError.js +15 -1
  43. package/dist/error/NativeAuthError.js.map +1 -1
  44. package/dist/event/EventHandler.js +1 -1
  45. package/dist/event/EventMessage.js +1 -1
  46. package/dist/event/EventType.js +1 -1
  47. package/dist/index.cjs.js +811 -411
  48. package/dist/index.cjs.js.map +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  51. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  52. package/dist/interaction_client/NativeInteractionClient.d.ts +18 -1
  53. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  54. package/dist/interaction_client/NativeInteractionClient.js +123 -33
  55. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  56. package/dist/interaction_client/PopupClient.d.ts +2 -1
  57. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  58. package/dist/interaction_client/PopupClient.js +4 -3
  59. package/dist/interaction_client/PopupClient.js.map +1 -1
  60. package/dist/interaction_client/RedirectClient.d.ts +8 -1
  61. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  62. package/dist/interaction_client/RedirectClient.js +6 -4
  63. package/dist/interaction_client/RedirectClient.js.map +1 -1
  64. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  65. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  66. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  67. package/dist/interaction_client/SilentCacheClient.js +2 -2
  68. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  69. package/dist/interaction_client/SilentIframeClient.d.ts +2 -1
  70. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  71. package/dist/interaction_client/SilentIframeClient.js +4 -3
  72. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  73. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  74. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  75. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  76. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  77. package/dist/interaction_client/StandardInteractionClient.js +2 -1
  78. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  79. package/dist/interaction_handler/InteractionHandler.js +1 -1
  80. package/dist/interaction_handler/RedirectHandler.js +1 -1
  81. package/dist/interaction_handler/SilentHandler.js +1 -1
  82. package/dist/internals.js +1 -1
  83. package/dist/navigation/NavigationClient.js +1 -1
  84. package/dist/network/FetchClient.js +1 -1
  85. package/dist/network/XhrClient.js +1 -1
  86. package/dist/packageMetadata.d.ts +1 -1
  87. package/dist/packageMetadata.js +2 -2
  88. package/dist/packageMetadata.js.map +1 -1
  89. package/dist/request/PopupRequest.d.ts +1 -1
  90. package/dist/request/RedirectRequest.d.ts +1 -1
  91. package/dist/request/SsoSilentRequest.d.ts +1 -1
  92. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  93. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  94. package/dist/utils/BrowserConstants.js +1 -1
  95. package/dist/utils/BrowserProtocolUtils.js +1 -1
  96. package/dist/utils/BrowserStringUtils.js +1 -1
  97. package/dist/utils/BrowserUtils.js +1 -1
  98. package/dist/utils/MathUtils.js +1 -1
  99. package/lib/msal-browser.js +811 -411
  100. package/lib/msal-browser.js.map +1 -1
  101. package/lib/msal-browser.min.js +43 -41
  102. package/package.json +3 -4
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.26.0 2022-06-13 */
1
+ /*! @azure/msal-browser v2.28.1 2022-08-01 */
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.0.0 2022-06-13 */
120
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
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.0.0 2022-06-13 */
207
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
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
@@ -476,6 +490,7 @@ var AuthorityMetadataSource;
476
490
  AuthorityMetadataSource["CONFIG"] = "config";
477
491
  AuthorityMetadataSource["CACHE"] = "cache";
478
492
  AuthorityMetadataSource["NETWORK"] = "network";
493
+ AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
479
494
  })(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
480
495
  var SERVER_TELEM_CONSTANTS = {
481
496
  SCHEMA_VERSION: 5,
@@ -566,7 +581,7 @@ var JsonTypes;
566
581
  JsonTypes["Jwk"] = "JWK";
567
582
  })(JsonTypes || (JsonTypes = {}));
568
583
 
569
- /*! @azure/msal-common v7.0.0 2022-06-13 */
584
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
570
585
 
571
586
  /*
572
587
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -579,6 +594,10 @@ var AuthErrorMessage = {
579
594
  unexpectedError: {
580
595
  code: "unexpected_error",
581
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."
582
601
  }
583
602
  };
584
603
  /**
@@ -607,10 +626,18 @@ var AuthError = /** @class */ (function (_super) {
607
626
  AuthError.createUnexpectedError = function (errDesc) {
608
627
  return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + ": " + errDesc);
609
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
+ };
610
637
  return AuthError;
611
638
  }(Error));
612
639
 
613
- /*! @azure/msal-common v7.0.0 2022-06-13 */
640
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
614
641
 
615
642
  /*
616
643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -685,7 +712,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
685
712
  }
686
713
  };
687
714
 
688
- /*! @azure/msal-common v7.0.0 2022-06-13 */
715
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
689
716
 
690
717
  /*
691
718
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1157,7 +1184,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1157
1184
  return ClientAuthError;
1158
1185
  }(AuthError));
1159
1186
 
1160
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1187
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1161
1188
 
1162
1189
  /*
1163
1190
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1282,7 +1309,7 @@ var StringUtils = /** @class */ (function () {
1282
1309
  return StringUtils;
1283
1310
  }());
1284
1311
 
1285
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1312
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1286
1313
 
1287
1314
  /*
1288
1315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1462,12 +1489,12 @@ var Logger = /** @class */ (function () {
1462
1489
  return Logger;
1463
1490
  }());
1464
1491
 
1465
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1492
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1466
1493
  /* eslint-disable header/header */
1467
1494
  var name$1 = "@azure/msal-common";
1468
- var version$1 = "7.0.0";
1495
+ var version$1 = "7.3.0";
1469
1496
 
1470
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1497
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1471
1498
  /*
1472
1499
  * Copyright (c) Microsoft Corporation. All rights reserved.
1473
1500
  * Licensed under the MIT License.
@@ -1488,7 +1515,7 @@ exports.AzureCloudInstance = void 0;
1488
1515
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1489
1516
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1490
1517
 
1491
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1518
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1492
1519
 
1493
1520
  /*
1494
1521
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1647,7 +1674,7 @@ var CredentialEntity = /** @class */ (function () {
1647
1674
  return CredentialEntity;
1648
1675
  }());
1649
1676
 
1650
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1677
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1651
1678
 
1652
1679
  /*
1653
1680
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1902,7 +1929,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1902
1929
  return ClientConfigurationError;
1903
1930
  }(ClientAuthError));
1904
1931
 
1905
- /*! @azure/msal-common v7.0.0 2022-06-13 */
1932
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
1906
1933
 
1907
1934
  /*
1908
1935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2086,7 +2113,7 @@ var ScopeSet = /** @class */ (function () {
2086
2113
  return ScopeSet;
2087
2114
  }());
2088
2115
 
2089
- /*! @azure/msal-common v7.0.0 2022-06-13 */
2116
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
2090
2117
 
2091
2118
  /*
2092
2119
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2124,7 +2151,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2124
2151
  };
2125
2152
  }
2126
2153
 
2127
- /*! @azure/msal-common v7.0.0 2022-06-13 */
2154
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
2128
2155
  /*
2129
2156
  * Copyright (c) Microsoft Corporation. All rights reserved.
2130
2157
  * Licensed under the MIT License.
@@ -2138,7 +2165,7 @@ var AuthorityType;
2138
2165
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2139
2166
  })(AuthorityType || (AuthorityType = {}));
2140
2167
 
2141
- /*! @azure/msal-common v7.0.0 2022-06-13 */
2168
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
2142
2169
 
2143
2170
  /*
2144
2171
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2373,7 +2400,7 @@ var AccountEntity = /** @class */ (function () {
2373
2400
  return AccountEntity;
2374
2401
  }());
2375
2402
 
2376
- /*! @azure/msal-common v7.0.0 2022-06-13 */
2403
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
2377
2404
 
2378
2405
  /*
2379
2406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2411,7 +2438,7 @@ var AuthToken = /** @class */ (function () {
2411
2438
  return AuthToken;
2412
2439
  }());
2413
2440
 
2414
- /*! @azure/msal-common v7.0.0 2022-06-13 */
2441
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
2415
2442
 
2416
2443
  /*
2417
2444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2533,7 +2560,7 @@ var CacheManager = /** @class */ (function () {
2533
2560
  * @param realm
2534
2561
  */
2535
2562
  CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {
2536
- return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING, accountFilter ? accountFilter.environment : Constants.EMPTY_STRING, accountFilter ? accountFilter.realm : Constants.EMPTY_STRING);
2563
+ 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);
2537
2564
  };
2538
2565
  /**
2539
2566
  * retrieve accounts matching all provided filters; if no filter is set, get all accounts
@@ -2542,7 +2569,7 @@ var CacheManager = /** @class */ (function () {
2542
2569
  * @param environment
2543
2570
  * @param realm
2544
2571
  */
2545
- CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm) {
2572
+ CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm, nativeAccountId) {
2546
2573
  var _this = this;
2547
2574
  var allCacheKeys = this.getKeys();
2548
2575
  var matchingAccounts = {};
@@ -2560,6 +2587,9 @@ var CacheManager = /** @class */ (function () {
2560
2587
  if (!!realm && !_this.matchRealm(entity, realm)) {
2561
2588
  return;
2562
2589
  }
2590
+ if (!!nativeAccountId && !_this.matchNativeAccountId(entity, nativeAccountId)) {
2591
+ return;
2592
+ }
2563
2593
  matchingAccounts[cacheKey] = entity;
2564
2594
  });
2565
2595
  return matchingAccounts;
@@ -2888,6 +2918,26 @@ var CacheManager = /** @class */ (function () {
2888
2918
  var accountKey = AccountEntity.generateAccountCacheKey(account);
2889
2919
  return this.getAccount(accountKey);
2890
2920
  };
2921
+ /**
2922
+ * Retrieve AccountEntity from cache
2923
+ * @param nativeAccountId
2924
+ * @returns AccountEntity or Null
2925
+ */
2926
+ CacheManager.prototype.readAccountFromCacheWithNativeAccountId = function (nativeAccountId) {
2927
+ // fetch account from memory
2928
+ var accountFilter = {
2929
+ nativeAccountId: nativeAccountId
2930
+ };
2931
+ var accountCache = this.getAccountsFilteredBy(accountFilter);
2932
+ var accounts = Object.keys(accountCache).map(function (key) { return accountCache[key]; });
2933
+ if (accounts.length < 1) {
2934
+ return null;
2935
+ }
2936
+ else if (accounts.length > 1) {
2937
+ throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
2938
+ }
2939
+ return accountCache[0];
2940
+ };
2891
2941
  /**
2892
2942
  * Retrieve IdTokenEntity from cache
2893
2943
  * @param clientId
@@ -3062,6 +3112,15 @@ var CacheManager = /** @class */ (function () {
3062
3112
  CacheManager.prototype.matchRealm = function (entity, realm) {
3063
3113
  return !!(entity.realm && realm === entity.realm);
3064
3114
  };
3115
+ /**
3116
+ * helper to match nativeAccountId
3117
+ * @param entity
3118
+ * @param nativeAccountId
3119
+ * @returns boolean indicating the match result
3120
+ */
3121
+ CacheManager.prototype.matchNativeAccountId = function (entity, nativeAccountId) {
3122
+ return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);
3123
+ };
3065
3124
  /**
3066
3125
  * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.
3067
3126
  * @param entity
@@ -3253,7 +3312,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3253
3312
  return DefaultStorageClass;
3254
3313
  }(CacheManager));
3255
3314
 
3256
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3315
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3257
3316
 
3258
3317
  /*
3259
3318
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3336,7 +3395,7 @@ function buildClientConfiguration(_a) {
3336
3395
  telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), telemetry),
3337
3396
  serverTelemetryManager: serverTelemetryManager || null,
3338
3397
  persistencePlugin: persistencePlugin || null,
3339
- serializableCache: serializableCache || null
3398
+ serializableCache: serializableCache || null,
3340
3399
  };
3341
3400
  }
3342
3401
  /**
@@ -3344,10 +3403,10 @@ function buildClientConfiguration(_a) {
3344
3403
  * @param authOptions
3345
3404
  */
3346
3405
  function buildAuthOptions(authOptions) {
3347
- return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
3406
+ return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3348
3407
  }
3349
3408
 
3350
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3409
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3351
3410
 
3352
3411
  /*
3353
3412
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3367,7 +3426,7 @@ var ServerError = /** @class */ (function (_super) {
3367
3426
  return ServerError;
3368
3427
  }(AuthError));
3369
3428
 
3370
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3429
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3371
3430
 
3372
3431
  /*
3373
3432
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3463,7 +3522,7 @@ var ThrottlingUtils = /** @class */ (function () {
3463
3522
  return ThrottlingUtils;
3464
3523
  }());
3465
3524
 
3466
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3525
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3467
3526
 
3468
3527
  /*
3469
3528
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3512,7 +3571,7 @@ var NetworkManager = /** @class */ (function () {
3512
3571
  return NetworkManager;
3513
3572
  }());
3514
3573
 
3515
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3574
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3516
3575
  /*
3517
3576
  * Copyright (c) Microsoft Corporation. All rights reserved.
3518
3577
  * Licensed under the MIT License.
@@ -3523,7 +3582,7 @@ var CcsCredentialType;
3523
3582
  CcsCredentialType["UPN"] = "UPN";
3524
3583
  })(CcsCredentialType || (CcsCredentialType = {}));
3525
3584
 
3526
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3585
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3527
3586
 
3528
3587
  /*
3529
3588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3533,7 +3592,7 @@ var CcsCredentialType;
3533
3592
  * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
3534
3593
  */
3535
3594
  var BaseClient = /** @class */ (function () {
3536
- function BaseClient(configuration) {
3595
+ function BaseClient(configuration, performanceClient) {
3537
3596
  // Set the configuration
3538
3597
  this.config = buildClientConfiguration(configuration);
3539
3598
  // Initialize the logger
@@ -3550,6 +3609,8 @@ var BaseClient = /** @class */ (function () {
3550
3609
  this.serverTelemetryManager = this.config.serverTelemetryManager;
3551
3610
  // set Authority
3552
3611
  this.authority = this.config.authOptions.authority;
3612
+ // set performance telemetry client
3613
+ this.performanceClient = performanceClient;
3553
3614
  }
3554
3615
  /**
3555
3616
  * Creates default headers for requests to token endpoint
@@ -3612,7 +3673,7 @@ var BaseClient = /** @class */ (function () {
3612
3673
  return BaseClient;
3613
3674
  }());
3614
3675
 
3615
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3676
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3616
3677
 
3617
3678
  /*
3618
3679
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3698,7 +3759,7 @@ var RequestValidator = /** @class */ (function () {
3698
3759
  return RequestValidator;
3699
3760
  }());
3700
3761
 
3701
- /*! @azure/msal-common v7.0.0 2022-06-13 */
3762
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
3702
3763
 
3703
3764
  /*
3704
3765
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4076,7 +4137,7 @@ var RequestParameterBuilder = /** @class */ (function () {
4076
4137
  return RequestParameterBuilder;
4077
4138
  }());
4078
4139
 
4079
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4140
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4080
4141
 
4081
4142
  /*
4082
4143
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4140,7 +4201,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4140
4201
  return IdTokenEntity;
4141
4202
  }(CredentialEntity));
4142
4203
 
4143
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4204
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4144
4205
  /*
4145
4206
  * Copyright (c) Microsoft Corporation. All rights reserved.
4146
4207
  * Licensed under the MIT License.
@@ -4190,7 +4251,7 @@ var TimeUtils = /** @class */ (function () {
4190
4251
  return TimeUtils;
4191
4252
  }());
4192
4253
 
4193
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4254
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4194
4255
 
4195
4256
  /*
4196
4257
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4304,7 +4365,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4304
4365
  return AccessTokenEntity;
4305
4366
  }(CredentialEntity));
4306
4367
 
4307
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4368
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4308
4369
 
4309
4370
  /*
4310
4371
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4371,7 +4432,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4371
4432
  return RefreshTokenEntity;
4372
4433
  }(CredentialEntity));
4373
4434
 
4374
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4435
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4375
4436
 
4376
4437
  /*
4377
4438
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4399,6 +4460,10 @@ var InteractionRequiredAuthErrorMessage = {
4399
4460
  noTokensFoundError: {
4400
4461
  code: "no_tokens_found",
4401
4462
  desc: "No refresh token found in the cache. Please sign-in."
4463
+ },
4464
+ native_account_unavailable: {
4465
+ code: "native_account_unavailable",
4466
+ desc: "The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API."
4402
4467
  }
4403
4468
  };
4404
4469
  /**
@@ -4432,10 +4497,17 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4432
4497
  InteractionRequiredAuthError.createNoTokensFoundError = function () {
4433
4498
  return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.noTokensFoundError.code, InteractionRequiredAuthErrorMessage.noTokensFoundError.desc);
4434
4499
  };
4500
+ /**
4501
+ * Creates an error thrown when the native broker returns ACCOUNT_UNAVAILABLE status, indicating that the account was removed and interactive sign-in is required
4502
+ * @returns
4503
+ */
4504
+ InteractionRequiredAuthError.createNativeAccountUnavailableError = function () {
4505
+ return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.native_account_unavailable.code, InteractionRequiredAuthErrorMessage.native_account_unavailable.desc);
4506
+ };
4435
4507
  return InteractionRequiredAuthError;
4436
4508
  }(AuthError));
4437
4509
 
4438
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4510
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4439
4511
  /*
4440
4512
  * Copyright (c) Microsoft Corporation. All rights reserved.
4441
4513
  * Licensed under the MIT License.
@@ -4451,7 +4523,7 @@ var CacheRecord = /** @class */ (function () {
4451
4523
  return CacheRecord;
4452
4524
  }());
4453
4525
 
4454
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4526
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4455
4527
 
4456
4528
  /*
4457
4529
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4522,7 +4594,7 @@ var ProtocolUtils = /** @class */ (function () {
4522
4594
  return ProtocolUtils;
4523
4595
  }());
4524
4596
 
4525
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4597
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4526
4598
 
4527
4599
  /*
4528
4600
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4723,7 +4795,7 @@ var UrlString = /** @class */ (function () {
4723
4795
  return UrlString;
4724
4796
  }());
4725
4797
 
4726
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4798
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4727
4799
 
4728
4800
  /*
4729
4801
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4824,7 +4896,7 @@ var PopTokenGenerator = /** @class */ (function () {
4824
4896
  return PopTokenGenerator;
4825
4897
  }());
4826
4898
 
4827
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4899
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4828
4900
 
4829
4901
  /*
4830
4902
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4894,7 +4966,7 @@ var AppMetadataEntity = /** @class */ (function () {
4894
4966
  return AppMetadataEntity;
4895
4967
  }());
4896
4968
 
4897
- /*! @azure/msal-common v7.0.0 2022-06-13 */
4969
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4898
4970
  /*
4899
4971
  * Copyright (c) Microsoft Corporation. All rights reserved.
4900
4972
  * Licensed under the MIT License.
@@ -4930,7 +5002,7 @@ var AppMetadataEntity = /** @class */ (function () {
4930
5002
  return TokenCacheContext;
4931
5003
  }());
4932
5004
 
4933
- /*! @azure/msal-common v7.0.0 2022-06-13 */
5005
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
4934
5006
 
4935
5007
  /*
4936
5008
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4991,7 +5063,7 @@ var ResponseHandler = /** @class */ (function () {
4991
5063
  * @param serverTokenResponse
4992
5064
  * @param authority
4993
5065
  */
4994
- ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse) {
5066
+ ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse) {
4995
5067
  return __awaiter(this, void 0, void 0, function () {
4996
5068
  var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;
4997
5069
  return __generator(this, function (_a) {
@@ -5028,14 +5100,15 @@ var ResponseHandler = /** @class */ (function () {
5028
5100
  /*
5029
5101
  * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.
5030
5102
  * If not present, we should return null, as it's the case that another application called removeAccount in between
5031
- * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.
5103
+ * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal, unless explicitly flagged by
5104
+ * the developer, as in the case of refresh token flow used in ADAL Node to MSAL Node migration.
5032
5105
  */
5033
- if (handlingRefreshTokenResponse && cacheRecord.account) {
5106
+ if (handlingRefreshTokenResponse && !forceCacheRefreshTokenResponse && cacheRecord.account) {
5034
5107
  key = cacheRecord.account.generateAccountKey();
5035
5108
  account = this.cacheStorage.getAccount(key);
5036
5109
  if (!account) {
5037
5110
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
5038
- return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
5111
+ return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined)];
5039
5112
  }
5040
5113
  }
5041
5114
  return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];
@@ -5200,7 +5273,7 @@ var ResponseHandler = /** @class */ (function () {
5200
5273
  return ResponseHandler;
5201
5274
  }());
5202
5275
 
5203
- /*! @azure/msal-common v7.0.0 2022-06-13 */
5276
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5204
5277
 
5205
5278
  /*
5206
5279
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5301,7 +5374,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5301
5374
  throw ClientConfigurationError.createEmptyLogoutRequestError();
5302
5375
  }
5303
5376
  var queryString = this.createLogoutUrlQueryString(logoutRequest);
5304
- // Construct logout URI.
5377
+ // Construct logout URI
5305
5378
  return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);
5306
5379
  };
5307
5380
  /**
@@ -5488,7 +5561,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5488
5561
  */
5489
5562
  AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
5490
5563
  return __awaiter(this, void 0, void 0, function () {
5491
- var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5564
+ var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5492
5565
  return __generator(this, function (_a) {
5493
5566
  switch (_a.label) {
5494
5567
  case 0:
@@ -5518,7 +5591,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5518
5591
  if (request.domainHint) {
5519
5592
  parameterBuilder.addDomainHint(request.domainHint);
5520
5593
  }
5521
- // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
5594
+ // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
5522
5595
  if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
5523
5596
  // AAD will throw if prompt=select_account is passed with an account hint
5524
5597
  if (request.sid && request.prompt === PromptValue.NONE) {
@@ -5528,9 +5601,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5528
5601
  }
5529
5602
  else if (request.account) {
5530
5603
  accountSid = this.extractAccountSid(request.account);
5531
- // If account and loginHint are provided, we will check account first for sid before adding loginHint
5532
- if (accountSid && request.prompt === PromptValue.NONE) {
5533
- // SessionId is only used in silent calls
5604
+ accountLoginHintClaim = this.extractLoginHint(request.account);
5605
+ // If login_hint claim is present, use it over sid/username
5606
+ if (accountLoginHintClaim) {
5607
+ this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
5608
+ parameterBuilder.addLoginHint(accountLoginHintClaim);
5609
+ try {
5610
+ clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
5611
+ parameterBuilder.addCcsOid(clientInfo);
5612
+ }
5613
+ catch (e) {
5614
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5615
+ }
5616
+ }
5617
+ else if (accountSid && request.prompt === PromptValue.NONE) {
5618
+ /*
5619
+ * If account and loginHint are provided, we will check account first for sid before adding loginHint
5620
+ * SessionId is only used in silent calls
5621
+ */
5534
5622
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
5535
5623
  parameterBuilder.addSid(accountSid);
5536
5624
  try {
@@ -5538,7 +5626,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5538
5626
  parameterBuilder.addCcsOid(clientInfo);
5539
5627
  }
5540
5628
  catch (e) {
5541
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5629
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5542
5630
  }
5543
5631
  }
5544
5632
  else if (request.loginHint) {
@@ -5555,7 +5643,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5555
5643
  parameterBuilder.addCcsOid(clientInfo);
5556
5644
  }
5557
5645
  catch (e) {
5558
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5646
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5559
5647
  }
5560
5648
  }
5561
5649
  }
@@ -5626,16 +5714,135 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5626
5714
  * @param account
5627
5715
  */
5628
5716
  AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
5629
- if (account.idTokenClaims) {
5630
- var tokenClaims = account.idTokenClaims;
5631
- return tokenClaims.sid || null;
5632
- }
5633
- return null;
5717
+ var _a;
5718
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
5719
+ };
5720
+ AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
5721
+ var _a;
5722
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
5634
5723
  };
5635
5724
  return AuthorizationCodeClient;
5636
5725
  }(BaseClient));
5637
5726
 
5638
- /*! @azure/msal-common v7.0.0 2022-06-13 */
5727
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5728
+ /*
5729
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5730
+ * Licensed under the MIT License.
5731
+ */
5732
+ /**
5733
+ * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
5734
+ *
5735
+ * @export
5736
+ * @enum {number}
5737
+ */
5738
+ exports.PerformanceEvents = void 0;
5739
+ (function (PerformanceEvents) {
5740
+ /**
5741
+ * acquireTokenByCode API (msal-browser and msal-node).
5742
+ * Used to acquire tokens by trading an authorization code against the token endpoint.
5743
+ */
5744
+ PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
5745
+ /**
5746
+ * acquireTokenByRefreshToken API (msal-browser and msal-node).
5747
+ * Used to renew an access token using a refresh token against the token endpoint.
5748
+ */
5749
+ PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
5750
+ /**
5751
+ * acquireTokenSilent API (msal-browser and msal-node).
5752
+ * Used to silently acquire a new access token (from the cache or the network).
5753
+ */
5754
+ PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
5755
+ /**
5756
+ * acquireTokenSilentAsync (msal-browser).
5757
+ * Internal API for acquireTokenSilent.
5758
+ */
5759
+ PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
5760
+ /**
5761
+ * acquireTokenPopup (msal-browser).
5762
+ * Used to acquire a new access token interactively through pop ups
5763
+ */
5764
+ PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
5765
+ /**
5766
+ * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
5767
+ * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
5768
+ */
5769
+ PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
5770
+ /**
5771
+ * signJwt API in CryptoOpts class (msal-browser).
5772
+ * Used to signed a pop token.
5773
+ */
5774
+ PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
5775
+ /**
5776
+ * acquireToken API in the SilentCacheClient class (msal-browser).
5777
+ * Used to read access tokens from the cache.
5778
+ */
5779
+ PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
5780
+ /**
5781
+ * acquireToken API in the SilentIframeClient class (msal-browser).
5782
+ * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
5783
+ */
5784
+ PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
5785
+ /**
5786
+ * acquireToken API in SilentRereshClient (msal-browser).
5787
+ * Used to acquire a new set of tokens from the token endpoint using a refresh token.
5788
+ */
5789
+ PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
5790
+ /**
5791
+ * ssoSilent API (msal-browser).
5792
+ * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
5793
+ */
5794
+ PerformanceEvents["SsoSilent"] = "ssoSilent";
5795
+ /**
5796
+ * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
5797
+ * Used to load authority metadata for a request.
5798
+ */
5799
+ PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
5800
+ /**
5801
+ * acquireToken APIs in msal-browser.
5802
+ * Used to make an /authorize endpoint call with native brokering enabled.
5803
+ */
5804
+ PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
5805
+ /**
5806
+ * acquireToken API in NativeInteractionClient class (msal-browser).
5807
+ * Used to acquire a token from Native component when native brokering is enabled.
5808
+ */
5809
+ PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
5810
+ /**
5811
+ * Time spent on the network for refresh token acquisition
5812
+ */
5813
+ PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
5814
+ /**
5815
+ * Time spent creating default headers for requests to token endpoint
5816
+ */
5817
+ PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
5818
+ /**
5819
+ * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
5820
+ */
5821
+ PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
5822
+ /**
5823
+ * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
5824
+ */
5825
+ PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
5826
+ /**
5827
+ * acquireToken API in BrokerClientApplication.
5828
+ * Used to acquire a token on behalf of the embedded application (PW-Broker).
5829
+ */
5830
+ PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
5831
+ })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
5832
+ /**
5833
+ * State of the performance event.
5834
+ *
5835
+ * @export
5836
+ * @enum {number}
5837
+ */
5838
+ var PerformanceEventStatus;
5839
+ (function (PerformanceEventStatus) {
5840
+ PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
5841
+ PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
5842
+ PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
5843
+ })(PerformanceEventStatus || (PerformanceEventStatus = {}));
5844
+
5845
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5639
5846
 
5640
5847
  /*
5641
5848
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5646,8 +5853,8 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5646
5853
  */
5647
5854
  var RefreshTokenClient = /** @class */ (function (_super) {
5648
5855
  __extends(RefreshTokenClient, _super);
5649
- function RefreshTokenClient(configuration) {
5650
- return _super.call(this, configuration) || this;
5856
+ function RefreshTokenClient(configuration, performanceClient) {
5857
+ return _super.call(this, configuration, performanceClient) || this;
5651
5858
  }
5652
5859
  RefreshTokenClient.prototype.acquireToken = function (request) {
5653
5860
  return __awaiter(this, void 0, void 0, function () {
@@ -5661,7 +5868,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5661
5868
  response = _a.sent();
5662
5869
  responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
5663
5870
  responseHandler.validateTokenResponse(response.body);
5664
- return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true)];
5871
+ return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache)];
5665
5872
  }
5666
5873
  });
5667
5874
  });
@@ -5733,13 +5940,16 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5733
5940
  * @param authority
5734
5941
  */
5735
5942
  RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
5943
+ var _a;
5736
5944
  return __awaiter(this, void 0, void 0, function () {
5737
- var requestBody, queryParameters, headers, thumbprint, endpoint;
5738
- return __generator(this, function (_a) {
5739
- switch (_a.label) {
5740
- case 0: return [4 /*yield*/, this.createTokenRequestBody(request)];
5945
+ var acquireTokenMeasurement, requestBody, queryParameters, headers, thumbprint, endpoint;
5946
+ return __generator(this, function (_b) {
5947
+ switch (_b.label) {
5948
+ case 0:
5949
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
5950
+ return [4 /*yield*/, this.createTokenRequestBody(request)];
5741
5951
  case 1:
5742
- requestBody = _a.sent();
5952
+ requestBody = _b.sent();
5743
5953
  queryParameters = this.createTokenQueryParameters(request);
5744
5954
  headers = this.createTokenRequestHeaders(request.ccsCredential);
5745
5955
  thumbprint = {
@@ -5754,7 +5964,19 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5754
5964
  sshKid: request.sshKid
5755
5965
  };
5756
5966
  endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
5757
- return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
5967
+ return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
5968
+ .then(function (result) {
5969
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
5970
+ success: true
5971
+ });
5972
+ return result;
5973
+ })
5974
+ .catch(function (error) {
5975
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
5976
+ success: false
5977
+ });
5978
+ throw error;
5979
+ })];
5758
5980
  }
5759
5981
  });
5760
5982
  });
@@ -5775,11 +5997,14 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5775
5997
  * @param request
5776
5998
  */
5777
5999
  RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
6000
+ var _a;
5778
6001
  return __awaiter(this, void 0, void 0, function () {
5779
- var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
5780
- return __generator(this, function (_a) {
5781
- switch (_a.label) {
6002
+ var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
6003
+ return __generator(this, function (_b) {
6004
+ switch (_b.label) {
5782
6005
  case 0:
6006
+ correlationId = request.correlationId;
6007
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
5783
6008
  parameterBuilder = new RequestParameterBuilder();
5784
6009
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5785
6010
  parameterBuilder.addScopes(request.scopes);
@@ -5791,7 +6016,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5791
6016
  if (this.serverTelemetryManager) {
5792
6017
  parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
5793
6018
  }
5794
- correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5795
6019
  parameterBuilder.addCorrelationId(correlationId);
5796
6020
  parameterBuilder.addRefreshToken(request.refreshToken);
5797
6021
  if (this.config.clientCredentials.clientSecret) {
@@ -5806,7 +6030,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5806
6030
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5807
6031
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5808
6032
  case 1:
5809
- reqCnfData = _a.sent();
6033
+ reqCnfData = _b.sent();
5810
6034
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
5811
6035
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
5812
6036
  return [3 /*break*/, 3];
@@ -5816,10 +6040,13 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5816
6040
  parameterBuilder.addSshJwk(request.sshJwk);
5817
6041
  }
5818
6042
  else {
6043
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6044
+ success: false
6045
+ });
5819
6046
  throw ClientConfigurationError.createMissingSshJwkError();
5820
6047
  }
5821
6048
  }
5822
- _a.label = 3;
6049
+ _b.label = 3;
5823
6050
  case 3:
5824
6051
  if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
5825
6052
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
@@ -5840,6 +6067,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5840
6067
  break;
5841
6068
  }
5842
6069
  }
6070
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6071
+ success: true
6072
+ });
5843
6073
  return [2 /*return*/, parameterBuilder.createQueryString()];
5844
6074
  }
5845
6075
  });
@@ -5848,7 +6078,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5848
6078
  return RefreshTokenClient;
5849
6079
  }(BaseClient));
5850
6080
 
5851
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6081
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5852
6082
 
5853
6083
  /*
5854
6084
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5856,8 +6086,8 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5856
6086
  */
5857
6087
  var SilentFlowClient = /** @class */ (function (_super) {
5858
6088
  __extends(SilentFlowClient, _super);
5859
- function SilentFlowClient(configuration) {
5860
- return _super.call(this, configuration) || this;
6089
+ function SilentFlowClient(configuration, performanceClient) {
6090
+ return _super.call(this, configuration, performanceClient) || this;
5861
6091
  }
5862
6092
  /**
5863
6093
  * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew
@@ -5876,7 +6106,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5876
6106
  case 2:
5877
6107
  e_1 = _a.sent();
5878
6108
  if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
5879
- refreshTokenClient = new RefreshTokenClient(this.config);
6109
+ refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
5880
6110
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];
5881
6111
  }
5882
6112
  else {
@@ -5964,7 +6194,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5964
6194
  return SilentFlowClient;
5965
6195
  }(BaseClient));
5966
6196
 
5967
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6197
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5968
6198
  /*
5969
6199
  * Copyright (c) Microsoft Corporation. All rights reserved.
5970
6200
  * Licensed under the MIT License.
@@ -5972,10 +6202,20 @@ var SilentFlowClient = /** @class */ (function (_super) {
5972
6202
  function isOpenIdConfigResponse(response) {
5973
6203
  return (response.hasOwnProperty("authorization_endpoint") &&
5974
6204
  response.hasOwnProperty("token_endpoint") &&
5975
- response.hasOwnProperty("issuer"));
6205
+ response.hasOwnProperty("issuer") &&
6206
+ response.hasOwnProperty("jwks_uri"));
5976
6207
  }
5977
6208
 
5978
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6209
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6210
+ /*
6211
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6212
+ * Licensed under the MIT License.
6213
+ */
6214
+ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/common/": { "token_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/common/": { "token_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/common/": { "token_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" }, "https://login.microsoftonline.com/consumers/": { "token_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/consumers/": { "token_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/consumers/": { "token_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" }, "https://login.microsoftonline.com/organizations/": { "token_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/organizations/": { "token_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/organizations/": { "token_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" } }, "instanceDiscoveryMetadata": { "https://login.microsoftonline.com/common/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/common/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/common/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.com/consumers/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/consumers/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/consumers/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.com/organizations/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/organizations/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/organizations/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] } } };
6215
+ var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6216
+ var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6217
+
6218
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5979
6219
  /*
5980
6220
  * Copyright (c) Microsoft Corporation. All rights reserved.
5981
6221
  * Licensed under the MIT License.
@@ -5989,7 +6229,7 @@ exports.ProtocolMode = void 0;
5989
6229
  ProtocolMode["OIDC"] = "OIDC";
5990
6230
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
5991
6231
 
5992
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6232
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
5993
6233
 
5994
6234
  /*
5995
6235
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6021,6 +6261,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
6021
6261
  this.end_session_endpoint = metadata.end_session_endpoint;
6022
6262
  this.issuer = metadata.issuer;
6023
6263
  this.endpointsFromNetwork = fromNetwork;
6264
+ this.jwks_uri = metadata.jwks_uri;
6024
6265
  };
6025
6266
  /**
6026
6267
  * Save the authority that was used to create this cache entry
@@ -6059,12 +6300,13 @@ var AuthorityMetadataEntity = /** @class */ (function () {
6059
6300
  entity.hasOwnProperty("issuer") &&
6060
6301
  entity.hasOwnProperty("aliasesFromNetwork") &&
6061
6302
  entity.hasOwnProperty("endpointsFromNetwork") &&
6062
- entity.hasOwnProperty("expiresAt"));
6303
+ entity.hasOwnProperty("expiresAt") &&
6304
+ entity.hasOwnProperty("jwks_uri"));
6063
6305
  };
6064
6306
  return AuthorityMetadataEntity;
6065
6307
  }());
6066
6308
 
6067
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6309
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6068
6310
  /*
6069
6311
  * Copyright (c) Microsoft Corporation. All rights reserved.
6070
6312
  * Licensed under the MIT License.
@@ -6074,7 +6316,7 @@ function isCloudInstanceDiscoveryResponse(response) {
6074
6316
  response.hasOwnProperty("metadata"));
6075
6317
  }
6076
6318
 
6077
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6319
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6078
6320
 
6079
6321
  /*
6080
6322
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6196,7 +6438,7 @@ var RegionDiscovery = /** @class */ (function () {
6196
6438
  return RegionDiscovery;
6197
6439
  }());
6198
6440
 
6199
- /*! @azure/msal-common v7.0.0 2022-06-13 */
6441
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6200
6442
 
6201
6443
  /*
6202
6444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6381,6 +6623,22 @@ var Authority = /** @class */ (function () {
6381
6623
  enumerable: false,
6382
6624
  configurable: true
6383
6625
  });
6626
+ Object.defineProperty(Authority.prototype, "jwksUri", {
6627
+ /**
6628
+ * Jwks_uri for token signing keys
6629
+ */
6630
+ get: function () {
6631
+ if (this.discoveryComplete()) {
6632
+ var endpoint = this.replacePath(this.metadata.jwks_uri);
6633
+ return this.replaceTenant(endpoint);
6634
+ }
6635
+ else {
6636
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
6637
+ }
6638
+ },
6639
+ enumerable: false,
6640
+ configurable: true
6641
+ });
6384
6642
  /**
6385
6643
  * Replaces tenant in url path with current tenant. Defaults to common.
6386
6644
  * @param urlString
@@ -6464,11 +6722,11 @@ var Authority = /** @class */ (function () {
6464
6722
  * @param metadataEntity
6465
6723
  */
6466
6724
  Authority.prototype.updateEndpointMetadata = function (metadataEntity) {
6467
- var _a;
6725
+ var _a, _b;
6468
6726
  return __awaiter(this, void 0, void 0, function () {
6469
- var metadata, autodetectedRegionName, azureRegion;
6470
- return __generator(this, function (_b) {
6471
- switch (_b.label) {
6727
+ var metadata, harcodedMetadata;
6728
+ return __generator(this, function (_c) {
6729
+ switch (_c.label) {
6472
6730
  case 0:
6473
6731
  metadata = this.getEndpointMetadataFromConfig();
6474
6732
  if (metadata) {
@@ -6479,41 +6737,30 @@ var Authority = /** @class */ (function () {
6479
6737
  // No need to update
6480
6738
  return [2 /*return*/, AuthorityMetadataSource.CACHE];
6481
6739
  }
6740
+ harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
6482
6741
  return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];
6483
6742
  case 1:
6484
- metadata = _b.sent();
6743
+ metadata = _c.sent();
6485
6744
  if (!metadata) return [3 /*break*/, 4];
6486
6745
  if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
6487
- return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
6746
+ return [4 /*yield*/, this.updateMetadataWithRegionalInformation(metadata)];
6488
6747
  case 2:
6489
- autodetectedRegionName = _b.sent();
6490
- azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
6491
- ? autodetectedRegionName
6492
- : this.authorityOptions.azureRegionConfiguration.azureRegion;
6493
- if (this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
6494
- this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
6495
- RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
6496
- RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
6497
- }
6498
- else {
6499
- if (autodetectedRegionName) {
6500
- this.regionDiscoveryMetadata.region_outcome = (this.authorityOptions.azureRegionConfiguration.azureRegion === autodetectedRegionName) ?
6501
- RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
6502
- RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
6503
- }
6504
- else {
6505
- this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
6506
- }
6507
- }
6508
- if (azureRegion) {
6509
- this.regionDiscoveryMetadata.region_used = azureRegion;
6510
- metadata = Authority.replaceWithRegionalInformation(metadata, azureRegion);
6511
- }
6512
- _b.label = 3;
6748
+ metadata = _c.sent();
6749
+ _c.label = 3;
6513
6750
  case 3:
6514
6751
  metadataEntity.updateEndpointMetadata(metadata, true);
6515
6752
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
6516
- case 4: throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
6753
+ case 4:
6754
+ if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];
6755
+ if (!((_b = this.authorityOptions.azureRegionConfiguration) === null || _b === void 0 ? void 0 : _b.azureRegion)) return [3 /*break*/, 6];
6756
+ return [4 /*yield*/, this.updateMetadataWithRegionalInformation(harcodedMetadata)];
6757
+ case 5:
6758
+ harcodedMetadata = _c.sent();
6759
+ _c.label = 6;
6760
+ case 6:
6761
+ metadataEntity.updateEndpointMetadata(harcodedMetadata, false);
6762
+ return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
6763
+ case 7: throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
6517
6764
  }
6518
6765
  });
6519
6766
  });
@@ -6544,6 +6791,8 @@ var Authority = /** @class */ (function () {
6544
6791
  };
6545
6792
  /**
6546
6793
  * Gets OAuth endpoints from the given OpenID configuration endpoint.
6794
+ *
6795
+ * @param hasHardcodedMetadata boolean
6547
6796
  */
6548
6797
  Authority.prototype.getEndpointMetadataFromNetwork = function () {
6549
6798
  return __awaiter(this, void 0, void 0, function () {
@@ -6571,34 +6820,87 @@ var Authority = /** @class */ (function () {
6571
6820
  });
6572
6821
  };
6573
6822
  /**
6574
- * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache and returns where the information was retrived from
6575
- * @param cachedMetadata
6576
- * @param newMetadata
6823
+ * Get OAuth endpoints for common authorities.
6577
6824
  */
6578
- Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
6825
+ Authority.prototype.getEndpointMetadataFromHardcodedValues = function () {
6826
+ if (this.canonicalAuthority in EndpointMetadata) {
6827
+ return EndpointMetadata[this.canonicalAuthority];
6828
+ }
6829
+ return null;
6830
+ };
6831
+ /**
6832
+ * Update the retrieved metadata with regional information.
6833
+ */
6834
+ Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {
6835
+ var _a, _b, _c, _d, _e;
6579
6836
  return __awaiter(this, void 0, void 0, function () {
6580
- var metadata;
6581
- return __generator(this, function (_a) {
6582
- switch (_a.label) {
6583
- case 0:
6584
- metadata = this.getCloudDiscoveryMetadataFromConfig();
6585
- if (metadata) {
6586
- metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
6587
- return [2 /*return*/, AuthorityMetadataSource.CONFIG];
6588
- }
6589
- // If The cached metadata came from config but that config was not passed to this instance, we must go to the network
6590
- if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntity.isExpired()) {
6591
- // No need to update
6592
- return [2 /*return*/, AuthorityMetadataSource.CACHE];
6593
- }
6594
- return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
6837
+ var autodetectedRegionName, azureRegion;
6838
+ return __generator(this, function (_f) {
6839
+ switch (_f.label) {
6840
+ case 0: return [4 /*yield*/, this.regionDiscovery.detectRegion((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
6595
6841
  case 1:
6596
- metadata = _a.sent();
6597
- if (metadata) {
6598
- metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
6599
- return [2 /*return*/, AuthorityMetadataSource.NETWORK];
6600
- }
6601
- else {
6842
+ autodetectedRegionName = _f.sent();
6843
+ azureRegion = ((_b = this.authorityOptions.azureRegionConfiguration) === null || _b === void 0 ? void 0 : _b.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
6844
+ ? autodetectedRegionName
6845
+ : (_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.azureRegion;
6846
+ if (((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
6847
+ this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
6848
+ RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
6849
+ RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
6850
+ }
6851
+ else {
6852
+ if (autodetectedRegionName) {
6853
+ this.regionDiscoveryMetadata.region_outcome = (((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion) === autodetectedRegionName) ?
6854
+ RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
6855
+ RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
6856
+ }
6857
+ else {
6858
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
6859
+ }
6860
+ }
6861
+ if (azureRegion) {
6862
+ this.regionDiscoveryMetadata.region_used = azureRegion;
6863
+ return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, azureRegion)];
6864
+ }
6865
+ return [2 /*return*/, metadata];
6866
+ }
6867
+ });
6868
+ });
6869
+ };
6870
+ /**
6871
+ * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache and returns where the information was retrived from
6872
+ * @param cachedMetadata
6873
+ * @param newMetadata
6874
+ */
6875
+ Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
6876
+ return __awaiter(this, void 0, void 0, function () {
6877
+ var metadata, harcodedMetadata;
6878
+ return __generator(this, function (_a) {
6879
+ switch (_a.label) {
6880
+ case 0:
6881
+ metadata = this.getCloudDiscoveryMetadataFromConfig();
6882
+ if (metadata) {
6883
+ metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
6884
+ return [2 /*return*/, AuthorityMetadataSource.CONFIG];
6885
+ }
6886
+ // If The cached metadata came from config but that config was not passed to this instance, we must go to the network
6887
+ if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntity.isExpired()) {
6888
+ // No need to update
6889
+ return [2 /*return*/, AuthorityMetadataSource.CACHE];
6890
+ }
6891
+ harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
6892
+ return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
6893
+ case 1:
6894
+ metadata = _a.sent();
6895
+ if (metadata) {
6896
+ metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
6897
+ return [2 /*return*/, AuthorityMetadataSource.NETWORK];
6898
+ }
6899
+ if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
6900
+ metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
6901
+ return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
6902
+ }
6903
+ else {
6602
6904
  // Metadata could not be obtained from config, cache or network
6603
6905
  throw ClientConfigurationError.createUntrustedAuthorityError();
6604
6906
  }
@@ -6631,7 +6933,8 @@ var Authority = /** @class */ (function () {
6631
6933
  };
6632
6934
  /**
6633
6935
  * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config
6634
- * @param networkInterface
6936
+ *
6937
+ * @param hasHardcodedMetadata boolean
6635
6938
  */
6636
6939
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
6637
6940
  return __awaiter(this, void 0, void 0, function () {
@@ -6651,7 +6954,9 @@ var Authority = /** @class */ (function () {
6651
6954
  return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
6652
6955
  case 2:
6653
6956
  response = _a.sent();
6654
- metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
6957
+ metadata = isCloudInstanceDiscoveryResponse(response.body)
6958
+ ? response.body.metadata
6959
+ : [];
6655
6960
  if (metadata.length === 0) {
6656
6961
  // If no metadata is returned, authority is untrusted
6657
6962
  return [2 /*return*/, null];
@@ -6671,6 +6976,15 @@ var Authority = /** @class */ (function () {
6671
6976
  });
6672
6977
  });
6673
6978
  };
6979
+ /**
6980
+ * Get cloud discovery metadata for common authorities
6981
+ */
6982
+ Authority.prototype.getCloudDiscoveryMetadataFromHarcodedValues = function () {
6983
+ if (this.canonicalAuthority in InstanceDiscoveryMetadata) {
6984
+ return InstanceDiscoveryMetadata[this.canonicalAuthority];
6985
+ }
6986
+ return null;
6987
+ };
6674
6988
  /**
6675
6989
  * Helper function to determine if this host is included in the knownAuthorities config option
6676
6990
  */
@@ -6786,7 +7100,7 @@ var Authority = /** @class */ (function () {
6786
7100
  return Authority;
6787
7101
  }());
6788
7102
 
6789
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7103
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6790
7104
 
6791
7105
  /*
6792
7106
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6847,7 +7161,7 @@ var AuthorityFactory = /** @class */ (function () {
6847
7161
  return AuthorityFactory;
6848
7162
  }());
6849
7163
 
6850
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7164
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6851
7165
 
6852
7166
  /*
6853
7167
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6878,7 +7192,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
6878
7192
  return ServerTelemetryEntity;
6879
7193
  }());
6880
7194
 
6881
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7195
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6882
7196
 
6883
7197
  /*
6884
7198
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6906,7 +7220,7 @@ var ThrottlingEntity = /** @class */ (function () {
6906
7220
  return ThrottlingEntity;
6907
7221
  }());
6908
7222
 
6909
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7223
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6910
7224
 
6911
7225
  /*
6912
7226
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6923,7 +7237,7 @@ var StubbedNetworkModule = {
6923
7237
  }
6924
7238
  };
6925
7239
 
6926
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7240
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6927
7241
 
6928
7242
  /*
6929
7243
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6968,7 +7282,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
6968
7282
  return JoseHeaderError;
6969
7283
  }(AuthError));
6970
7284
 
6971
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7285
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
6972
7286
 
6973
7287
  /*
6974
7288
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7008,7 +7322,7 @@ var JoseHeader = /** @class */ (function () {
7008
7322
  return JoseHeader;
7009
7323
  }());
7010
7324
 
7011
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7325
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
7012
7326
 
7013
7327
  /*
7014
7328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7067,7 +7381,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
7067
7381
  return AuthenticationHeaderParser;
7068
7382
  }());
7069
7383
 
7070
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7384
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
7071
7385
 
7072
7386
  /*
7073
7387
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7229,104 +7543,7 @@ var ServerTelemetryManager = /** @class */ (function () {
7229
7543
  return ServerTelemetryManager;
7230
7544
  }());
7231
7545
 
7232
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7233
- /*
7234
- * Copyright (c) Microsoft Corporation. All rights reserved.
7235
- * Licensed under the MIT License.
7236
- */
7237
- /**
7238
- * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
7239
- *
7240
- * @export
7241
- * @enum {number}
7242
- */
7243
- exports.PerformanceEvents = void 0;
7244
- (function (PerformanceEvents) {
7245
- /**
7246
- * acquireTokenByCode API (msal-browser and msal-node).
7247
- * Used to acquire tokens by trading an authorization code against the token endpoint.
7248
- */
7249
- PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
7250
- /**
7251
- * acquireTokenByRefreshToken API (msal-browser and msal-node).
7252
- * Used to renew an access token using a refresh token against the token endpoint.
7253
- */
7254
- PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
7255
- /**
7256
- * acquireTokenSilent API (msal-browser and msal-node).
7257
- * Used to silently acquire a new access token (from the cache or the network).
7258
- */
7259
- PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
7260
- /**
7261
- * acquireTokenSilentAsync (msal-browser).
7262
- * Internal API for acquireTokenSilent.
7263
- */
7264
- PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
7265
- /**
7266
- * acquireTokenPopup (msal-browser).
7267
- * Used to acquire a new access token interactively through pop ups
7268
- */
7269
- PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
7270
- /**
7271
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
7272
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
7273
- */
7274
- PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
7275
- /**
7276
- * signJwt API in CryptoOpts class (msal-browser).
7277
- * Used to signed a pop token.
7278
- */
7279
- PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
7280
- /**
7281
- * acquireToken API in the SilentCacheClient class (msal-browser).
7282
- * Used to read access tokens from the cache.
7283
- */
7284
- PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
7285
- /**
7286
- * acquireToken API in the SilentIframeClient class (msal-browser).
7287
- * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
7288
- */
7289
- PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
7290
- /**
7291
- * acquireToken API in SilentRereshClient (msal-browser).
7292
- * Used to acquire a new set of tokens from the token endpoint using a refresh token.
7293
- */
7294
- PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
7295
- /**
7296
- * ssoSilent API (msal-browser).
7297
- * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
7298
- */
7299
- PerformanceEvents["SsoSilent"] = "ssoSilent";
7300
- /**
7301
- * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
7302
- * Used to load authority metadata for a request.
7303
- */
7304
- PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
7305
- /**
7306
- * acquireToken APIs in msal-browser.
7307
- * Used to make an /authorize endpoint call with native brokering enabled.
7308
- */
7309
- PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
7310
- /**
7311
- * acquireToken API in NativeInteractionClient class (msal-browser).
7312
- * Used to acquire a token from Native component when native brokering is enabled.
7313
- */
7314
- PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
7315
- })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
7316
- /**
7317
- * State of the performance event.
7318
- *
7319
- * @export
7320
- * @enum {number}
7321
- */
7322
- var PerformanceEventStatus;
7323
- (function (PerformanceEventStatus) {
7324
- PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
7325
- PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
7326
- PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
7327
- })(PerformanceEventStatus || (PerformanceEventStatus = {}));
7328
-
7329
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7546
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
7330
7547
 
7331
7548
  /*
7332
7549
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7384,7 +7601,7 @@ var PerformanceClient = /** @class */ (function () {
7384
7601
  clientId: this.clientId,
7385
7602
  name: measureName,
7386
7603
  startTimeMs: Date.now(),
7387
- correlationId: eventCorrelationId
7604
+ correlationId: eventCorrelationId,
7388
7605
  };
7389
7606
  // Store in progress events so they can be discarded if not ended properly
7390
7607
  this.cacheEventByCorrelationId(inProgressEvent);
@@ -7529,6 +7746,12 @@ var PerformanceClient = /** @class */ (function () {
7529
7746
  else {
7530
7747
  _this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
7531
7748
  }
7749
+ if (current.accessTokenSize) {
7750
+ previous.accessTokenSize = current.accessTokenSize;
7751
+ }
7752
+ if (current.idTokenSize) {
7753
+ previous.idTokenSize = current.idTokenSize;
7754
+ }
7532
7755
  }
7533
7756
  return previous;
7534
7757
  }, topLevelEvent);
@@ -7596,7 +7819,7 @@ var PerformanceClient = /** @class */ (function () {
7596
7819
  return PerformanceClient;
7597
7820
  }());
7598
7821
 
7599
- /*! @azure/msal-common v7.0.0 2022-06-13 */
7822
+ /*! @azure/msal-common v7.3.0 2022-08-01 */
7600
7823
 
7601
7824
  /*
7602
7825
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8816,26 +9039,57 @@ var BrowserCacheManager = /** @class */ (function (_super) {
8816
9039
  * Gets the active account
8817
9040
  */
8818
9041
  BrowserCacheManager.prototype.getActiveAccount = function () {
8819
- var activeAccountIdKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
8820
- var activeAccountId = this.browserStorage.getItem(activeAccountIdKey);
8821
- if (!activeAccountId) {
9042
+ var activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
9043
+ var activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
9044
+ if (!activeAccountValueFilters) {
9045
+ // if new active account cache type isn't found, it's an old version, so look for that instead
9046
+ this.logger.trace("No active account filters cache schema found, looking for legacy schema");
9047
+ var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
9048
+ var activeAccountValueLocal = this.getItem(activeAccountKeyLocal);
9049
+ if (!activeAccountValueLocal) {
9050
+ this.logger.trace("No active account found");
9051
+ return null;
9052
+ }
9053
+ var activeAccount = this.getAccountInfoByFilter({ localAccountId: activeAccountValueLocal })[0] || null;
9054
+ if (activeAccount) {
9055
+ this.logger.trace("Legacy active account cache schema found");
9056
+ this.logger.trace("Adding active account filters cache schema");
9057
+ this.setActiveAccount(activeAccount);
9058
+ return activeAccount;
9059
+ }
8822
9060
  return null;
8823
9061
  }
8824
- return this.getAccountInfoByFilter({ localAccountId: activeAccountId })[0] || null;
9062
+ var activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);
9063
+ if (activeAccountValueObj) {
9064
+ this.logger.trace("Active account filters schema found");
9065
+ return this.getAccountInfoByFilter({
9066
+ homeAccountId: activeAccountValueObj.homeAccountId,
9067
+ localAccountId: activeAccountValueObj.localAccountId
9068
+ })[0] || null;
9069
+ }
9070
+ this.logger.trace("No active account found");
9071
+ return null;
8825
9072
  };
8826
9073
  /**
8827
9074
  * Sets the active account's localAccountId in cache
8828
9075
  * @param account
8829
9076
  */
8830
9077
  BrowserCacheManager.prototype.setActiveAccount = function (account) {
8831
- var activeAccountIdKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
9078
+ var activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
9079
+ var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
8832
9080
  if (account) {
8833
9081
  this.logger.verbose("setActiveAccount: Active account set");
8834
- this.browserStorage.setItem(activeAccountIdKey, account.localAccountId);
9082
+ var activeAccountValue = {
9083
+ homeAccountId: account.homeAccountId,
9084
+ localAccountId: account.localAccountId
9085
+ };
9086
+ this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));
9087
+ this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);
8835
9088
  }
8836
9089
  else {
8837
9090
  this.logger.verbose("setActiveAccount: No account passed, active account not set");
8838
- this.browserStorage.removeItem(activeAccountIdKey);
9091
+ this.browserStorage.removeItem(activeAccountKey);
9092
+ this.browserStorage.removeItem(activeAccountKeyLocal);
8839
9093
  }
8840
9094
  };
8841
9095
  /**
@@ -9021,7 +9275,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9021
9275
  * @param expires
9022
9276
  */
9023
9277
  BrowserCacheManager.prototype.setItemCookie = function (cookieName, cookieValue, expires) {
9024
- var cookieStr = encodeURIComponent(cookieName) + "=" + encodeURIComponent(cookieValue) + ";path=/;";
9278
+ var cookieStr = encodeURIComponent(cookieName) + "=" + encodeURIComponent(cookieValue) + ";path=/;SameSite=Lax;";
9025
9279
  if (expires) {
9026
9280
  var expireTime = this.getCookieExpirationTime(expires);
9027
9281
  cookieStr += "expires=" + expireTime + ";";
@@ -9393,7 +9647,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
9393
9647
 
9394
9648
  /* eslint-disable header/header */
9395
9649
  var name = "@azure/msal-browser";
9396
- var version = "2.26.0";
9650
+ var version = "2.28.1";
9397
9651
 
9398
9652
  /*
9399
9653
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10174,6 +10428,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10174
10428
  knownAuthorities: this.config.auth.knownAuthorities,
10175
10429
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
10176
10430
  authorityMetadata: this.config.auth.authorityMetadata,
10431
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache
10177
10432
  };
10178
10433
  userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
10179
10434
  builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
@@ -10564,6 +10819,7 @@ var NativeStatusCode;
10564
10819
  NativeStatusCode["TRANSIENT_ERROR"] = "TRANSIENT_ERROR";
10565
10820
  NativeStatusCode["PERSISTENT_ERROR"] = "PERSISTENT_ERROR";
10566
10821
  NativeStatusCode["DISABLED"] = "DISABLED";
10822
+ NativeStatusCode["ACCOUNT_UNAVAILABLE"] = "ACCOUNT_UNAVAILABLE";
10567
10823
  })(NativeStatusCode || (NativeStatusCode = {}));
10568
10824
  var NativeAuthErrorMessage = {
10569
10825
  extensionError: {
@@ -10572,6 +10828,10 @@ var NativeAuthErrorMessage = {
10572
10828
  userSwitch: {
10573
10829
  code: "user_switch",
10574
10830
  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."
10831
+ },
10832
+ tokensNotFoundInCache: {
10833
+ code: "tokens_not_found_in_internal_memory_cache",
10834
+ desc: "Tokens not cached in MSAL JS internal memory, please make the WAM request"
10575
10835
  }
10576
10836
  };
10577
10837
  var NativeAuthError = /** @class */ (function (_super) {
@@ -10607,6 +10867,8 @@ var NativeAuthError = /** @class */ (function (_super) {
10607
10867
  NativeAuthError.createError = function (code, description, ext) {
10608
10868
  if (ext && ext.status) {
10609
10869
  switch (ext.status) {
10870
+ case NativeStatusCode.ACCOUNT_UNAVAILABLE:
10871
+ return InteractionRequiredAuthError.createNativeAccountUnavailableError();
10610
10872
  case NativeStatusCode.USER_INTERACTION_REQUIRED:
10611
10873
  return new InteractionRequiredAuthError(code, description);
10612
10874
  case NativeStatusCode.USER_CANCEL:
@@ -10624,20 +10886,122 @@ var NativeAuthError = /** @class */ (function (_super) {
10624
10886
  NativeAuthError.createUserSwitchError = function () {
10625
10887
  return new NativeAuthError(NativeAuthErrorMessage.userSwitch.code, NativeAuthErrorMessage.userSwitch.desc);
10626
10888
  };
10889
+ /**
10890
+ * Creates a tokens not found error when the internal cache look up fails
10891
+ * @returns NativeAuthError: tokensNotFoundInCache
10892
+ */
10893
+ NativeAuthError.createTokensNotFoundInCacheError = function () {
10894
+ return new NativeAuthError(NativeAuthErrorMessage.tokensNotFoundInCache.code, NativeAuthErrorMessage.tokensNotFoundInCache.desc);
10895
+ };
10627
10896
  return NativeAuthError;
10628
10897
  }(AuthError));
10629
10898
 
10899
+ /*
10900
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10901
+ * Licensed under the MIT License.
10902
+ */
10903
+ var SilentCacheClient = /** @class */ (function (_super) {
10904
+ __extends$1(SilentCacheClient, _super);
10905
+ function SilentCacheClient() {
10906
+ return _super !== null && _super.apply(this, arguments) || this;
10907
+ }
10908
+ /**
10909
+ * Returns unexpired tokens from the cache, if available
10910
+ * @param silentRequest
10911
+ */
10912
+ SilentCacheClient.prototype.acquireToken = function (silentRequest) {
10913
+ return __awaiter$1(this, void 0, void 0, function () {
10914
+ var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
10915
+ return __generator$1(this, function (_a) {
10916
+ switch (_a.label) {
10917
+ case 0:
10918
+ acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
10919
+ serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
10920
+ return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
10921
+ case 1:
10922
+ silentAuthClient = _a.sent();
10923
+ this.logger.verbose("Silent auth client created");
10924
+ _a.label = 2;
10925
+ case 2:
10926
+ _a.trys.push([2, 4, , 5]);
10927
+ return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];
10928
+ case 3:
10929
+ cachedToken = _a.sent();
10930
+ acquireTokenMeasurement.endMeasurement({
10931
+ success: true,
10932
+ fromCache: true
10933
+ });
10934
+ return [2 /*return*/, cachedToken];
10935
+ case 4:
10936
+ error_1 = _a.sent();
10937
+ if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
10938
+ this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
10939
+ }
10940
+ acquireTokenMeasurement.endMeasurement({
10941
+ errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,
10942
+ subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,
10943
+ success: false
10944
+ });
10945
+ throw error_1;
10946
+ case 5: return [2 /*return*/];
10947
+ }
10948
+ });
10949
+ });
10950
+ };
10951
+ /**
10952
+ * Currently Unsupported
10953
+ */
10954
+ SilentCacheClient.prototype.logout = function () {
10955
+ // Synchronous so we must reject
10956
+ return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
10957
+ };
10958
+ /**
10959
+ * Creates an Silent Flow Client with the given authority, or the default authority.
10960
+ * @param serverTelemetryManager
10961
+ * @param authorityUrl
10962
+ */
10963
+ SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
10964
+ return __awaiter$1(this, void 0, void 0, function () {
10965
+ var clientConfig;
10966
+ return __generator$1(this, function (_a) {
10967
+ switch (_a.label) {
10968
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
10969
+ case 1:
10970
+ clientConfig = _a.sent();
10971
+ return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];
10972
+ }
10973
+ });
10974
+ });
10975
+ };
10976
+ SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
10977
+ return __awaiter$1(this, void 0, void 0, function () {
10978
+ var _a;
10979
+ return __generator$1(this, function (_b) {
10980
+ switch (_b.label) {
10981
+ case 0:
10982
+ _a = [__assign$1({}, request)];
10983
+ return [4 /*yield*/, this.initializeBaseRequest(request)];
10984
+ 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 }])];
10985
+ }
10986
+ });
10987
+ });
10988
+ };
10989
+ return SilentCacheClient;
10990
+ }(StandardInteractionClient));
10991
+
10630
10992
  /*
10631
10993
  * Copyright (c) Microsoft Corporation. All rights reserved.
10632
10994
  * Licensed under the MIT License.
10633
10995
  */
10634
10996
  var NativeInteractionClient = /** @class */ (function (_super) {
10635
10997
  __extends$1(NativeInteractionClient, _super);
10636
- function NativeInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, correlationId) {
10998
+ function NativeInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
10637
10999
  var _this = _super.call(this, config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId) || this;
10638
11000
  _this.apiId = apiId;
10639
11001
  _this.accountId = accountId;
10640
11002
  _this.nativeMessageHandler = provider;
11003
+ _this.nativeStorageManager = nativeStorageImpl;
11004
+ _this.silentCacheClient = new SilentCacheClient(config, _this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
10641
11005
  return _this;
10642
11006
  }
10643
11007
  /**
@@ -10646,22 +11010,40 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10646
11010
  */
10647
11011
  NativeInteractionClient.prototype.acquireToken = function (request) {
10648
11012
  return __awaiter$1(this, void 0, void 0, function () {
10649
- var nativeATMeasurement, nativeRequest, messageBody, reqTimestamp, response, validatedResponse;
11013
+ var nativeATMeasurement, reqTimestamp, nativeRequest, result, messageBody, response, validatedResponse;
10650
11014
  return __generator$1(this, function (_a) {
10651
11015
  switch (_a.label) {
10652
11016
  case 0:
10653
11017
  this.logger.trace("NativeInteractionClient - acquireToken called.");
10654
11018
  nativeATMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
11019
+ reqTimestamp = TimeUtils.nowSeconds();
10655
11020
  return [4 /*yield*/, this.initializeNativeRequest(request)];
10656
11021
  case 1:
10657
11022
  nativeRequest = _a.sent();
11023
+ _a.label = 2;
11024
+ case 2:
11025
+ _a.trys.push([2, 4, , 5]);
11026
+ return [4 /*yield*/, this.acquireTokensFromCache(this.accountId, nativeRequest)];
11027
+ case 3:
11028
+ result = _a.sent();
11029
+ nativeATMeasurement.endMeasurement({
11030
+ success: true,
11031
+ isNativeBroker: true,
11032
+ fromCache: true
11033
+ });
11034
+ return [2 /*return*/, result];
11035
+ case 4:
11036
+ _a.sent();
11037
+ // continue with a native call for any and all errors
11038
+ this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
11039
+ return [3 /*break*/, 5];
11040
+ case 5:
10658
11041
  messageBody = {
10659
11042
  method: NativeExtensionMethod.GetToken,
10660
11043
  request: nativeRequest
10661
11044
  };
10662
- reqTimestamp = TimeUtils.nowSeconds();
10663
11045
  return [4 /*yield*/, this.nativeMessageHandler.sendMessage(messageBody)];
10664
- case 2:
11046
+ case 6:
10665
11047
  response = _a.sent();
10666
11048
  validatedResponse = this.validateNativeResponse(response);
10667
11049
  return [2 /*return*/, this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)
@@ -10685,13 +11067,61 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10685
11067
  });
10686
11068
  });
10687
11069
  };
11070
+ /**
11071
+ * Creates silent flow request
11072
+ * @param request
11073
+ * @param cachedAccount
11074
+ * @returns CommonSilentFlowRequest
11075
+ */
11076
+ NativeInteractionClient.prototype.createSilentCacheRequest = function (request, cachedAccount) {
11077
+ return {
11078
+ authority: request.authority,
11079
+ correlationId: this.correlationId,
11080
+ scopes: ScopeSet.fromString(request.scope).asArray(),
11081
+ account: cachedAccount,
11082
+ forceRefresh: false,
11083
+ };
11084
+ };
11085
+ /**
11086
+ * Fetches the tokens from the cache if un-expired
11087
+ * @param nativeAccountId
11088
+ * @param request
11089
+ * @returns authenticationResult
11090
+ */
11091
+ NativeInteractionClient.prototype.acquireTokensFromCache = function (nativeAccountId, request) {
11092
+ return __awaiter$1(this, void 0, void 0, function () {
11093
+ var accountEntity, account, silentRequest, result, e_2;
11094
+ return __generator$1(this, function (_a) {
11095
+ switch (_a.label) {
11096
+ case 0:
11097
+ accountEntity = this.browserStorage.readAccountFromCacheWithNativeAccountId(nativeAccountId);
11098
+ if (!accountEntity) {
11099
+ throw ClientAuthError.createNoAccountFoundError();
11100
+ }
11101
+ account = accountEntity.getAccountInfo();
11102
+ _a.label = 1;
11103
+ case 1:
11104
+ _a.trys.push([1, 3, , 4]);
11105
+ silentRequest = this.createSilentCacheRequest(request, account);
11106
+ return [4 /*yield*/, this.silentCacheClient.acquireToken(silentRequest)];
11107
+ case 2:
11108
+ result = _a.sent();
11109
+ return [2 /*return*/, result];
11110
+ case 3:
11111
+ e_2 = _a.sent();
11112
+ throw e_2;
11113
+ case 4: return [2 /*return*/];
11114
+ }
11115
+ });
11116
+ });
11117
+ };
10688
11118
  /**
10689
11119
  * Acquires a token from native platform then redirects to the redirectUri instead of returning the response
10690
11120
  * @param request
10691
11121
  */
10692
11122
  NativeInteractionClient.prototype.acquireTokenRedirect = function (request) {
10693
11123
  return __awaiter$1(this, void 0, void 0, function () {
10694
- var nativeRequest, messageBody, response, e_1, navigationOptions, redirectUri;
11124
+ var nativeRequest, messageBody, response, e_3, navigationOptions, redirectUri;
10695
11125
  return __generator$1(this, function (_a) {
10696
11126
  switch (_a.label) {
10697
11127
  case 0:
@@ -10712,10 +11142,10 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10712
11142
  this.validateNativeResponse(response);
10713
11143
  return [3 /*break*/, 5];
10714
11144
  case 4:
10715
- e_1 = _a.sent();
11145
+ e_3 = _a.sent();
10716
11146
  // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
10717
- if (e_1 instanceof NativeAuthError && e_1.isFatal()) {
10718
- throw e_1;
11147
+ if (e_3 instanceof NativeAuthError && e_3.isFatal()) {
11148
+ throw e_3;
10719
11149
  }
10720
11150
  return [3 /*break*/, 5];
10721
11151
  case 5:
@@ -10739,7 +11169,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10739
11169
  */
10740
11170
  NativeInteractionClient.prototype.handleRedirectPromise = function () {
10741
11171
  return __awaiter$1(this, void 0, void 0, function () {
10742
- var cachedRequest, messageBody, reqTimestamp, response, result, e_2;
11172
+ var cachedRequest, messageBody, reqTimestamp, response, result, e_4;
10743
11173
  return __generator$1(this, function (_a) {
10744
11174
  switch (_a.label) {
10745
11175
  case 0:
@@ -10771,9 +11201,9 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10771
11201
  this.browserStorage.setInteractionInProgress(false);
10772
11202
  return [2 /*return*/, result];
10773
11203
  case 3:
10774
- e_2 = _a.sent();
11204
+ e_4 = _a.sent();
10775
11205
  this.browserStorage.setInteractionInProgress(false);
10776
- throw e_2;
11206
+ throw e_4;
10777
11207
  case 4: return [2 /*return*/];
10778
11208
  }
10779
11209
  });
@@ -10795,7 +11225,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10795
11225
  */
10796
11226
  NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {
10797
11227
  return __awaiter$1(this, void 0, void 0, function () {
10798
- var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result;
11228
+ var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result, idTokenEntity, expiresIn, tokenExpirationSeconds, accessTokenEntity;
10799
11229
  var _this = this;
10800
11230
  return __generator$1(this, function (_b) {
10801
11231
  switch (_b.label) {
@@ -10813,7 +11243,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10813
11243
  homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
10814
11244
  accountEntity = AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authorityPreferredCache, response.account.id);
10815
11245
  this.browserStorage.setAccount(accountEntity);
10816
- responseScopes = response.scopes ? ScopeSet.fromString(response.scopes) : ScopeSet.fromString(request.scopes);
11246
+ responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);
10817
11247
  accountProperties = response.account.properties || {};
10818
11248
  uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
10819
11249
  tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
@@ -10873,7 +11303,17 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10873
11303
  state: response.state,
10874
11304
  fromNativeBroker: true
10875
11305
  };
10876
- // Remove any existing cached tokens for this account
11306
+ idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
11307
+ this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
11308
+ expiresIn = (responseTokenType === exports.AuthenticationScheme.POP)
11309
+ ? Constants.SHR_NONCE_VALIDITY
11310
+ : (typeof response.expires_in === "string"
11311
+ ? parseInt(response.expires_in, 10)
11312
+ : response.expires_in) || 0;
11313
+ tokenExpirationSeconds = reqTimestamp + expiresIn;
11314
+ accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tid, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
11315
+ this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
11316
+ // Remove any existing cached tokens for this account in browser storage
10877
11317
  this.browserStorage.removeAccountContext(accountEntity).catch(function (e) {
10878
11318
  _this.logger.error("Error occurred while removing account context from browser storage. " + e);
10879
11319
  });
@@ -10891,7 +11331,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10891
11331
  response.hasOwnProperty("id_token") &&
10892
11332
  response.hasOwnProperty("client_info") &&
10893
11333
  response.hasOwnProperty("account") &&
10894
- response.hasOwnProperty("scopes") &&
11334
+ response.hasOwnProperty("scope") &&
10895
11335
  response.hasOwnProperty("expires_in")) {
10896
11336
  return response;
10897
11337
  }
@@ -10933,7 +11373,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10933
11373
  */
10934
11374
  NativeInteractionClient.prototype.initializeNativeRequest = function (request) {
10935
11375
  return __awaiter$1(this, void 0, void 0, function () {
10936
- var authority, canonicalAuthority, scopes, scopeSet, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11376
+ var authority, canonicalAuthority, scopes, remainingProperties, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11377
+ var _this = this;
10937
11378
  return __generator$1(this, function (_a) {
10938
11379
  switch (_a.label) {
10939
11380
  case 0:
@@ -10941,21 +11382,35 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10941
11382
  authority = request.authority || this.config.auth.authority;
10942
11383
  canonicalAuthority = new UrlString(authority);
10943
11384
  canonicalAuthority.validateAsUri();
10944
- scopes = request && request.scopes || [];
10945
- scopeSet = new ScopeSet(scopes);
11385
+ scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
11386
+ scopeSet = new ScopeSet(scopes || []);
10946
11387
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
10947
- if (request.prompt) {
11388
+ getPrompt = function () {
11389
+ // If request is silent, prompt is always none
11390
+ switch (_this.apiId) {
11391
+ case exports.ApiId.ssoSilent:
11392
+ case exports.ApiId.acquireTokenSilent_silentFlow:
11393
+ _this.logger.trace("initializeNativeRequest: silent request sets prompt to none");
11394
+ return PromptValue.NONE;
11395
+ }
11396
+ // Prompt not provided, request may proceed and native broker decides if it needs to prompt
11397
+ if (!request.prompt) {
11398
+ _this.logger.trace("initializeNativeRequest: prompt was not provided");
11399
+ return undefined;
11400
+ }
11401
+ // If request is interactive, check if prompt provided is allowed to go directly to native broker
10948
11402
  switch (request.prompt) {
10949
11403
  case PromptValue.NONE:
10950
11404
  case PromptValue.CONSENT:
10951
- this.logger.trace("initializeNativeRequest: prompt is compatible with native flow");
10952
- break;
11405
+ case PromptValue.LOGIN:
11406
+ _this.logger.trace("initializeNativeRequest: prompt is compatible with native flow");
11407
+ return request.prompt;
10953
11408
  default:
10954
- this.logger.trace("initializeNativeRequest: prompt = " + request.prompt + " is not compatible with native flow");
11409
+ _this.logger.trace("initializeNativeRequest: prompt = " + request.prompt + " is not compatible with native flow");
10955
11410
  throw BrowserAuthError.createNativePromptParameterNotSupportedError();
10956
11411
  }
10957
- }
10958
- 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), 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?
11412
+ };
11413
+ 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?
10959
11414
  });
10960
11415
  if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
10961
11416
  shrParameters = {
@@ -10972,11 +11427,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
10972
11427
  validatedRequest.reqCnf = reqCnfData.reqCnfHash;
10973
11428
  validatedRequest.keyId = reqCnfData.kid;
10974
11429
  _a.label = 2;
10975
- case 2:
10976
- if (this.apiId === exports.ApiId.ssoSilent || this.apiId === exports.ApiId.acquireTokenSilent_silentFlow) {
10977
- validatedRequest.prompt = PromptValue.NONE;
10978
- }
10979
- return [2 /*return*/, validatedRequest];
11430
+ case 2: return [2 /*return*/, validatedRequest];
10980
11431
  }
10981
11432
  });
10982
11433
  });
@@ -11226,8 +11677,10 @@ var NativeMessageHandler = /** @class */ (function () {
11226
11677
  */
11227
11678
  var RedirectClient = /** @class */ (function (_super) {
11228
11679
  __extends$1(RedirectClient, _super);
11229
- function RedirectClient() {
11230
- return _super !== null && _super.apply(this, arguments) || this;
11680
+ function RedirectClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
11681
+ var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
11682
+ _this.nativeStorage = nativeStorageImpl;
11683
+ return _this;
11231
11684
  }
11232
11685
  /**
11233
11686
  * Redirects the page to the /authorize endpoint of the IDP
@@ -11436,7 +11889,7 @@ var RedirectClient = /** @class */ (function (_super) {
11436
11889
  if (!this.nativeMessageHandler) {
11437
11890
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
11438
11891
  }
11439
- 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);
11892
+ 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);
11440
11893
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
11441
11894
  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
11442
11895
  })).finally(function () {
@@ -11554,10 +12007,11 @@ var RedirectClient = /** @class */ (function (_super) {
11554
12007
  */
11555
12008
  var PopupClient = /** @class */ (function (_super) {
11556
12009
  __extends$1(PopupClient, _super);
11557
- function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {
12010
+ function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
11558
12011
  var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
11559
12012
  // Properly sets this reference for the unload event.
11560
12013
  _this.unloadWindow = _this.unloadWindow.bind(_this);
12014
+ _this.nativeStorage = nativeStorageImpl;
11561
12015
  return _this;
11562
12016
  }
11563
12017
  /**
@@ -11682,7 +12136,7 @@ var PopupClient = /** @class */ (function (_super) {
11682
12136
  if (!this.nativeMessageHandler) {
11683
12137
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
11684
12138
  }
11685
- 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);
12139
+ 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);
11686
12140
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state_1).userRequestState;
11687
12141
  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
11688
12142
  })).finally(function () {
@@ -12118,6 +12572,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
12118
12572
  azureCloudInstance: exports.AzureCloudInstance.None,
12119
12573
  tenant: Constants.EMPTY_STRING
12120
12574
  },
12575
+ skipAuthorityMetadataCache: false,
12121
12576
  };
12122
12577
  // Default cache options for browser
12123
12578
  var DEFAULT_CACHE_OPTIONS = {
@@ -12309,9 +12764,10 @@ var SilentHandler = /** @class */ (function (_super) {
12309
12764
  */
12310
12765
  var SilentIframeClient = /** @class */ (function (_super) {
12311
12766
  __extends$1(SilentIframeClient, _super);
12312
- function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {
12767
+ function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
12313
12768
  var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
12314
12769
  _this.apiId = apiId;
12770
+ _this.nativeStorage = nativeStorageImpl;
12315
12771
  return _this;
12316
12772
  }
12317
12773
  /**
@@ -12414,7 +12870,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12414
12870
  if (!this.nativeMessageHandler) {
12415
12871
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
12416
12872
  }
12417
- 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);
12873
+ 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);
12418
12874
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
12419
12875
  return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, silentRequest), { state: userRequestState, prompt: PromptValue.NONE })).finally(function () {
12420
12876
  _this.browserStorage.cleanRequestByState(state);
@@ -12429,99 +12885,6 @@ var SilentIframeClient = /** @class */ (function (_super) {
12429
12885
  return SilentIframeClient;
12430
12886
  }(StandardInteractionClient));
12431
12887
 
12432
- /*
12433
- * Copyright (c) Microsoft Corporation. All rights reserved.
12434
- * Licensed under the MIT License.
12435
- */
12436
- var SilentCacheClient = /** @class */ (function (_super) {
12437
- __extends$1(SilentCacheClient, _super);
12438
- function SilentCacheClient() {
12439
- return _super !== null && _super.apply(this, arguments) || this;
12440
- }
12441
- /**
12442
- * Returns unexpired tokens from the cache, if available
12443
- * @param silentRequest
12444
- */
12445
- SilentCacheClient.prototype.acquireToken = function (silentRequest) {
12446
- return __awaiter$1(this, void 0, void 0, function () {
12447
- var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
12448
- return __generator$1(this, function (_a) {
12449
- switch (_a.label) {
12450
- case 0:
12451
- acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
12452
- serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12453
- return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12454
- case 1:
12455
- silentAuthClient = _a.sent();
12456
- this.logger.verbose("Silent auth client created");
12457
- _a.label = 2;
12458
- case 2:
12459
- _a.trys.push([2, 4, , 5]);
12460
- return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];
12461
- case 3:
12462
- cachedToken = _a.sent();
12463
- acquireTokenMeasurement.endMeasurement({
12464
- success: true,
12465
- fromCache: true
12466
- });
12467
- return [2 /*return*/, cachedToken];
12468
- case 4:
12469
- error_1 = _a.sent();
12470
- if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
12471
- this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
12472
- }
12473
- acquireTokenMeasurement.endMeasurement({
12474
- errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,
12475
- subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,
12476
- success: false
12477
- });
12478
- throw error_1;
12479
- case 5: return [2 /*return*/];
12480
- }
12481
- });
12482
- });
12483
- };
12484
- /**
12485
- * Currently Unsupported
12486
- */
12487
- SilentCacheClient.prototype.logout = function () {
12488
- // Synchronous so we must reject
12489
- return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
12490
- };
12491
- /**
12492
- * Creates an Silent Flow Client with the given authority, or the default authority.
12493
- * @param serverTelemetryManager
12494
- * @param authorityUrl
12495
- */
12496
- SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
12497
- return __awaiter$1(this, void 0, void 0, function () {
12498
- var clientConfig;
12499
- return __generator$1(this, function (_a) {
12500
- switch (_a.label) {
12501
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12502
- case 1:
12503
- clientConfig = _a.sent();
12504
- return [2 /*return*/, new SilentFlowClient(clientConfig)];
12505
- }
12506
- });
12507
- });
12508
- };
12509
- SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
12510
- return __awaiter$1(this, void 0, void 0, function () {
12511
- var _a;
12512
- return __generator$1(this, function (_b) {
12513
- switch (_b.label) {
12514
- case 0:
12515
- _a = [__assign$1({}, request)];
12516
- return [4 /*yield*/, this.initializeBaseRequest(request)];
12517
- 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 }])];
12518
- }
12519
- });
12520
- });
12521
- };
12522
- return SilentCacheClient;
12523
- }(StandardInteractionClient));
12524
-
12525
12888
  /*
12526
12889
  * Copyright (c) Microsoft Corporation. All rights reserved.
12527
12890
  * Licensed under the MIT License.
@@ -12597,7 +12960,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12597
12960
  case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12598
12961
  case 1:
12599
12962
  clientConfig = _a.sent();
12600
- return [2 /*return*/, new RefreshTokenClient(clientConfig)];
12963
+ return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];
12601
12964
  }
12602
12965
  });
12603
12966
  });
@@ -14212,6 +14575,7 @@ var TokenCache = /** @class */ (function () {
14212
14575
  knownAuthorities: this.config.auth.knownAuthorities,
14213
14576
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
14214
14577
  authorityMetadata: this.config.auth.authorityMetadata,
14578
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
14215
14579
  };
14216
14580
  var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
14217
14581
  // "clientInfo" from options takes precedence over "clientInfo" in response
@@ -14538,6 +14902,13 @@ var ClientApplication = /** @class */ (function () {
14538
14902
  this.browserStorage = this.isBrowserEnvironment ?
14539
14903
  new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :
14540
14904
  DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
14905
+ // initialize in memory storage for native flows
14906
+ var nativeCacheOptions = {
14907
+ cacheLocation: exports.BrowserCacheLocation.MemoryStorage,
14908
+ storeAuthStateInCookie: false,
14909
+ secureCookies: false
14910
+ };
14911
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
14541
14912
  // Initialize the token cache
14542
14913
  this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
14543
14914
  }
@@ -14604,7 +14975,7 @@ var ClientApplication = /** @class */ (function () {
14604
14975
  redirectResponse = void 0;
14605
14976
  if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {
14606
14977
  this.logger.trace("handleRedirectPromise - acquiring token from native platform");
14607
- 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);
14978
+ 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);
14608
14979
  redirectResponse = nativeClient.handleRedirectPromise();
14609
14980
  }
14610
14981
  else {
@@ -14676,13 +15047,19 @@ var ClientApplication = /** @class */ (function () {
14676
15047
  this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Redirect, request);
14677
15048
  }
14678
15049
  if (this.nativeExtensionProvider && this.canUseNative(request)) {
14679
- 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);
15050
+ 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);
14680
15051
  result = nativeClient.acquireTokenRedirect(request).catch(function (e) {
14681
15052
  if (e instanceof NativeAuthError && e.isFatal()) {
14682
15053
  _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
14683
15054
  var redirectClient = _this.createRedirectClient(request.correlationId);
14684
15055
  return redirectClient.acquireToken(request);
14685
15056
  }
15057
+ else if (e instanceof InteractionRequiredAuthError) {
15058
+ _this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
15059
+ var redirectClient = _this.createRedirectClient(request.correlationId);
15060
+ return redirectClient.acquireToken(request);
15061
+ }
15062
+ _this.browserStorage.setInteractionInProgress(false);
14686
15063
  throw e;
14687
15064
  });
14688
15065
  }
@@ -14738,7 +15115,9 @@ var ClientApplication = /** @class */ (function () {
14738
15115
  _this.browserStorage.setInteractionInProgress(false);
14739
15116
  atPopupMeasurement.endMeasurement({
14740
15117
  success: true,
14741
- isNativeBroker: true
15118
+ isNativeBroker: true,
15119
+ accessTokenSize: response.accessToken.length,
15120
+ idTokenSize: response.idToken.length,
14742
15121
  });
14743
15122
  atPopupMeasurement.flushMeasurement();
14744
15123
  return response;
@@ -14748,6 +15127,12 @@ var ClientApplication = /** @class */ (function () {
14748
15127
  var popupClient = _this.createPopupClient(request.correlationId);
14749
15128
  return popupClient.acquireToken(request);
14750
15129
  }
15130
+ else if (e instanceof InteractionRequiredAuthError) {
15131
+ _this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
15132
+ var popupClient = _this.createPopupClient(request.correlationId);
15133
+ return popupClient.acquireToken(request);
15134
+ }
15135
+ _this.browserStorage.setInteractionInProgress(false);
14751
15136
  throw e;
14752
15137
  });
14753
15138
  }
@@ -14756,7 +15141,9 @@ var ClientApplication = /** @class */ (function () {
14756
15141
  result = popupClient.acquireToken(request);
14757
15142
  }
14758
15143
  return result.then(function (result) {
14759
- // If logged in, emit acquire token events
15144
+ /*
15145
+ * If logged in, emit acquire token events
15146
+ */
14760
15147
  var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
14761
15148
  if (isLoggingIn) {
14762
15149
  _this.eventHandler.emitEvent(exports.EventType.LOGIN_SUCCESS, exports.InteractionType.Popup, result);
@@ -14765,7 +15152,9 @@ var ClientApplication = /** @class */ (function () {
14765
15152
  _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
14766
15153
  }
14767
15154
  atPopupMeasurement.endMeasurement({
14768
- success: true
15155
+ success: true,
15156
+ accessTokenSize: result.accessToken.length,
15157
+ idTokenSize: result.idToken.length,
14769
15158
  });
14770
15159
  atPopupMeasurement.flushMeasurement();
14771
15160
  return result;
@@ -14833,7 +15222,9 @@ var ClientApplication = /** @class */ (function () {
14833
15222
  _this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
14834
15223
  ssoSilentMeasurement.endMeasurement({
14835
15224
  success: true,
14836
- isNativeBroker: response.fromNativeBroker
15225
+ isNativeBroker: response.fromNativeBroker,
15226
+ accessTokenSize: response.accessToken.length,
15227
+ idTokenSize: response.idToken.length
14837
15228
  });
14838
15229
  ssoSilentMeasurement.flushMeasurement();
14839
15230
  return response;
@@ -14882,6 +15273,8 @@ var ClientApplication = /** @class */ (function () {
14882
15273
  _this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
14883
15274
  atbcMeasurement.endMeasurement({
14884
15275
  success: true,
15276
+ accessTokenSize: result.accessToken.length,
15277
+ idTokenSize: result.idToken.length,
14885
15278
  isNativeBroker: result.fromNativeBroker
14886
15279
  });
14887
15280
  atbcMeasurement.flushMeasurement();
@@ -14986,7 +15379,9 @@ var ClientApplication = /** @class */ (function () {
14986
15379
  .then(function (result) {
14987
15380
  atbrtMeasurement.endMeasurement({
14988
15381
  success: true,
14989
- fromCache: result.fromCache
15382
+ fromCache: result.fromCache,
15383
+ accessTokenSize: result.accessToken.length,
15384
+ idTokenSize: result.idToken.length,
14990
15385
  });
14991
15386
  return result;
14992
15387
  })
@@ -15001,7 +15396,9 @@ var ClientApplication = /** @class */ (function () {
15001
15396
  .then(function (result) {
15002
15397
  atbrtMeasurement.endMeasurement({
15003
15398
  success: true,
15004
- fromCache: result.fromCache
15399
+ fromCache: result.fromCache,
15400
+ accessTokenSize: result.accessToken.length,
15401
+ idTokenSize: result.idToken.length,
15005
15402
  });
15006
15403
  return result;
15007
15404
  })
@@ -15213,7 +15610,7 @@ var ClientApplication = /** @class */ (function () {
15213
15610
  if (!this.nativeExtensionProvider) {
15214
15611
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
15215
15612
  }
15216
- 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);
15613
+ 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);
15217
15614
  return [2 /*return*/, nativeClient.acquireToken(request)];
15218
15615
  });
15219
15616
  });
@@ -15232,6 +15629,7 @@ var ClientApplication = /** @class */ (function () {
15232
15629
  switch (request.prompt) {
15233
15630
  case PromptValue.NONE:
15234
15631
  case PromptValue.CONSENT:
15632
+ case PromptValue.LOGIN:
15235
15633
  this.logger.trace("canUseNative: prompt is compatible with native flow");
15236
15634
  break;
15237
15635
  default:
@@ -15259,21 +15657,21 @@ var ClientApplication = /** @class */ (function () {
15259
15657
  * @param correlationId
15260
15658
  */
15261
15659
  ClientApplication.prototype.createPopupClient = function (correlationId) {
15262
- return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
15660
+ return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
15263
15661
  };
15264
15662
  /**
15265
- * Returns new instance of the Popup Interaction Client
15663
+ * Returns new instance of the Redirect Interaction Client
15266
15664
  * @param correlationId
15267
15665
  */
15268
15666
  ClientApplication.prototype.createRedirectClient = function (correlationId) {
15269
- return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
15667
+ return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
15270
15668
  };
15271
15669
  /**
15272
15670
  * Returns new instance of the Silent Iframe Interaction Client
15273
15671
  * @param correlationId
15274
15672
  */
15275
15673
  ClientApplication.prototype.createSilentIframeClient = function (correlationId) {
15276
- return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent, this.performanceClient, this.nativeExtensionProvider, correlationId);
15674
+ 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);
15277
15675
  };
15278
15676
  /**
15279
15677
  * Returns new instance of the Silent Cache Interaction Client
@@ -15509,6 +15907,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
15509
15907
  atsMeasurement.endMeasurement({
15510
15908
  success: true,
15511
15909
  fromCache: result.fromCache,
15910
+ accessTokenSize: result.accessToken.length,
15911
+ idTokenSize: result.idToken.length,
15512
15912
  isNativeBroker: result.fromNativeBroker
15513
15913
  });
15514
15914
  atsMeasurement.flushMeasurement();
@@ -15517,8 +15917,6 @@ var PublicClientApplication = /** @class */ (function (_super) {
15517
15917
  .catch(function (error) {
15518
15918
  _this.activeSilentTokenRequests.delete(silentRequestKey);
15519
15919
  atsMeasurement.endMeasurement({
15520
- errorCode: error.errorCode,
15521
- subErrorCode: error.subError,
15522
15920
  success: false
15523
15921
  });
15524
15922
  atsMeasurement.flushMeasurement();
@@ -15588,6 +15986,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
15588
15986
  astsAsyncMeasurement.endMeasurement({
15589
15987
  success: true,
15590
15988
  fromCache: response.fromCache,
15989
+ accessTokenSize: response.accessToken.length,
15990
+ idTokenSize: response.idToken.length,
15591
15991
  isNativeBroker: response.fromNativeBroker
15592
15992
  });
15593
15993
  return response;