@azure/msal-browser 2.28.0 → 2.28.3

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 (86) 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.js +1 -1
  5. package/dist/app/IPublicClientApplication.js +1 -1
  6. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  7. package/dist/app/PublicClientApplication.js +3 -1
  8. package/dist/app/PublicClientApplication.js.map +1 -1
  9. package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
  10. package/dist/broker/nativeBroker/NativeRequest.d.ts +1 -1
  11. package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
  12. package/dist/broker/nativeBroker/NativeResponse.d.ts +1 -1
  13. package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -1
  14. package/dist/cache/AsyncMemoryStorage.d.ts +7 -2
  15. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
  16. package/dist/cache/AsyncMemoryStorage.js +19 -15
  17. package/dist/cache/AsyncMemoryStorage.js.map +1 -1
  18. package/dist/cache/BrowserCacheManager.js +1 -1
  19. package/dist/cache/BrowserStorage.js +1 -1
  20. package/dist/cache/CryptoKeyStore.d.ts +18 -0
  21. package/dist/cache/CryptoKeyStore.d.ts.map +1 -0
  22. package/dist/cache/CryptoKeyStore.js +58 -0
  23. package/dist/cache/CryptoKeyStore.js.map +1 -0
  24. package/dist/cache/DatabaseStorage.d.ts.map +1 -1
  25. package/dist/cache/DatabaseStorage.js +10 -22
  26. package/dist/cache/DatabaseStorage.js.map +1 -1
  27. package/dist/cache/MemoryStorage.js +1 -1
  28. package/dist/cache/TokenCache.js +1 -1
  29. package/dist/config/Configuration.js +1 -1
  30. package/dist/crypto/BrowserCrypto.js +1 -1
  31. package/dist/crypto/CryptoOps.d.ts +0 -12
  32. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  33. package/dist/crypto/CryptoOps.js +6 -36
  34. package/dist/crypto/CryptoOps.js.map +1 -1
  35. package/dist/crypto/GuidGenerator.js +1 -1
  36. package/dist/crypto/PkceGenerator.js +1 -1
  37. package/dist/crypto/SignedHttpRequest.js +1 -1
  38. package/dist/encode/Base64Decode.js +1 -1
  39. package/dist/encode/Base64Encode.js +1 -1
  40. package/dist/error/BrowserAuthError.js +1 -1
  41. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  42. package/dist/error/NativeAuthError.js +1 -1
  43. package/dist/event/EventHandler.js +1 -1
  44. package/dist/event/EventMessage.js +1 -1
  45. package/dist/event/EventType.js +1 -1
  46. package/dist/index.cjs.js +396 -274
  47. package/dist/index.cjs.js.map +1 -1
  48. package/dist/index.js +1 -1
  49. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  50. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  51. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  52. package/dist/interaction_client/NativeInteractionClient.js +9 -9
  53. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  54. package/dist/interaction_client/PopupClient.js +1 -1
  55. package/dist/interaction_client/RedirectClient.js +1 -1
  56. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  57. package/dist/interaction_client/SilentCacheClient.js +2 -2
  58. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  59. package/dist/interaction_client/SilentIframeClient.js +1 -1
  60. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  61. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  62. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  63. package/dist/interaction_handler/InteractionHandler.js +1 -1
  64. package/dist/interaction_handler/RedirectHandler.js +1 -1
  65. package/dist/interaction_handler/SilentHandler.js +1 -1
  66. package/dist/internals.js +1 -1
  67. package/dist/navigation/NavigationClient.js +1 -1
  68. package/dist/network/FetchClient.js +1 -1
  69. package/dist/network/XhrClient.js +1 -1
  70. package/dist/packageMetadata.d.ts +1 -1
  71. package/dist/packageMetadata.js +2 -2
  72. package/dist/packageMetadata.js.map +1 -1
  73. package/dist/request/PopupRequest.d.ts +1 -1
  74. package/dist/request/RedirectRequest.d.ts +1 -1
  75. package/dist/request/SsoSilentRequest.d.ts +1 -1
  76. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  77. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  78. package/dist/utils/BrowserConstants.js +1 -1
  79. package/dist/utils/BrowserProtocolUtils.js +1 -1
  80. package/dist/utils/BrowserStringUtils.js +1 -1
  81. package/dist/utils/BrowserUtils.js +1 -1
  82. package/dist/utils/MathUtils.js +1 -1
  83. package/lib/msal-browser.js +396 -274
  84. package/lib/msal-browser.js.map +1 -1
  85. package/lib/msal-browser.min.js +42 -42
  86. package/package.json +3 -4
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.28.0 2022-07-18 */
1
+ /*! @azure/msal-browser v2.28.3 2022-09-12 */
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.2.0 2022-07-18 */
120
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
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.2.0 2022-07-18 */
207
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
196
208
 
197
209
  /*
198
210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -243,7 +255,7 @@ var Constants = {
243
255
  KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
244
256
  TOKEN_RESPONSE_TYPE: "token",
245
257
  ID_TOKEN_RESPONSE_TYPE: "id_token",
246
- SHR_NONCE_VALIDITY: 240,
258
+ SHR_NONCE_VALIDITY: 240
247
259
  };
248
260
  var OIDC_DEFAULT_SCOPES = [
249
261
  Constants.OPENID_SCOPE,
@@ -569,7 +581,7 @@ var JsonTypes;
569
581
  JsonTypes["Jwk"] = "JWK";
570
582
  })(JsonTypes || (JsonTypes = {}));
571
583
 
572
- /*! @azure/msal-common v7.2.0 2022-07-18 */
584
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
573
585
 
574
586
  /*
575
587
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -582,6 +594,10 @@ var AuthErrorMessage = {
582
594
  unexpectedError: {
583
595
  code: "unexpected_error",
584
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."
585
601
  }
586
602
  };
587
603
  /**
@@ -610,10 +626,18 @@ var AuthError = /** @class */ (function (_super) {
610
626
  AuthError.createUnexpectedError = function (errDesc) {
611
627
  return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + ": " + errDesc);
612
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
+ };
613
637
  return AuthError;
614
638
  }(Error));
615
639
 
616
- /*! @azure/msal-common v7.2.0 2022-07-18 */
640
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
617
641
 
618
642
  /*
619
643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -688,7 +712,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
688
712
  }
689
713
  };
690
714
 
691
- /*! @azure/msal-common v7.2.0 2022-07-18 */
715
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
692
716
 
693
717
  /*
694
718
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1160,7 +1184,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1160
1184
  return ClientAuthError;
1161
1185
  }(AuthError));
1162
1186
 
1163
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1187
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1164
1188
 
1165
1189
  /*
1166
1190
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1285,7 +1309,7 @@ var StringUtils = /** @class */ (function () {
1285
1309
  return StringUtils;
1286
1310
  }());
1287
1311
 
1288
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1312
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1289
1313
 
1290
1314
  /*
1291
1315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1465,12 +1489,12 @@ var Logger = /** @class */ (function () {
1465
1489
  return Logger;
1466
1490
  }());
1467
1491
 
1468
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1492
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1469
1493
  /* eslint-disable header/header */
1470
1494
  var name$1 = "@azure/msal-common";
1471
- var version$1 = "7.2.0";
1495
+ var version$1 = "7.4.1";
1472
1496
 
1473
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1497
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1474
1498
  /*
1475
1499
  * Copyright (c) Microsoft Corporation. All rights reserved.
1476
1500
  * Licensed under the MIT License.
@@ -1491,7 +1515,7 @@ exports.AzureCloudInstance = void 0;
1491
1515
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1492
1516
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1493
1517
 
1494
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1518
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1495
1519
 
1496
1520
  /*
1497
1521
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1650,7 +1674,7 @@ var CredentialEntity = /** @class */ (function () {
1650
1674
  return CredentialEntity;
1651
1675
  }());
1652
1676
 
1653
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1677
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1654
1678
 
1655
1679
  /*
1656
1680
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1905,7 +1929,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1905
1929
  return ClientConfigurationError;
1906
1930
  }(ClientAuthError));
1907
1931
 
1908
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1932
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
1909
1933
 
1910
1934
  /*
1911
1935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2089,7 +2113,7 @@ var ScopeSet = /** @class */ (function () {
2089
2113
  return ScopeSet;
2090
2114
  }());
2091
2115
 
2092
- /*! @azure/msal-common v7.2.0 2022-07-18 */
2116
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2093
2117
 
2094
2118
  /*
2095
2119
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2109,7 +2133,7 @@ function buildClientInfo(rawClientInfo, crypto) {
2109
2133
  return JSON.parse(decodedClientInfo);
2110
2134
  }
2111
2135
  catch (e) {
2112
- throw ClientAuthError.createClientInfoDecodingError(e);
2136
+ throw ClientAuthError.createClientInfoDecodingError(e.message);
2113
2137
  }
2114
2138
  }
2115
2139
  /**
@@ -2127,7 +2151,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2127
2151
  };
2128
2152
  }
2129
2153
 
2130
- /*! @azure/msal-common v7.2.0 2022-07-18 */
2154
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2131
2155
  /*
2132
2156
  * Copyright (c) Microsoft Corporation. All rights reserved.
2133
2157
  * Licensed under the MIT License.
@@ -2141,7 +2165,7 @@ var AuthorityType;
2141
2165
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2142
2166
  })(AuthorityType || (AuthorityType = {}));
2143
2167
 
2144
- /*! @azure/msal-common v7.2.0 2022-07-18 */
2168
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2145
2169
 
2146
2170
  /*
2147
2171
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2376,7 +2400,7 @@ var AccountEntity = /** @class */ (function () {
2376
2400
  return AccountEntity;
2377
2401
  }());
2378
2402
 
2379
- /*! @azure/msal-common v7.2.0 2022-07-18 */
2403
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2380
2404
 
2381
2405
  /*
2382
2406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2414,7 +2438,7 @@ var AuthToken = /** @class */ (function () {
2414
2438
  return AuthToken;
2415
2439
  }());
2416
2440
 
2417
- /*! @azure/msal-common v7.2.0 2022-07-18 */
2441
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2418
2442
 
2419
2443
  /*
2420
2444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2445,6 +2469,7 @@ var CacheManager = /** @class */ (function () {
2445
2469
  var accountInfo = accountEntity.getAccountInfo();
2446
2470
  var idToken = _this.readIdTokenFromCache(_this.clientId, accountInfo);
2447
2471
  if (idToken && !accountInfo.idTokenClaims) {
2472
+ accountInfo.idToken = idToken.secret;
2448
2473
  accountInfo.idTokenClaims = new AuthToken(idToken.secret, _this.cryptoImpl).claims;
2449
2474
  }
2450
2475
  return accountInfo;
@@ -3288,7 +3313,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3288
3313
  return DefaultStorageClass;
3289
3314
  }(CacheManager));
3290
3315
 
3291
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3316
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3292
3317
 
3293
3318
  /*
3294
3319
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3382,7 +3407,7 @@ function buildAuthOptions(authOptions) {
3382
3407
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3383
3408
  }
3384
3409
 
3385
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3410
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3386
3411
 
3387
3412
  /*
3388
3413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3402,7 +3427,7 @@ var ServerError = /** @class */ (function (_super) {
3402
3427
  return ServerError;
3403
3428
  }(AuthError));
3404
3429
 
3405
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3430
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3406
3431
 
3407
3432
  /*
3408
3433
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3498,7 +3523,7 @@ var ThrottlingUtils = /** @class */ (function () {
3498
3523
  return ThrottlingUtils;
3499
3524
  }());
3500
3525
 
3501
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3526
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3502
3527
 
3503
3528
  /*
3504
3529
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3547,7 +3572,7 @@ var NetworkManager = /** @class */ (function () {
3547
3572
  return NetworkManager;
3548
3573
  }());
3549
3574
 
3550
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3575
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3551
3576
  /*
3552
3577
  * Copyright (c) Microsoft Corporation. All rights reserved.
3553
3578
  * Licensed under the MIT License.
@@ -3558,7 +3583,7 @@ var CcsCredentialType;
3558
3583
  CcsCredentialType["UPN"] = "UPN";
3559
3584
  })(CcsCredentialType || (CcsCredentialType = {}));
3560
3585
 
3561
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3586
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3562
3587
 
3563
3588
  /*
3564
3589
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3568,7 +3593,7 @@ var CcsCredentialType;
3568
3593
  * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
3569
3594
  */
3570
3595
  var BaseClient = /** @class */ (function () {
3571
- function BaseClient(configuration) {
3596
+ function BaseClient(configuration, performanceClient) {
3572
3597
  // Set the configuration
3573
3598
  this.config = buildClientConfiguration(configuration);
3574
3599
  // Initialize the logger
@@ -3585,6 +3610,8 @@ var BaseClient = /** @class */ (function () {
3585
3610
  this.serverTelemetryManager = this.config.serverTelemetryManager;
3586
3611
  // set Authority
3587
3612
  this.authority = this.config.authOptions.authority;
3613
+ // set performance telemetry client
3614
+ this.performanceClient = performanceClient;
3588
3615
  }
3589
3616
  /**
3590
3617
  * Creates default headers for requests to token endpoint
@@ -3647,7 +3674,7 @@ var BaseClient = /** @class */ (function () {
3647
3674
  return BaseClient;
3648
3675
  }());
3649
3676
 
3650
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3677
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3651
3678
 
3652
3679
  /*
3653
3680
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3733,7 +3760,7 @@ var RequestValidator = /** @class */ (function () {
3733
3760
  return RequestValidator;
3734
3761
  }());
3735
3762
 
3736
- /*! @azure/msal-common v7.2.0 2022-07-18 */
3763
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
3737
3764
 
3738
3765
  /*
3739
3766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4111,7 +4138,7 @@ var RequestParameterBuilder = /** @class */ (function () {
4111
4138
  return RequestParameterBuilder;
4112
4139
  }());
4113
4140
 
4114
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4141
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4115
4142
 
4116
4143
  /*
4117
4144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4175,7 +4202,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4175
4202
  return IdTokenEntity;
4176
4203
  }(CredentialEntity));
4177
4204
 
4178
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4205
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4179
4206
  /*
4180
4207
  * Copyright (c) Microsoft Corporation. All rights reserved.
4181
4208
  * Licensed under the MIT License.
@@ -4225,7 +4252,7 @@ var TimeUtils = /** @class */ (function () {
4225
4252
  return TimeUtils;
4226
4253
  }());
4227
4254
 
4228
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4255
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4229
4256
 
4230
4257
  /*
4231
4258
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4339,7 +4366,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4339
4366
  return AccessTokenEntity;
4340
4367
  }(CredentialEntity));
4341
4368
 
4342
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4369
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4343
4370
 
4344
4371
  /*
4345
4372
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4406,7 +4433,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4406
4433
  return RefreshTokenEntity;
4407
4434
  }(CredentialEntity));
4408
4435
 
4409
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4436
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4410
4437
 
4411
4438
  /*
4412
4439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4481,7 +4508,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4481
4508
  return InteractionRequiredAuthError;
4482
4509
  }(AuthError));
4483
4510
 
4484
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4511
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4485
4512
  /*
4486
4513
  * Copyright (c) Microsoft Corporation. All rights reserved.
4487
4514
  * Licensed under the MIT License.
@@ -4497,7 +4524,7 @@ var CacheRecord = /** @class */ (function () {
4497
4524
  return CacheRecord;
4498
4525
  }());
4499
4526
 
4500
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4527
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4501
4528
 
4502
4529
  /*
4503
4530
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4568,7 +4595,7 @@ var ProtocolUtils = /** @class */ (function () {
4568
4595
  return ProtocolUtils;
4569
4596
  }());
4570
4597
 
4571
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4598
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4572
4599
 
4573
4600
  /*
4574
4601
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4731,6 +4758,21 @@ var UrlString = /** @class */ (function () {
4731
4758
  }
4732
4759
  return Constants.EMPTY_STRING;
4733
4760
  };
4761
+ /**
4762
+ * Parses query string from given string. Returns empty string if no query symbol is found.
4763
+ * @param queryString
4764
+ */
4765
+ UrlString.parseQueryString = function (queryString) {
4766
+ var queryIndex1 = queryString.indexOf("?");
4767
+ var queryIndex2 = queryString.indexOf("/?");
4768
+ if (queryIndex2 > -1) {
4769
+ return queryString.substring(queryIndex2 + 2);
4770
+ }
4771
+ else if (queryIndex1 > -1) {
4772
+ return queryString.substring(queryIndex1 + 1);
4773
+ }
4774
+ return Constants.EMPTY_STRING;
4775
+ };
4734
4776
  UrlString.constructAuthorityUriFromObject = function (urlObject) {
4735
4777
  return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
4736
4778
  };
@@ -4752,6 +4794,24 @@ var UrlString = /** @class */ (function () {
4752
4794
  }
4753
4795
  return deserializedHash;
4754
4796
  };
4797
+ /**
4798
+ * Returns URL query string as server auth code response object.
4799
+ */
4800
+ UrlString.getDeserializedQueryString = function (query) {
4801
+ // Check if given query is empty
4802
+ if (StringUtils.isEmpty(query)) {
4803
+ return {};
4804
+ }
4805
+ // Strip the ? symbol if present
4806
+ var parsedQueryString = UrlString.parseQueryString(query);
4807
+ // If ? symbol was not present, above will return empty string, so give original query value
4808
+ var deserializedQueryString = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);
4809
+ // Check if deserialization didn't work
4810
+ if (!deserializedQueryString) {
4811
+ throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));
4812
+ }
4813
+ return deserializedQueryString;
4814
+ };
4755
4815
  /**
4756
4816
  * Check if the hash of the URL string contains known properties
4757
4817
  */
@@ -4769,7 +4829,7 @@ var UrlString = /** @class */ (function () {
4769
4829
  return UrlString;
4770
4830
  }());
4771
4831
 
4772
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4832
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4773
4833
 
4774
4834
  /*
4775
4835
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4870,7 +4930,7 @@ var PopTokenGenerator = /** @class */ (function () {
4870
4930
  return PopTokenGenerator;
4871
4931
  }());
4872
4932
 
4873
- /*! @azure/msal-common v7.2.0 2022-07-18 */
4933
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4874
4934
 
4875
4935
  /*
4876
4936
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4940,7 +5000,7 @@ var AppMetadataEntity = /** @class */ (function () {
4940
5000
  return AppMetadataEntity;
4941
5001
  }());
4942
5002
 
4943
- /*! @azure/msal-common v7.2.0 2022-07-18 */
5003
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4944
5004
  /*
4945
5005
  * Copyright (c) Microsoft Corporation. All rights reserved.
4946
5006
  * Licensed under the MIT License.
@@ -4976,7 +5036,7 @@ var AppMetadataEntity = /** @class */ (function () {
4976
5036
  return TokenCacheContext;
4977
5037
  }());
4978
5038
 
4979
- /*! @azure/msal-common v7.2.0 2022-07-18 */
5039
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
4980
5040
 
4981
5041
  /*
4982
5042
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5247,7 +5307,7 @@ var ResponseHandler = /** @class */ (function () {
5247
5307
  return ResponseHandler;
5248
5308
  }());
5249
5309
 
5250
- /*! @azure/msal-common v7.2.0 2022-07-18 */
5310
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
5251
5311
 
5252
5312
  /*
5253
5313
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5535,7 +5595,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5535
5595
  */
5536
5596
  AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
5537
5597
  return __awaiter(this, void 0, void 0, function () {
5538
- var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5598
+ var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5539
5599
  return __generator(this, function (_a) {
5540
5600
  switch (_a.label) {
5541
5601
  case 0:
@@ -5565,7 +5625,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5565
5625
  if (request.domainHint) {
5566
5626
  parameterBuilder.addDomainHint(request.domainHint);
5567
5627
  }
5568
- // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
5628
+ // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
5569
5629
  if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
5570
5630
  // AAD will throw if prompt=select_account is passed with an account hint
5571
5631
  if (request.sid && request.prompt === PromptValue.NONE) {
@@ -5575,9 +5635,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5575
5635
  }
5576
5636
  else if (request.account) {
5577
5637
  accountSid = this.extractAccountSid(request.account);
5578
- // If account and loginHint are provided, we will check account first for sid before adding loginHint
5579
- if (accountSid && request.prompt === PromptValue.NONE) {
5580
- // SessionId is only used in silent calls
5638
+ accountLoginHintClaim = this.extractLoginHint(request.account);
5639
+ // If login_hint claim is present, use it over sid/username
5640
+ if (accountLoginHintClaim) {
5641
+ this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
5642
+ parameterBuilder.addLoginHint(accountLoginHintClaim);
5643
+ try {
5644
+ clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
5645
+ parameterBuilder.addCcsOid(clientInfo);
5646
+ }
5647
+ catch (e) {
5648
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5649
+ }
5650
+ }
5651
+ else if (accountSid && request.prompt === PromptValue.NONE) {
5652
+ /*
5653
+ * If account and loginHint are provided, we will check account first for sid before adding loginHint
5654
+ * SessionId is only used in silent calls
5655
+ */
5581
5656
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
5582
5657
  parameterBuilder.addSid(accountSid);
5583
5658
  try {
@@ -5585,7 +5660,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5585
5660
  parameterBuilder.addCcsOid(clientInfo);
5586
5661
  }
5587
5662
  catch (e) {
5588
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5663
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5589
5664
  }
5590
5665
  }
5591
5666
  else if (request.loginHint) {
@@ -5602,7 +5677,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5602
5677
  parameterBuilder.addCcsOid(clientInfo);
5603
5678
  }
5604
5679
  catch (e) {
5605
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5680
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5606
5681
  }
5607
5682
  }
5608
5683
  }
@@ -5673,16 +5748,135 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5673
5748
  * @param account
5674
5749
  */
5675
5750
  AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
5676
- if (account.idTokenClaims) {
5677
- var tokenClaims = account.idTokenClaims;
5678
- return tokenClaims.sid || null;
5679
- }
5680
- return null;
5751
+ var _a;
5752
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
5753
+ };
5754
+ AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
5755
+ var _a;
5756
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
5681
5757
  };
5682
5758
  return AuthorizationCodeClient;
5683
5759
  }(BaseClient));
5684
5760
 
5685
- /*! @azure/msal-common v7.2.0 2022-07-18 */
5761
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
5762
+ /*
5763
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5764
+ * Licensed under the MIT License.
5765
+ */
5766
+ /**
5767
+ * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
5768
+ *
5769
+ * @export
5770
+ * @enum {number}
5771
+ */
5772
+ exports.PerformanceEvents = void 0;
5773
+ (function (PerformanceEvents) {
5774
+ /**
5775
+ * acquireTokenByCode API (msal-browser and msal-node).
5776
+ * Used to acquire tokens by trading an authorization code against the token endpoint.
5777
+ */
5778
+ PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
5779
+ /**
5780
+ * acquireTokenByRefreshToken API (msal-browser and msal-node).
5781
+ * Used to renew an access token using a refresh token against the token endpoint.
5782
+ */
5783
+ PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
5784
+ /**
5785
+ * acquireTokenSilent API (msal-browser and msal-node).
5786
+ * Used to silently acquire a new access token (from the cache or the network).
5787
+ */
5788
+ PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
5789
+ /**
5790
+ * acquireTokenSilentAsync (msal-browser).
5791
+ * Internal API for acquireTokenSilent.
5792
+ */
5793
+ PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
5794
+ /**
5795
+ * acquireTokenPopup (msal-browser).
5796
+ * Used to acquire a new access token interactively through pop ups
5797
+ */
5798
+ PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
5799
+ /**
5800
+ * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
5801
+ * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
5802
+ */
5803
+ PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
5804
+ /**
5805
+ * signJwt API in CryptoOpts class (msal-browser).
5806
+ * Used to signed a pop token.
5807
+ */
5808
+ PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
5809
+ /**
5810
+ * acquireToken API in the SilentCacheClient class (msal-browser).
5811
+ * Used to read access tokens from the cache.
5812
+ */
5813
+ PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
5814
+ /**
5815
+ * acquireToken API in the SilentIframeClient class (msal-browser).
5816
+ * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
5817
+ */
5818
+ PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
5819
+ /**
5820
+ * acquireToken API in SilentRereshClient (msal-browser).
5821
+ * Used to acquire a new set of tokens from the token endpoint using a refresh token.
5822
+ */
5823
+ PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
5824
+ /**
5825
+ * ssoSilent API (msal-browser).
5826
+ * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
5827
+ */
5828
+ PerformanceEvents["SsoSilent"] = "ssoSilent";
5829
+ /**
5830
+ * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
5831
+ * Used to load authority metadata for a request.
5832
+ */
5833
+ PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
5834
+ /**
5835
+ * acquireToken APIs in msal-browser.
5836
+ * Used to make an /authorize endpoint call with native brokering enabled.
5837
+ */
5838
+ PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
5839
+ /**
5840
+ * acquireToken API in NativeInteractionClient class (msal-browser).
5841
+ * Used to acquire a token from Native component when native brokering is enabled.
5842
+ */
5843
+ PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
5844
+ /**
5845
+ * Time spent on the network for refresh token acquisition
5846
+ */
5847
+ PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
5848
+ /**
5849
+ * Time spent creating default headers for requests to token endpoint
5850
+ */
5851
+ PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
5852
+ /**
5853
+ * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
5854
+ */
5855
+ PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
5856
+ /**
5857
+ * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
5858
+ */
5859
+ PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
5860
+ /**
5861
+ * acquireToken API in BrokerClientApplication.
5862
+ * Used to acquire a token on behalf of the embedded application (PW-Broker).
5863
+ */
5864
+ PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
5865
+ })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
5866
+ /**
5867
+ * State of the performance event.
5868
+ *
5869
+ * @export
5870
+ * @enum {number}
5871
+ */
5872
+ var PerformanceEventStatus;
5873
+ (function (PerformanceEventStatus) {
5874
+ PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
5875
+ PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
5876
+ PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
5877
+ })(PerformanceEventStatus || (PerformanceEventStatus = {}));
5878
+
5879
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
5686
5880
 
5687
5881
  /*
5688
5882
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5693,8 +5887,8 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5693
5887
  */
5694
5888
  var RefreshTokenClient = /** @class */ (function (_super) {
5695
5889
  __extends(RefreshTokenClient, _super);
5696
- function RefreshTokenClient(configuration) {
5697
- return _super.call(this, configuration) || this;
5890
+ function RefreshTokenClient(configuration, performanceClient) {
5891
+ return _super.call(this, configuration, performanceClient) || this;
5698
5892
  }
5699
5893
  RefreshTokenClient.prototype.acquireToken = function (request) {
5700
5894
  return __awaiter(this, void 0, void 0, function () {
@@ -5780,13 +5974,16 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5780
5974
  * @param authority
5781
5975
  */
5782
5976
  RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
5977
+ var _a;
5783
5978
  return __awaiter(this, void 0, void 0, function () {
5784
- var requestBody, queryParameters, headers, thumbprint, endpoint;
5785
- return __generator(this, function (_a) {
5786
- switch (_a.label) {
5787
- case 0: return [4 /*yield*/, this.createTokenRequestBody(request)];
5979
+ var acquireTokenMeasurement, requestBody, queryParameters, headers, thumbprint, endpoint;
5980
+ return __generator(this, function (_b) {
5981
+ switch (_b.label) {
5982
+ case 0:
5983
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
5984
+ return [4 /*yield*/, this.createTokenRequestBody(request)];
5788
5985
  case 1:
5789
- requestBody = _a.sent();
5986
+ requestBody = _b.sent();
5790
5987
  queryParameters = this.createTokenQueryParameters(request);
5791
5988
  headers = this.createTokenRequestHeaders(request.ccsCredential);
5792
5989
  thumbprint = {
@@ -5801,7 +5998,19 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5801
5998
  sshKid: request.sshKid
5802
5999
  };
5803
6000
  endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
5804
- return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
6001
+ return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
6002
+ .then(function (result) {
6003
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6004
+ success: true
6005
+ });
6006
+ return result;
6007
+ })
6008
+ .catch(function (error) {
6009
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6010
+ success: false
6011
+ });
6012
+ throw error;
6013
+ })];
5805
6014
  }
5806
6015
  });
5807
6016
  });
@@ -5822,11 +6031,14 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5822
6031
  * @param request
5823
6032
  */
5824
6033
  RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
6034
+ var _a;
5825
6035
  return __awaiter(this, void 0, void 0, function () {
5826
- var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
5827
- return __generator(this, function (_a) {
5828
- switch (_a.label) {
6036
+ var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
6037
+ return __generator(this, function (_b) {
6038
+ switch (_b.label) {
5829
6039
  case 0:
6040
+ correlationId = request.correlationId;
6041
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
5830
6042
  parameterBuilder = new RequestParameterBuilder();
5831
6043
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5832
6044
  parameterBuilder.addScopes(request.scopes);
@@ -5838,7 +6050,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5838
6050
  if (this.serverTelemetryManager) {
5839
6051
  parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
5840
6052
  }
5841
- correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5842
6053
  parameterBuilder.addCorrelationId(correlationId);
5843
6054
  parameterBuilder.addRefreshToken(request.refreshToken);
5844
6055
  if (this.config.clientCredentials.clientSecret) {
@@ -5853,7 +6064,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5853
6064
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5854
6065
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5855
6066
  case 1:
5856
- reqCnfData = _a.sent();
6067
+ reqCnfData = _b.sent();
5857
6068
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
5858
6069
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
5859
6070
  return [3 /*break*/, 3];
@@ -5863,10 +6074,13 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5863
6074
  parameterBuilder.addSshJwk(request.sshJwk);
5864
6075
  }
5865
6076
  else {
6077
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6078
+ success: false
6079
+ });
5866
6080
  throw ClientConfigurationError.createMissingSshJwkError();
5867
6081
  }
5868
6082
  }
5869
- _a.label = 3;
6083
+ _b.label = 3;
5870
6084
  case 3:
5871
6085
  if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
5872
6086
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
@@ -5887,6 +6101,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5887
6101
  break;
5888
6102
  }
5889
6103
  }
6104
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6105
+ success: true
6106
+ });
5890
6107
  return [2 /*return*/, parameterBuilder.createQueryString()];
5891
6108
  }
5892
6109
  });
@@ -5895,7 +6112,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5895
6112
  return RefreshTokenClient;
5896
6113
  }(BaseClient));
5897
6114
 
5898
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6115
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
5899
6116
 
5900
6117
  /*
5901
6118
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5903,8 +6120,8 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5903
6120
  */
5904
6121
  var SilentFlowClient = /** @class */ (function (_super) {
5905
6122
  __extends(SilentFlowClient, _super);
5906
- function SilentFlowClient(configuration) {
5907
- return _super.call(this, configuration) || this;
6123
+ function SilentFlowClient(configuration, performanceClient) {
6124
+ return _super.call(this, configuration, performanceClient) || this;
5908
6125
  }
5909
6126
  /**
5910
6127
  * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew
@@ -5923,7 +6140,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5923
6140
  case 2:
5924
6141
  e_1 = _a.sent();
5925
6142
  if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
5926
- refreshTokenClient = new RefreshTokenClient(this.config);
6143
+ refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
5927
6144
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];
5928
6145
  }
5929
6146
  else {
@@ -6011,7 +6228,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
6011
6228
  return SilentFlowClient;
6012
6229
  }(BaseClient));
6013
6230
 
6014
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6231
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6015
6232
  /*
6016
6233
  * Copyright (c) Microsoft Corporation. All rights reserved.
6017
6234
  * Licensed under the MIT License.
@@ -6023,7 +6240,7 @@ function isOpenIdConfigResponse(response) {
6023
6240
  response.hasOwnProperty("jwks_uri"));
6024
6241
  }
6025
6242
 
6026
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6243
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6027
6244
  /*
6028
6245
  * Copyright (c) Microsoft Corporation. All rights reserved.
6029
6246
  * Licensed under the MIT License.
@@ -6032,7 +6249,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
6032
6249
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6033
6250
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6034
6251
 
6035
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6252
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6036
6253
  /*
6037
6254
  * Copyright (c) Microsoft Corporation. All rights reserved.
6038
6255
  * Licensed under the MIT License.
@@ -6046,7 +6263,7 @@ exports.ProtocolMode = void 0;
6046
6263
  ProtocolMode["OIDC"] = "OIDC";
6047
6264
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6048
6265
 
6049
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6266
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6050
6267
 
6051
6268
  /*
6052
6269
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6123,7 +6340,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
6123
6340
  return AuthorityMetadataEntity;
6124
6341
  }());
6125
6342
 
6126
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6343
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6127
6344
  /*
6128
6345
  * Copyright (c) Microsoft Corporation. All rights reserved.
6129
6346
  * Licensed under the MIT License.
@@ -6133,7 +6350,7 @@ function isCloudInstanceDiscoveryResponse(response) {
6133
6350
  response.hasOwnProperty("metadata"));
6134
6351
  }
6135
6352
 
6136
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6353
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6137
6354
 
6138
6355
  /*
6139
6356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6255,7 +6472,7 @@ var RegionDiscovery = /** @class */ (function () {
6255
6472
  return RegionDiscovery;
6256
6473
  }());
6257
6474
 
6258
- /*! @azure/msal-common v7.2.0 2022-07-18 */
6475
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6259
6476
 
6260
6477
  /*
6261
6478
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6917,7 +7134,7 @@ var Authority = /** @class */ (function () {
6917
7134
  return Authority;
6918
7135
  }());
6919
7136
 
6920
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7137
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6921
7138
 
6922
7139
  /*
6923
7140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6978,7 +7195,7 @@ var AuthorityFactory = /** @class */ (function () {
6978
7195
  return AuthorityFactory;
6979
7196
  }());
6980
7197
 
6981
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7198
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
6982
7199
 
6983
7200
  /*
6984
7201
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7009,7 +7226,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
7009
7226
  return ServerTelemetryEntity;
7010
7227
  }());
7011
7228
 
7012
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7229
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7013
7230
 
7014
7231
  /*
7015
7232
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7037,7 +7254,7 @@ var ThrottlingEntity = /** @class */ (function () {
7037
7254
  return ThrottlingEntity;
7038
7255
  }());
7039
7256
 
7040
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7257
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7041
7258
 
7042
7259
  /*
7043
7260
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7054,7 +7271,7 @@ var StubbedNetworkModule = {
7054
7271
  }
7055
7272
  };
7056
7273
 
7057
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7274
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7058
7275
 
7059
7276
  /*
7060
7277
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7099,7 +7316,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
7099
7316
  return JoseHeaderError;
7100
7317
  }(AuthError));
7101
7318
 
7102
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7319
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7103
7320
 
7104
7321
  /*
7105
7322
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7139,7 +7356,7 @@ var JoseHeader = /** @class */ (function () {
7139
7356
  return JoseHeader;
7140
7357
  }());
7141
7358
 
7142
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7359
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7143
7360
 
7144
7361
  /*
7145
7362
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7198,7 +7415,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
7198
7415
  return AuthenticationHeaderParser;
7199
7416
  }());
7200
7417
 
7201
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7418
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7202
7419
 
7203
7420
  /*
7204
7421
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7360,117 +7577,7 @@ var ServerTelemetryManager = /** @class */ (function () {
7360
7577
  return ServerTelemetryManager;
7361
7578
  }());
7362
7579
 
7363
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7364
- /*
7365
- * Copyright (c) Microsoft Corporation. All rights reserved.
7366
- * Licensed under the MIT License.
7367
- */
7368
- /**
7369
- * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
7370
- *
7371
- * @export
7372
- * @enum {number}
7373
- */
7374
- exports.PerformanceEvents = void 0;
7375
- (function (PerformanceEvents) {
7376
- /**
7377
- * acquireTokenByCode API (msal-browser and msal-node).
7378
- * Used to acquire tokens by trading an authorization code against the token endpoint.
7379
- */
7380
- PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
7381
- /**
7382
- * acquireTokenByRefreshToken API (msal-browser and msal-node).
7383
- * Used to renew an access token using a refresh token against the token endpoint.
7384
- */
7385
- PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
7386
- /**
7387
- * acquireTokenSilent API (msal-browser and msal-node).
7388
- * Used to silently acquire a new access token (from the cache or the network).
7389
- */
7390
- PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
7391
- /**
7392
- * acquireTokenSilentAsync (msal-browser).
7393
- * Internal API for acquireTokenSilent.
7394
- */
7395
- PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
7396
- /**
7397
- * acquireTokenPopup (msal-browser).
7398
- * Used to acquire a new access token interactively through pop ups
7399
- */
7400
- PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
7401
- /**
7402
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
7403
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
7404
- */
7405
- PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
7406
- /**
7407
- * signJwt API in CryptoOpts class (msal-browser).
7408
- * Used to signed a pop token.
7409
- */
7410
- PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
7411
- /**
7412
- * acquireToken API in the SilentCacheClient class (msal-browser).
7413
- * Used to read access tokens from the cache.
7414
- */
7415
- PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
7416
- /**
7417
- * acquireToken API in the SilentIframeClient class (msal-browser).
7418
- * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
7419
- */
7420
- PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
7421
- /**
7422
- * acquireToken API in SilentRereshClient (msal-browser).
7423
- * Used to acquire a new set of tokens from the token endpoint using a refresh token.
7424
- */
7425
- PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
7426
- /**
7427
- * ssoSilent API (msal-browser).
7428
- * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
7429
- */
7430
- PerformanceEvents["SsoSilent"] = "ssoSilent";
7431
- /**
7432
- * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
7433
- * Used to load authority metadata for a request.
7434
- */
7435
- PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
7436
- /**
7437
- * acquireToken APIs in msal-browser.
7438
- * Used to make an /authorize endpoint call with native brokering enabled.
7439
- */
7440
- PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
7441
- /**
7442
- * acquireToken API in NativeInteractionClient class (msal-browser).
7443
- * Used to acquire a token from Native component when native brokering is enabled.
7444
- */
7445
- PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
7446
- /**
7447
- * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
7448
- */
7449
- PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
7450
- /**
7451
- * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
7452
- */
7453
- PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
7454
- /**
7455
- * acquireToken API in BrokerClientApplication.
7456
- * Used to acquire a token on behalf of the embedded application (PW-Broker).
7457
- */
7458
- PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
7459
- })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
7460
- /**
7461
- * State of the performance event.
7462
- *
7463
- * @export
7464
- * @enum {number}
7465
- */
7466
- var PerformanceEventStatus;
7467
- (function (PerformanceEventStatus) {
7468
- PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
7469
- PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
7470
- PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
7471
- })(PerformanceEventStatus || (PerformanceEventStatus = {}));
7472
-
7473
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7580
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7474
7581
 
7475
7582
  /*
7476
7583
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7746,7 +7853,7 @@ var PerformanceClient = /** @class */ (function () {
7746
7853
  return PerformanceClient;
7747
7854
  }());
7748
7855
 
7749
- /*! @azure/msal-common v7.2.0 2022-07-18 */
7856
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
7750
7857
 
7751
7858
  /*
7752
7859
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9574,7 +9681,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
9574
9681
 
9575
9682
  /* eslint-disable header/header */
9576
9683
  var name = "@azure/msal-browser";
9577
- var version = "2.28.0";
9684
+ var version = "2.28.3";
9578
9685
 
9579
9686
  /*
9580
9687
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10895,7 +11002,7 @@ var SilentCacheClient = /** @class */ (function (_super) {
10895
11002
  case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
10896
11003
  case 1:
10897
11004
  clientConfig = _a.sent();
10898
- return [2 /*return*/, new SilentFlowClient(clientConfig)];
11005
+ return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];
10899
11006
  }
10900
11007
  });
10901
11008
  });
@@ -11004,7 +11111,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11004
11111
  return {
11005
11112
  authority: request.authority,
11006
11113
  correlationId: this.correlationId,
11007
- scopes: ScopeSet.fromString(request.scopes).asArray(),
11114
+ scopes: ScopeSet.fromString(request.scope).asArray(),
11008
11115
  account: cachedAccount,
11009
11116
  forceRefresh: false,
11010
11117
  };
@@ -11170,7 +11277,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11170
11277
  homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
11171
11278
  accountEntity = AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authorityPreferredCache, response.account.id);
11172
11279
  this.browserStorage.setAccount(accountEntity);
11173
- responseScopes = response.scopes ? ScopeSet.fromString(response.scopes) : ScopeSet.fromString(request.scopes);
11280
+ responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);
11174
11281
  accountProperties = response.account.properties || {};
11175
11282
  uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
11176
11283
  tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
@@ -11258,7 +11365,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11258
11365
  response.hasOwnProperty("id_token") &&
11259
11366
  response.hasOwnProperty("client_info") &&
11260
11367
  response.hasOwnProperty("account") &&
11261
- response.hasOwnProperty("scopes") &&
11368
+ response.hasOwnProperty("scope") &&
11262
11369
  response.hasOwnProperty("expires_in")) {
11263
11370
  return response;
11264
11371
  }
@@ -11300,7 +11407,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11300
11407
  */
11301
11408
  NativeInteractionClient.prototype.initializeNativeRequest = function (request) {
11302
11409
  return __awaiter$1(this, void 0, void 0, function () {
11303
- var authority, canonicalAuthority, scopes, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11410
+ var authority, canonicalAuthority, scopes, remainingProperties, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
11304
11411
  var _this = this;
11305
11412
  return __generator$1(this, function (_a) {
11306
11413
  switch (_a.label) {
@@ -11309,8 +11416,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11309
11416
  authority = request.authority || this.config.auth.authority;
11310
11417
  canonicalAuthority = new UrlString(authority);
11311
11418
  canonicalAuthority.validateAsUri();
11312
- scopes = request && request.scopes || [];
11313
- scopeSet = new ScopeSet(scopes);
11419
+ scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
11420
+ scopeSet = new ScopeSet(scopes || []);
11314
11421
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
11315
11422
  getPrompt = function () {
11316
11423
  // If request is silent, prompt is always none
@@ -11337,7 +11444,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
11337
11444
  throw BrowserAuthError.createNativePromptParameterNotSupportedError();
11338
11445
  }
11339
11446
  };
11340
- validatedRequest = __assign$1(__assign$1({}, request), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scopes: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
11447
+ validatedRequest = __assign$1(__assign$1({}, remainingProperties), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scope: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
11341
11448
  });
11342
11449
  if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
11343
11450
  shrParameters = {
@@ -12887,7 +12994,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12887
12994
  case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12888
12995
  case 1:
12889
12996
  clientConfig = _a.sent();
12890
- return [2 /*return*/, new RefreshTokenClient(clientConfig)];
12997
+ return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];
12891
12998
  }
12892
12999
  });
12893
13000
  });
@@ -14000,29 +14107,17 @@ var DatabaseStorage = /** @class */ (function () {
14000
14107
  */
14001
14108
  DatabaseStorage.prototype.deleteDatabase = function () {
14002
14109
  return __awaiter$1(this, void 0, void 0, function () {
14003
- var existingDatabases, database;
14004
14110
  return __generator$1(this, function (_a) {
14005
- switch (_a.label) {
14006
- case 0:
14007
- // Check if database being deleted exists
14008
- if (this.db && this.dbOpen) {
14009
- this.closeConnection();
14010
- }
14011
- return [4 /*yield*/, window.indexedDB.databases()];
14012
- case 1:
14013
- existingDatabases = _a.sent();
14014
- database = existingDatabases.find(function (database) { return database.name === DB_NAME; });
14015
- // If database exists, delete it
14016
- if (database) {
14017
- return [2 /*return*/, new Promise(function (resolve, reject) {
14018
- var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
14019
- deleteDbRequest.addEventListener("success", function () { return resolve(true); });
14020
- deleteDbRequest.addEventListener("error", function () { return reject(false); });
14021
- })];
14022
- }
14023
- // Database doesn't exist, return true
14024
- return [2 /*return*/, true];
14111
+ // Check if database being deleted exists
14112
+ if (this.db && this.dbOpen) {
14113
+ this.closeConnection();
14025
14114
  }
14115
+ return [2 /*return*/, new Promise(function (resolve, reject) {
14116
+ var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
14117
+ deleteDbRequest.addEventListener("success", function () { return resolve(true); });
14118
+ deleteDbRequest.addEventListener("blocked", function () { return resolve(true); });
14119
+ deleteDbRequest.addEventListener("error", function () { return reject(false); });
14120
+ })];
14026
14121
  });
14027
14122
  });
14028
14123
  };
@@ -14191,34 +14286,38 @@ var AsyncMemoryStorage = /** @class */ (function () {
14191
14286
  });
14192
14287
  };
14193
14288
  /**
14194
- * Clears in-memory Map and tries to delete the IndexedDB database.
14289
+ * Clears in-memory Map
14290
+ */
14291
+ AsyncMemoryStorage.prototype.clearInMemory = function () {
14292
+ // InMemory cache is a Map instance, clear is straightforward
14293
+ this.logger.verbose("Deleting in-memory keystore " + this.storeName);
14294
+ this.inMemoryCache.clear();
14295
+ this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
14296
+ };
14297
+ /**
14298
+ * Tries to delete the IndexedDB database
14299
+ * @returns
14195
14300
  */
14196
- AsyncMemoryStorage.prototype.clear = function () {
14301
+ AsyncMemoryStorage.prototype.clearPersistent = function () {
14197
14302
  return __awaiter$1(this, void 0, void 0, function () {
14198
14303
  var dbDeleted, e_6;
14199
14304
  return __generator$1(this, function (_a) {
14200
14305
  switch (_a.label) {
14201
14306
  case 0:
14202
- // InMemory cache is a Map instance, clear is straightforward
14203
- this.logger.verbose("Deleting in-memory keystore " + this.storeName);
14204
- this.inMemoryCache.clear();
14205
- this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
14206
- this.logger.verbose("Deleting persistent keystore " + this.storeName);
14207
- _a.label = 1;
14208
- case 1:
14209
- _a.trys.push([1, 3, , 4]);
14307
+ _a.trys.push([0, 2, , 3]);
14308
+ this.logger.verbose("Deleting persistent keystore");
14210
14309
  return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];
14211
- case 2:
14310
+ case 1:
14212
14311
  dbDeleted = _a.sent();
14213
14312
  if (dbDeleted) {
14214
- this.logger.verbose("Persistent keystore " + this.storeName + " deleted");
14313
+ this.logger.verbose("Persistent keystore deleted");
14215
14314
  }
14216
14315
  return [2 /*return*/, dbDeleted];
14217
- case 3:
14316
+ case 2:
14218
14317
  e_6 = _a.sent();
14219
14318
  this.handleDatabaseAccessError(e_6);
14220
14319
  return [2 /*return*/, false];
14221
- case 4: return [2 /*return*/];
14320
+ case 3: return [2 /*return*/];
14222
14321
  }
14223
14322
  });
14224
14323
  });
@@ -14235,6 +14334,52 @@ var CryptoKeyStoreNames;
14235
14334
  CryptoKeyStoreNames["asymmetricKeys"] = "asymmetricKeys";
14236
14335
  CryptoKeyStoreNames["symmetricKeys"] = "symmetricKeys";
14237
14336
  })(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
14337
+ /**
14338
+ * MSAL CryptoKeyStore DB Version 2
14339
+ */
14340
+ var CryptoKeyStore = /** @class */ (function () {
14341
+ function CryptoKeyStore(logger) {
14342
+ this.logger = logger;
14343
+ this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);
14344
+ this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);
14345
+ }
14346
+ CryptoKeyStore.prototype.clear = function () {
14347
+ return __awaiter$1(this, void 0, void 0, function () {
14348
+ var e_1;
14349
+ return __generator$1(this, function (_a) {
14350
+ switch (_a.label) {
14351
+ case 0:
14352
+ // Delete in-memory keystores
14353
+ this.asymmetricKeys.clearInMemory();
14354
+ this.symmetricKeys.clearInMemory();
14355
+ _a.label = 1;
14356
+ case 1:
14357
+ _a.trys.push([1, 3, , 4]);
14358
+ return [4 /*yield*/, this.asymmetricKeys.clearPersistent()];
14359
+ case 2:
14360
+ _a.sent();
14361
+ return [2 /*return*/, true];
14362
+ case 3:
14363
+ e_1 = _a.sent();
14364
+ if (e_1 instanceof Error) {
14365
+ this.logger.error("Clearing keystore failed with error: " + e_1.message);
14366
+ }
14367
+ else {
14368
+ this.logger.error("Clearing keystore failed with unknown error");
14369
+ }
14370
+ return [2 /*return*/, false];
14371
+ case 4: return [2 /*return*/];
14372
+ }
14373
+ });
14374
+ });
14375
+ };
14376
+ return CryptoKeyStore;
14377
+ }());
14378
+
14379
+ /*
14380
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14381
+ * Licensed under the MIT License.
14382
+ */
14238
14383
  /**
14239
14384
  * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
14240
14385
  * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
@@ -14248,10 +14393,7 @@ var CryptoOps = /** @class */ (function () {
14248
14393
  this.b64Decode = new Base64Decode();
14249
14394
  this.guidGenerator = new GuidGenerator(this.browserCrypto);
14250
14395
  this.pkceGenerator = new PkceGenerator(this.browserCrypto);
14251
- this.cache = {
14252
- asymmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys),
14253
- symmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys)
14254
- };
14396
+ this.cache = new CryptoKeyStore(this.logger);
14255
14397
  this.performanceClient = performanceClient;
14256
14398
  }
14257
14399
  /**
@@ -14363,32 +14505,10 @@ var CryptoOps = /** @class */ (function () {
14363
14505
  */
14364
14506
  CryptoOps.prototype.clearKeystore = function () {
14365
14507
  return __awaiter$1(this, void 0, void 0, function () {
14366
- var e_1;
14367
14508
  return __generator$1(this, function (_a) {
14368
14509
  switch (_a.label) {
14369
- case 0:
14370
- _a.trys.push([0, 3, , 4]);
14371
- this.logger.verbose("Deleting in-memory and persistent asymmetric key stores");
14372
- return [4 /*yield*/, this.cache.asymmetricKeys.clear()];
14373
- case 1:
14374
- _a.sent();
14375
- this.logger.verbose("Successfully deleted asymmetric key stores");
14376
- this.logger.verbose("Deleting in-memory and persistent symmetric key stores");
14377
- return [4 /*yield*/, this.cache.symmetricKeys.clear()];
14378
- case 2:
14379
- _a.sent();
14380
- this.logger.verbose("Successfully deleted symmetric key stores");
14381
- return [2 /*return*/, true];
14382
- case 3:
14383
- e_1 = _a.sent();
14384
- if (e_1 instanceof Error) {
14385
- this.logger.error("Clearing keystore failed with error: " + e_1.message);
14386
- }
14387
- else {
14388
- this.logger.error("Clearing keystore failed with unknown error");
14389
- }
14390
- return [2 /*return*/, false];
14391
- case 4: return [2 /*return*/];
14510
+ case 0: return [4 /*yield*/, this.cache.clear()];
14511
+ case 1: return [2 /*return*/, _a.sent()];
14392
14512
  }
14393
14513
  });
14394
14514
  });
@@ -15844,6 +15964,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
15844
15964
  .catch(function (error) {
15845
15965
  _this.activeSilentTokenRequests.delete(silentRequestKey);
15846
15966
  atsMeasurement.endMeasurement({
15967
+ errorCode: error.errorCode,
15968
+ subErrorCode: error.subError,
15847
15969
  success: false
15848
15970
  });
15849
15971
  atsMeasurement.flushMeasurement();