@azure/msal-common 7.2.0 → 7.4.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 (101) hide show
  1. package/dist/_virtual/_tslib.js +1 -1
  2. package/dist/account/AccountInfo.d.ts +2 -0
  3. package/dist/account/AccountInfo.d.ts.map +1 -1
  4. package/dist/account/AuthToken.js +1 -1
  5. package/dist/account/CcsCredential.js +1 -1
  6. package/dist/account/ClientInfo.js +3 -3
  7. package/dist/account/ClientInfo.js.map +1 -1
  8. package/dist/authority/Authority.js +1 -1
  9. package/dist/authority/AuthorityFactory.js +1 -1
  10. package/dist/authority/AuthorityMetadata.js +1 -1
  11. package/dist/authority/AuthorityOptions.js +1 -1
  12. package/dist/authority/AuthorityType.js +1 -1
  13. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  14. package/dist/authority/OpenIdConfigResponse.js +1 -1
  15. package/dist/authority/ProtocolMode.js +1 -1
  16. package/dist/authority/RegionDiscovery.js +1 -1
  17. package/dist/cache/CacheManager.d.ts.map +1 -1
  18. package/dist/cache/CacheManager.js +2 -1
  19. package/dist/cache/CacheManager.js.map +1 -1
  20. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  21. package/dist/cache/entities/AccountEntity.js +1 -1
  22. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  23. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  24. package/dist/cache/entities/CacheRecord.js +1 -1
  25. package/dist/cache/entities/CredentialEntity.js +1 -1
  26. package/dist/cache/entities/IdTokenEntity.js +1 -1
  27. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  28. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  29. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  30. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  31. package/dist/client/AuthorizationCodeClient.d.ts +1 -0
  32. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  33. package/dist/client/AuthorizationCodeClient.js +29 -13
  34. package/dist/client/AuthorizationCodeClient.js.map +1 -1
  35. package/dist/client/BaseClient.d.ts +3 -1
  36. package/dist/client/BaseClient.d.ts.map +1 -1
  37. package/dist/client/BaseClient.js +4 -2
  38. package/dist/client/BaseClient.js.map +1 -1
  39. package/dist/client/ClientCredentialClient.js +1 -1
  40. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  41. package/dist/client/DeviceCodeClient.js +13 -7
  42. package/dist/client/DeviceCodeClient.js.map +1 -1
  43. package/dist/client/OnBehalfOfClient.js +1 -1
  44. package/dist/client/RefreshTokenClient.d.ts +2 -1
  45. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  46. package/dist/client/RefreshTokenClient.js +39 -15
  47. package/dist/client/RefreshTokenClient.js.map +1 -1
  48. package/dist/client/SilentFlowClient.d.ts +2 -1
  49. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  50. package/dist/client/SilentFlowClient.js +4 -4
  51. package/dist/client/SilentFlowClient.js.map +1 -1
  52. package/dist/client/UsernamePasswordClient.js +1 -1
  53. package/dist/config/ClientConfiguration.js +1 -1
  54. package/dist/crypto/ICrypto.js +1 -1
  55. package/dist/crypto/JoseHeader.js +1 -1
  56. package/dist/crypto/PopTokenGenerator.js +1 -1
  57. package/dist/error/AuthError.d.ts +10 -0
  58. package/dist/error/AuthError.d.ts.map +1 -1
  59. package/dist/error/AuthError.js +13 -1
  60. package/dist/error/AuthError.js.map +1 -1
  61. package/dist/error/ClientAuthError.js +1 -1
  62. package/dist/error/ClientConfigurationError.js +1 -1
  63. package/dist/error/InteractionRequiredAuthError.js +1 -1
  64. package/dist/error/JoseHeaderError.js +1 -1
  65. package/dist/error/ServerError.js +1 -1
  66. package/dist/index.cjs.js +338 -223
  67. package/dist/index.cjs.js.map +1 -1
  68. package/dist/index.d.ts +2 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +3 -2
  71. package/dist/index.js.map +1 -1
  72. package/dist/logger/Logger.js +1 -1
  73. package/dist/network/INetworkModule.js +1 -1
  74. package/dist/network/NetworkManager.js +1 -1
  75. package/dist/network/ThrottlingUtils.js +1 -1
  76. package/dist/packageMetadata.d.ts +1 -1
  77. package/dist/packageMetadata.js +2 -2
  78. package/dist/packageMetadata.js.map +1 -1
  79. package/dist/request/AuthenticationHeaderParser.js +1 -1
  80. package/dist/request/RequestParameterBuilder.js +1 -1
  81. package/dist/request/RequestValidator.js +1 -1
  82. package/dist/request/ScopeSet.js +1 -1
  83. package/dist/response/ResponseHandler.js +1 -1
  84. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  85. package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -0
  86. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  87. package/dist/telemetry/performance/PerformanceEvent.js +9 -1
  88. package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
  89. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  90. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  91. package/dist/url/UrlString.d.ts +9 -0
  92. package/dist/url/UrlString.d.ts.map +1 -1
  93. package/dist/url/UrlString.js +34 -1
  94. package/dist/url/UrlString.js.map +1 -1
  95. package/dist/utils/Constants.d.ts.map +1 -1
  96. package/dist/utils/Constants.js +2 -2
  97. package/dist/utils/Constants.js.map +1 -1
  98. package/dist/utils/ProtocolUtils.js +1 -1
  99. package/dist/utils/StringUtils.js +1 -1
  100. package/dist/utils/TimeUtils.js +1 -1
  101. package/package.json +2 -4
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v7.2.0 2022-07-18 */
1
+ /*! @azure/msal-common v7.4.1 2022-09-12 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -139,7 +139,7 @@ var Constants = {
139
139
  KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
140
140
  TOKEN_RESPONSE_TYPE: "token",
141
141
  ID_TOKEN_RESPONSE_TYPE: "id_token",
142
- SHR_NONCE_VALIDITY: 240,
142
+ SHR_NONCE_VALIDITY: 240
143
143
  };
144
144
  var OIDC_DEFAULT_SCOPES = [
145
145
  Constants.OPENID_SCOPE,
@@ -152,14 +152,14 @@ var OIDC_SCOPES = __spreadArrays(OIDC_DEFAULT_SCOPES, [
152
152
  /**
153
153
  * Request header names
154
154
  */
155
- var HeaderNames;
155
+ exports.HeaderNames = void 0;
156
156
  (function (HeaderNames) {
157
157
  HeaderNames["CONTENT_TYPE"] = "Content-Type";
158
158
  HeaderNames["RETRY_AFTER"] = "Retry-After";
159
159
  HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
160
160
  HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
161
161
  HeaderNames["AuthenticationInfo"] = "Authentication-Info";
162
- })(HeaderNames || (HeaderNames = {}));
162
+ })(exports.HeaderNames || (exports.HeaderNames = {}));
163
163
  /**
164
164
  * Persistent cache keys MSAL which stay while user is logged in.
165
165
  */
@@ -185,7 +185,7 @@ var AADAuthorityConstants;
185
185
  /**
186
186
  * Keys in the hashParams sent by AAD Server
187
187
  */
188
- var AADServerParamKeys;
188
+ exports.AADServerParamKeys = void 0;
189
189
  (function (AADServerParamKeys) {
190
190
  AADServerParamKeys["CLIENT_ID"] = "client_id";
191
191
  AADServerParamKeys["REDIRECT_URI"] = "redirect_uri";
@@ -235,15 +235,15 @@ var AADServerParamKeys;
235
235
  AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
236
236
  AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
237
237
  AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
238
- })(AADServerParamKeys || (AADServerParamKeys = {}));
238
+ })(exports.AADServerParamKeys || (exports.AADServerParamKeys = {}));
239
239
  /**
240
240
  * Claims request keys
241
241
  */
242
- var ClaimsRequestKeys;
242
+ exports.ClaimsRequestKeys = void 0;
243
243
  (function (ClaimsRequestKeys) {
244
244
  ClaimsRequestKeys["ACCESS_TOKEN"] = "access_token";
245
245
  ClaimsRequestKeys["XMS_CC"] = "xms_cc";
246
- })(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
246
+ })(exports.ClaimsRequestKeys || (exports.ClaimsRequestKeys = {}));
247
247
  /**
248
248
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
249
249
  * prompt values kept changing over past couple of years. There are some undocumented prompt values for some
@@ -259,7 +259,7 @@ var PromptValue = {
259
259
  /**
260
260
  * SSO Types - generated to populate hints
261
261
  */
262
- var SSOTypes;
262
+ exports.SSOTypes = void 0;
263
263
  (function (SSOTypes) {
264
264
  SSOTypes["ACCOUNT"] = "account";
265
265
  SSOTypes["SID"] = "sid";
@@ -270,13 +270,13 @@ var SSOTypes;
270
270
  SSOTypes["CONSUMERS"] = "consumers";
271
271
  SSOTypes["ACCOUNT_ID"] = "accountIdentifier";
272
272
  SSOTypes["HOMEACCOUNT_ID"] = "homeAccountIdentifier";
273
- })(SSOTypes || (SSOTypes = {}));
273
+ })(exports.SSOTypes || (exports.SSOTypes = {}));
274
274
  /**
275
275
  * Disallowed extra query parameters.
276
276
  */
277
277
  [
278
- SSOTypes.SID,
279
- SSOTypes.LOGIN_HINT
278
+ exports.SSOTypes.SID,
279
+ exports.SSOTypes.LOGIN_HINT
280
280
  ];
281
281
  /**
282
282
  * allowed values for codeVerifier
@@ -285,6 +285,15 @@ var CodeChallengeMethodValues = {
285
285
  PLAIN: "plain",
286
286
  S256: "S256"
287
287
  };
288
+ /**
289
+ * The method used to encode the code verifier for the code challenge parameter. can be one
290
+ * of plain or s256. if excluded, code challenge is assumed to be plaintext. for more
291
+ * information, see the pkce rcf: https://tools.ietf.org/html/rfc7636
292
+ */
293
+ [
294
+ CodeChallengeMethodValues.PLAIN,
295
+ CodeChallengeMethodValues.S256
296
+ ];
288
297
  /**
289
298
  * allowed values for response_mode
290
299
  */
@@ -424,11 +433,11 @@ var Errors = {
424
433
  /**
425
434
  * Password grant parameters
426
435
  */
427
- var PasswordGrantConstants;
436
+ exports.PasswordGrantConstants = void 0;
428
437
  (function (PasswordGrantConstants) {
429
438
  PasswordGrantConstants["username"] = "username";
430
439
  PasswordGrantConstants["password"] = "password";
431
- })(PasswordGrantConstants || (PasswordGrantConstants = {}));
440
+ })(exports.PasswordGrantConstants || (exports.PasswordGrantConstants = {}));
432
441
  /**
433
442
  * Response codes
434
443
  */
@@ -483,6 +492,10 @@ var AuthErrorMessage = {
483
492
  unexpectedError: {
484
493
  code: "unexpected_error",
485
494
  desc: "Unexpected error in authentication."
495
+ },
496
+ postRequestFailed: {
497
+ code: "post_request_failed",
498
+ desc: "Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."
486
499
  }
487
500
  };
488
501
  /**
@@ -511,6 +524,14 @@ var AuthError = /** @class */ (function (_super) {
511
524
  AuthError.createUnexpectedError = function (errDesc) {
512
525
  return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + ": " + errDesc);
513
526
  };
527
+ /**
528
+ * Creates an error for post request failures.
529
+ * @param errDesc
530
+ * @returns
531
+ */
532
+ AuthError.createPostRequestFailed = function (errDesc) {
533
+ return new AuthError(AuthErrorMessage.postRequestFailed.code, AuthErrorMessage.postRequestFailed.desc + ": " + errDesc);
534
+ };
514
535
  return AuthError;
515
536
  }(Error));
516
537
 
@@ -1360,7 +1381,7 @@ var Logger = /** @class */ (function () {
1360
1381
 
1361
1382
  /* eslint-disable header/header */
1362
1383
  var name = "@azure/msal-common";
1363
- var version = "7.2.0";
1384
+ var version = "7.4.1";
1364
1385
 
1365
1386
  /*
1366
1387
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1992,7 +2013,7 @@ function buildClientInfo(rawClientInfo, crypto) {
1992
2013
  return JSON.parse(decodedClientInfo);
1993
2014
  }
1994
2015
  catch (e) {
1995
- throw ClientAuthError.createClientInfoDecodingError(e);
2016
+ throw ClientAuthError.createClientInfoDecodingError(e.message);
1996
2017
  }
1997
2018
  }
1998
2019
  /**
@@ -2321,6 +2342,7 @@ var CacheManager = /** @class */ (function () {
2321
2342
  var accountInfo = accountEntity.getAccountInfo();
2322
2343
  var idToken = _this.readIdTokenFromCache(_this.clientId, accountInfo);
2323
2344
  if (idToken && !accountInfo.idTokenClaims) {
2345
+ accountInfo.idToken = idToken.secret;
2324
2346
  accountInfo.idTokenClaims = new AuthToken(idToken.secret, _this.cryptoImpl).claims;
2325
2347
  }
2326
2348
  return accountInfo;
@@ -3314,7 +3336,7 @@ var ThrottlingUtils = /** @class */ (function () {
3314
3336
  ThrottlingUtils.postProcess = function (cacheManager, thumbprint, response) {
3315
3337
  if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {
3316
3338
  var thumbprintValue = {
3317
- throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
3339
+ throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[exports.HeaderNames.RETRY_AFTER])),
3318
3340
  error: response.body.error,
3319
3341
  errorCodes: response.body.error_codes,
3320
3342
  errorMessage: response.body.error_description,
@@ -3336,7 +3358,7 @@ var ThrottlingUtils = /** @class */ (function () {
3336
3358
  */
3337
3359
  ThrottlingUtils.checkResponseForRetryAfter = function (response) {
3338
3360
  if (response.headers) {
3339
- return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);
3361
+ return response.headers.hasOwnProperty(exports.HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);
3340
3362
  }
3341
3363
  return false;
3342
3364
  };
@@ -3433,7 +3455,7 @@ exports.CcsCredentialType = void 0;
3433
3455
  * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
3434
3456
  */
3435
3457
  var BaseClient = /** @class */ (function () {
3436
- function BaseClient(configuration) {
3458
+ function BaseClient(configuration, performanceClient) {
3437
3459
  // Set the configuration
3438
3460
  this.config = buildClientConfiguration(configuration);
3439
3461
  // Initialize the logger
@@ -3450,26 +3472,28 @@ var BaseClient = /** @class */ (function () {
3450
3472
  this.serverTelemetryManager = this.config.serverTelemetryManager;
3451
3473
  // set Authority
3452
3474
  this.authority = this.config.authOptions.authority;
3475
+ // set performance telemetry client
3476
+ this.performanceClient = performanceClient;
3453
3477
  }
3454
3478
  /**
3455
3479
  * Creates default headers for requests to token endpoint
3456
3480
  */
3457
3481
  BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {
3458
3482
  var headers = {};
3459
- headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
3483
+ headers[exports.HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
3460
3484
  if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
3461
3485
  switch (ccsCred.type) {
3462
3486
  case exports.CcsCredentialType.HOME_ACCOUNT_ID:
3463
3487
  try {
3464
3488
  var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
3465
- headers[HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
3489
+ headers[exports.HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
3466
3490
  }
3467
3491
  catch (e) {
3468
3492
  this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
3469
3493
  }
3470
3494
  break;
3471
3495
  case exports.CcsCredentialType.UPN:
3472
- headers[HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
3496
+ headers[exports.HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
3473
3497
  break;
3474
3498
  }
3475
3499
  }
@@ -3608,26 +3632,26 @@ var RequestParameterBuilder = /** @class */ (function () {
3608
3632
  * add response_type = code
3609
3633
  */
3610
3634
  RequestParameterBuilder.prototype.addResponseTypeCode = function () {
3611
- this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));
3635
+ this.parameters.set(exports.AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));
3612
3636
  };
3613
3637
  /**
3614
3638
  * add response_type = token id_token
3615
3639
  */
3616
3640
  RequestParameterBuilder.prototype.addResponseTypeForTokenAndIdToken = function () {
3617
- this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.TOKEN_RESPONSE_TYPE + " " + Constants.ID_TOKEN_RESPONSE_TYPE));
3641
+ this.parameters.set(exports.AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.TOKEN_RESPONSE_TYPE + " " + Constants.ID_TOKEN_RESPONSE_TYPE));
3618
3642
  };
3619
3643
  /**
3620
3644
  * add response_mode. defaults to query.
3621
3645
  * @param responseMode
3622
3646
  */
3623
3647
  RequestParameterBuilder.prototype.addResponseMode = function (responseMode) {
3624
- this.parameters.set(AADServerParamKeys.RESPONSE_MODE, encodeURIComponent((responseMode) ? responseMode : exports.ResponseMode.QUERY));
3648
+ this.parameters.set(exports.AADServerParamKeys.RESPONSE_MODE, encodeURIComponent((responseMode) ? responseMode : exports.ResponseMode.QUERY));
3625
3649
  };
3626
3650
  /**
3627
3651
  * Add flag to indicate STS should attempt to use WAM if available
3628
3652
  */
3629
3653
  RequestParameterBuilder.prototype.addNativeBroker = function () {
3630
- this.parameters.set(AADServerParamKeys.NATIVE_BROKER, encodeURIComponent("1"));
3654
+ this.parameters.set(exports.AADServerParamKeys.NATIVE_BROKER, encodeURIComponent("1"));
3631
3655
  };
3632
3656
  /**
3633
3657
  * add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
@@ -3638,14 +3662,14 @@ var RequestParameterBuilder = /** @class */ (function () {
3638
3662
  if (addOidcScopes === void 0) { addOidcScopes = true; }
3639
3663
  var requestScopes = addOidcScopes ? __spreadArrays(scopes || [], OIDC_DEFAULT_SCOPES) : scopes || [];
3640
3664
  var scopeSet = new ScopeSet(requestScopes);
3641
- this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));
3665
+ this.parameters.set(exports.AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));
3642
3666
  };
3643
3667
  /**
3644
3668
  * add clientId
3645
3669
  * @param clientId
3646
3670
  */
3647
3671
  RequestParameterBuilder.prototype.addClientId = function (clientId) {
3648
- this.parameters.set(AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));
3672
+ this.parameters.set(exports.AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));
3649
3673
  };
3650
3674
  /**
3651
3675
  * add redirect_uri
@@ -3653,7 +3677,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3653
3677
  */
3654
3678
  RequestParameterBuilder.prototype.addRedirectUri = function (redirectUri) {
3655
3679
  RequestValidator.validateRedirectUri(redirectUri);
3656
- this.parameters.set(AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));
3680
+ this.parameters.set(exports.AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));
3657
3681
  };
3658
3682
  /**
3659
3683
  * add post logout redirectUri
@@ -3661,49 +3685,49 @@ var RequestParameterBuilder = /** @class */ (function () {
3661
3685
  */
3662
3686
  RequestParameterBuilder.prototype.addPostLogoutRedirectUri = function (redirectUri) {
3663
3687
  RequestValidator.validateRedirectUri(redirectUri);
3664
- this.parameters.set(AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));
3688
+ this.parameters.set(exports.AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));
3665
3689
  };
3666
3690
  /**
3667
3691
  * add id_token_hint to logout request
3668
3692
  * @param idTokenHint
3669
3693
  */
3670
3694
  RequestParameterBuilder.prototype.addIdTokenHint = function (idTokenHint) {
3671
- this.parameters.set(AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));
3695
+ this.parameters.set(exports.AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));
3672
3696
  };
3673
3697
  /**
3674
3698
  * add domain_hint
3675
3699
  * @param domainHint
3676
3700
  */
3677
3701
  RequestParameterBuilder.prototype.addDomainHint = function (domainHint) {
3678
- this.parameters.set(SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));
3702
+ this.parameters.set(exports.SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));
3679
3703
  };
3680
3704
  /**
3681
3705
  * add login_hint
3682
3706
  * @param loginHint
3683
3707
  */
3684
3708
  RequestParameterBuilder.prototype.addLoginHint = function (loginHint) {
3685
- this.parameters.set(SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));
3709
+ this.parameters.set(exports.SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));
3686
3710
  };
3687
3711
  /**
3688
3712
  * Adds the CCS (Cache Credential Service) query parameter for login_hint
3689
3713
  * @param loginHint
3690
3714
  */
3691
3715
  RequestParameterBuilder.prototype.addCcsUpn = function (loginHint) {
3692
- this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent("UPN:" + loginHint));
3716
+ this.parameters.set(exports.HeaderNames.CCS_HEADER, encodeURIComponent("UPN:" + loginHint));
3693
3717
  };
3694
3718
  /**
3695
3719
  * Adds the CCS (Cache Credential Service) query parameter for account object
3696
3720
  * @param loginHint
3697
3721
  */
3698
3722
  RequestParameterBuilder.prototype.addCcsOid = function (clientInfo) {
3699
- this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent("Oid:" + clientInfo.uid + "@" + clientInfo.utid));
3723
+ this.parameters.set(exports.HeaderNames.CCS_HEADER, encodeURIComponent("Oid:" + clientInfo.uid + "@" + clientInfo.utid));
3700
3724
  };
3701
3725
  /**
3702
3726
  * add sid
3703
3727
  * @param sid
3704
3728
  */
3705
3729
  RequestParameterBuilder.prototype.addSid = function (sid) {
3706
- this.parameters.set(SSOTypes.SID, encodeURIComponent(sid));
3730
+ this.parameters.set(exports.SSOTypes.SID, encodeURIComponent(sid));
3707
3731
  };
3708
3732
  /**
3709
3733
  * add claims
@@ -3712,14 +3736,14 @@ var RequestParameterBuilder = /** @class */ (function () {
3712
3736
  RequestParameterBuilder.prototype.addClaims = function (claims, clientCapabilities) {
3713
3737
  var mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);
3714
3738
  RequestValidator.validateClaims(mergedClaims);
3715
- this.parameters.set(AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));
3739
+ this.parameters.set(exports.AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));
3716
3740
  };
3717
3741
  /**
3718
3742
  * add correlationId
3719
3743
  * @param correlationId
3720
3744
  */
3721
3745
  RequestParameterBuilder.prototype.addCorrelationId = function (correlationId) {
3722
- this.parameters.set(AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));
3746
+ this.parameters.set(exports.AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));
3723
3747
  };
3724
3748
  /**
3725
3749
  * add library info query params
@@ -3727,13 +3751,13 @@ var RequestParameterBuilder = /** @class */ (function () {
3727
3751
  */
3728
3752
  RequestParameterBuilder.prototype.addLibraryInfo = function (libraryInfo) {
3729
3753
  // Telemetry Info
3730
- this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
3731
- this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
3754
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
3755
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
3732
3756
  if (libraryInfo.os) {
3733
- this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);
3757
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);
3734
3758
  }
3735
3759
  if (libraryInfo.cpu) {
3736
- this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);
3760
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);
3737
3761
  }
3738
3762
  };
3739
3763
  /**
@@ -3742,10 +3766,10 @@ var RequestParameterBuilder = /** @class */ (function () {
3742
3766
  */
3743
3767
  RequestParameterBuilder.prototype.addApplicationTelemetry = function (appTelemetry) {
3744
3768
  if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appName) {
3745
- this.parameters.set(AADServerParamKeys.X_APP_NAME, appTelemetry.appName);
3769
+ this.parameters.set(exports.AADServerParamKeys.X_APP_NAME, appTelemetry.appName);
3746
3770
  }
3747
3771
  if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appVersion) {
3748
- this.parameters.set(AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);
3772
+ this.parameters.set(exports.AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);
3749
3773
  }
3750
3774
  };
3751
3775
  /**
@@ -3754,7 +3778,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3754
3778
  */
3755
3779
  RequestParameterBuilder.prototype.addPrompt = function (prompt) {
3756
3780
  RequestValidator.validatePrompt(prompt);
3757
- this.parameters.set("" + AADServerParamKeys.PROMPT, encodeURIComponent(prompt));
3781
+ this.parameters.set("" + exports.AADServerParamKeys.PROMPT, encodeURIComponent(prompt));
3758
3782
  };
3759
3783
  /**
3760
3784
  * add state
@@ -3762,7 +3786,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3762
3786
  */
3763
3787
  RequestParameterBuilder.prototype.addState = function (state) {
3764
3788
  if (!StringUtils.isEmpty(state)) {
3765
- this.parameters.set(AADServerParamKeys.STATE, encodeURIComponent(state));
3789
+ this.parameters.set(exports.AADServerParamKeys.STATE, encodeURIComponent(state));
3766
3790
  }
3767
3791
  };
3768
3792
  /**
@@ -3770,7 +3794,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3770
3794
  * @param nonce
3771
3795
  */
3772
3796
  RequestParameterBuilder.prototype.addNonce = function (nonce) {
3773
- this.parameters.set(AADServerParamKeys.NONCE, encodeURIComponent(nonce));
3797
+ this.parameters.set(exports.AADServerParamKeys.NONCE, encodeURIComponent(nonce));
3774
3798
  };
3775
3799
  /**
3776
3800
  * add code_challenge and code_challenge_method
@@ -3781,8 +3805,8 @@ var RequestParameterBuilder = /** @class */ (function () {
3781
3805
  RequestParameterBuilder.prototype.addCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {
3782
3806
  RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);
3783
3807
  if (codeChallenge && codeChallengeMethod) {
3784
- this.parameters.set(AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));
3785
- this.parameters.set(AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));
3808
+ this.parameters.set(exports.AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));
3809
+ this.parameters.set(exports.AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));
3786
3810
  }
3787
3811
  else {
3788
3812
  throw ClientConfigurationError.createInvalidCodeChallengeParamsError();
@@ -3793,35 +3817,35 @@ var RequestParameterBuilder = /** @class */ (function () {
3793
3817
  * @param code
3794
3818
  */
3795
3819
  RequestParameterBuilder.prototype.addAuthorizationCode = function (code) {
3796
- this.parameters.set(AADServerParamKeys.CODE, encodeURIComponent(code));
3820
+ this.parameters.set(exports.AADServerParamKeys.CODE, encodeURIComponent(code));
3797
3821
  };
3798
3822
  /**
3799
3823
  * add the `authorization_code` passed by the user to exchange for a token
3800
3824
  * @param code
3801
3825
  */
3802
3826
  RequestParameterBuilder.prototype.addDeviceCode = function (code) {
3803
- this.parameters.set(AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));
3827
+ this.parameters.set(exports.AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));
3804
3828
  };
3805
3829
  /**
3806
3830
  * add the `refreshToken` passed by the user
3807
3831
  * @param refreshToken
3808
3832
  */
3809
3833
  RequestParameterBuilder.prototype.addRefreshToken = function (refreshToken) {
3810
- this.parameters.set(AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));
3834
+ this.parameters.set(exports.AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));
3811
3835
  };
3812
3836
  /**
3813
3837
  * add the `code_verifier` passed by the user to exchange for a token
3814
3838
  * @param codeVerifier
3815
3839
  */
3816
3840
  RequestParameterBuilder.prototype.addCodeVerifier = function (codeVerifier) {
3817
- this.parameters.set(AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));
3841
+ this.parameters.set(exports.AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));
3818
3842
  };
3819
3843
  /**
3820
3844
  * add client_secret
3821
3845
  * @param clientSecret
3822
3846
  */
3823
3847
  RequestParameterBuilder.prototype.addClientSecret = function (clientSecret) {
3824
- this.parameters.set(AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));
3848
+ this.parameters.set(exports.AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));
3825
3849
  };
3826
3850
  /**
3827
3851
  * add clientAssertion for confidential client flows
@@ -3829,7 +3853,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3829
3853
  */
3830
3854
  RequestParameterBuilder.prototype.addClientAssertion = function (clientAssertion) {
3831
3855
  if (!StringUtils.isEmpty(clientAssertion)) {
3832
- this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));
3856
+ this.parameters.set(exports.AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));
3833
3857
  }
3834
3858
  };
3835
3859
  /**
@@ -3838,7 +3862,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3838
3862
  */
3839
3863
  RequestParameterBuilder.prototype.addClientAssertionType = function (clientAssertionType) {
3840
3864
  if (!StringUtils.isEmpty(clientAssertionType)) {
3841
- this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));
3865
+ this.parameters.set(exports.AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));
3842
3866
  }
3843
3867
  };
3844
3868
  /**
@@ -3846,21 +3870,21 @@ var RequestParameterBuilder = /** @class */ (function () {
3846
3870
  * @param clientAssertion
3847
3871
  */
3848
3872
  RequestParameterBuilder.prototype.addOboAssertion = function (oboAssertion) {
3849
- this.parameters.set(AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));
3873
+ this.parameters.set(exports.AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));
3850
3874
  };
3851
3875
  /**
3852
3876
  * add grant type
3853
3877
  * @param grantType
3854
3878
  */
3855
3879
  RequestParameterBuilder.prototype.addRequestTokenUse = function (tokenUse) {
3856
- this.parameters.set(AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));
3880
+ this.parameters.set(exports.AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));
3857
3881
  };
3858
3882
  /**
3859
3883
  * add grant type
3860
3884
  * @param grantType
3861
3885
  */
3862
3886
  RequestParameterBuilder.prototype.addGrantType = function (grantType) {
3863
- this.parameters.set(AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));
3887
+ this.parameters.set(exports.AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));
3864
3888
  };
3865
3889
  /**
3866
3890
  * add client info
@@ -3895,12 +3919,12 @@ var RequestParameterBuilder = /** @class */ (function () {
3895
3919
  }
3896
3920
  }
3897
3921
  if (clientCapabilities && clientCapabilities.length > 0) {
3898
- if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
3922
+ if (!mergedClaims.hasOwnProperty(exports.ClaimsRequestKeys.ACCESS_TOKEN)) {
3899
3923
  // Add access_token key to claims object
3900
- mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
3924
+ mergedClaims[exports.ClaimsRequestKeys.ACCESS_TOKEN] = {};
3901
3925
  }
3902
3926
  // Add xms_cc claim with provided clientCapabilities to access_token key
3903
- mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {
3927
+ mergedClaims[exports.ClaimsRequestKeys.ACCESS_TOKEN][exports.ClaimsRequestKeys.XMS_CC] = {
3904
3928
  values: clientCapabilities
3905
3929
  };
3906
3930
  }
@@ -3911,14 +3935,14 @@ var RequestParameterBuilder = /** @class */ (function () {
3911
3935
  * @param username
3912
3936
  */
3913
3937
  RequestParameterBuilder.prototype.addUsername = function (username) {
3914
- this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));
3938
+ this.parameters.set(exports.PasswordGrantConstants.username, encodeURIComponent(username));
3915
3939
  };
3916
3940
  /**
3917
3941
  * adds `password` for Password Grant flow
3918
3942
  * @param password
3919
3943
  */
3920
3944
  RequestParameterBuilder.prototype.addPassword = function (password) {
3921
- this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));
3945
+ this.parameters.set(exports.PasswordGrantConstants.password, encodeURIComponent(password));
3922
3946
  };
3923
3947
  /**
3924
3948
  * add pop_jwk to query params
@@ -3926,8 +3950,8 @@ var RequestParameterBuilder = /** @class */ (function () {
3926
3950
  */
3927
3951
  RequestParameterBuilder.prototype.addPopToken = function (cnfString) {
3928
3952
  if (!StringUtils.isEmpty(cnfString)) {
3929
- this.parameters.set(AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.POP);
3930
- this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
3953
+ this.parameters.set(exports.AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.POP);
3954
+ this.parameters.set(exports.AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
3931
3955
  }
3932
3956
  };
3933
3957
  /**
@@ -3935,8 +3959,8 @@ var RequestParameterBuilder = /** @class */ (function () {
3935
3959
  */
3936
3960
  RequestParameterBuilder.prototype.addSshJwk = function (sshJwkString) {
3937
3961
  if (!StringUtils.isEmpty(sshJwkString)) {
3938
- this.parameters.set(AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.SSH);
3939
- this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
3962
+ this.parameters.set(exports.AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.SSH);
3963
+ this.parameters.set(exports.AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
3940
3964
  }
3941
3965
  };
3942
3966
  /**
@@ -3944,20 +3968,20 @@ var RequestParameterBuilder = /** @class */ (function () {
3944
3968
  * @param serverTelemetryManager
3945
3969
  */
3946
3970
  RequestParameterBuilder.prototype.addServerTelemetry = function (serverTelemetryManager) {
3947
- this.parameters.set(AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
3948
- this.parameters.set(AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
3971
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
3972
+ this.parameters.set(exports.AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
3949
3973
  };
3950
3974
  /**
3951
3975
  * Adds parameter that indicates to the server that throttling is supported
3952
3976
  */
3953
3977
  RequestParameterBuilder.prototype.addThrottling = function () {
3954
- this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3978
+ this.parameters.set(exports.AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3955
3979
  };
3956
3980
  /**
3957
3981
  * Adds logout_hint parameter for "silent" logout which prevent server account picker
3958
3982
  */
3959
3983
  RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {
3960
- this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
3984
+ this.parameters.set(exports.AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
3961
3985
  };
3962
3986
  /**
3963
3987
  * Utility to create a URL from the params map
@@ -4578,6 +4602,21 @@ var UrlString = /** @class */ (function () {
4578
4602
  }
4579
4603
  return Constants.EMPTY_STRING;
4580
4604
  };
4605
+ /**
4606
+ * Parses query string from given string. Returns empty string if no query symbol is found.
4607
+ * @param queryString
4608
+ */
4609
+ UrlString.parseQueryString = function (queryString) {
4610
+ var queryIndex1 = queryString.indexOf("?");
4611
+ var queryIndex2 = queryString.indexOf("/?");
4612
+ if (queryIndex2 > -1) {
4613
+ return queryString.substring(queryIndex2 + 2);
4614
+ }
4615
+ else if (queryIndex1 > -1) {
4616
+ return queryString.substring(queryIndex1 + 1);
4617
+ }
4618
+ return Constants.EMPTY_STRING;
4619
+ };
4581
4620
  UrlString.constructAuthorityUriFromObject = function (urlObject) {
4582
4621
  return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
4583
4622
  };
@@ -4599,6 +4638,24 @@ var UrlString = /** @class */ (function () {
4599
4638
  }
4600
4639
  return deserializedHash;
4601
4640
  };
4641
+ /**
4642
+ * Returns URL query string as server auth code response object.
4643
+ */
4644
+ UrlString.getDeserializedQueryString = function (query) {
4645
+ // Check if given query is empty
4646
+ if (StringUtils.isEmpty(query)) {
4647
+ return {};
4648
+ }
4649
+ // Strip the ? symbol if present
4650
+ var parsedQueryString = UrlString.parseQueryString(query);
4651
+ // If ? symbol was not present, above will return empty string, so give original query value
4652
+ var deserializedQueryString = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);
4653
+ // Check if deserialization didn't work
4654
+ if (!deserializedQueryString) {
4655
+ throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));
4656
+ }
4657
+ return deserializedQueryString;
4658
+ };
4602
4659
  /**
4603
4660
  * Check if the hash of the URL string contains known properties
4604
4661
  */
@@ -5357,9 +5414,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5357
5414
  parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
5358
5415
  }
5359
5416
  // Add hybrid spa parameters if not already provided
5360
- if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
5417
+ if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[exports.AADServerParamKeys.RETURN_SPA_CODE])) {
5361
5418
  parameterBuilder.addExtraQueryParameters((_a = {},
5362
- _a[AADServerParamKeys.RETURN_SPA_CODE] = "1",
5419
+ _a[exports.AADServerParamKeys.RETURN_SPA_CODE] = "1",
5363
5420
  _a));
5364
5421
  }
5365
5422
  return [2 /*return*/, parameterBuilder.createQueryString()];
@@ -5373,7 +5430,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5373
5430
  */
5374
5431
  AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
5375
5432
  return __awaiter(this, void 0, void 0, function () {
5376
- var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5433
+ var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
5377
5434
  return __generator(this, function (_a) {
5378
5435
  switch (_a.label) {
5379
5436
  case 0:
@@ -5403,7 +5460,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5403
5460
  if (request.domainHint) {
5404
5461
  parameterBuilder.addDomainHint(request.domainHint);
5405
5462
  }
5406
- // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
5463
+ // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
5407
5464
  if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
5408
5465
  // AAD will throw if prompt=select_account is passed with an account hint
5409
5466
  if (request.sid && request.prompt === PromptValue.NONE) {
@@ -5413,9 +5470,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5413
5470
  }
5414
5471
  else if (request.account) {
5415
5472
  accountSid = this.extractAccountSid(request.account);
5416
- // If account and loginHint are provided, we will check account first for sid before adding loginHint
5417
- if (accountSid && request.prompt === PromptValue.NONE) {
5418
- // SessionId is only used in silent calls
5473
+ accountLoginHintClaim = this.extractLoginHint(request.account);
5474
+ // If login_hint claim is present, use it over sid/username
5475
+ if (accountLoginHintClaim) {
5476
+ this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
5477
+ parameterBuilder.addLoginHint(accountLoginHintClaim);
5478
+ try {
5479
+ clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
5480
+ parameterBuilder.addCcsOid(clientInfo);
5481
+ }
5482
+ catch (e) {
5483
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5484
+ }
5485
+ }
5486
+ else if (accountSid && request.prompt === PromptValue.NONE) {
5487
+ /*
5488
+ * If account and loginHint are provided, we will check account first for sid before adding loginHint
5489
+ * SessionId is only used in silent calls
5490
+ */
5419
5491
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
5420
5492
  parameterBuilder.addSid(accountSid);
5421
5493
  try {
@@ -5423,7 +5495,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5423
5495
  parameterBuilder.addCcsOid(clientInfo);
5424
5496
  }
5425
5497
  catch (e) {
5426
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5498
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5427
5499
  }
5428
5500
  }
5429
5501
  else if (request.loginHint) {
@@ -5440,7 +5512,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5440
5512
  parameterBuilder.addCcsOid(clientInfo);
5441
5513
  }
5442
5514
  catch (e) {
5443
- this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
5515
+ this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
5444
5516
  }
5445
5517
  }
5446
5518
  }
@@ -5511,11 +5583,12 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5511
5583
  * @param account
5512
5584
  */
5513
5585
  AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
5514
- if (account.idTokenClaims) {
5515
- var tokenClaims = account.idTokenClaims;
5516
- return tokenClaims.sid || null;
5517
- }
5518
- return null;
5586
+ var _a;
5587
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
5588
+ };
5589
+ AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
5590
+ var _a;
5591
+ return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
5519
5592
  };
5520
5593
  return AuthorizationCodeClient;
5521
5594
  }(BaseClient));
@@ -5668,7 +5741,7 @@ var DeviceCodeClient = /** @class */ (function (_super) {
5668
5741
  pollingIntervalMilli = deviceCodeResponse.interval * 1000;
5669
5742
  _a.label = 1;
5670
5743
  case 1:
5671
- if (!this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) return [3 /*break*/, 6];
5744
+ if (!this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) return [3 /*break*/, 8];
5672
5745
  thumbprint = {
5673
5746
  clientId: this.config.authOptions.clientId,
5674
5747
  authority: request.authority,
@@ -5683,18 +5756,23 @@ var DeviceCodeClient = /** @class */ (function (_super) {
5683
5756
  return [4 /*yield*/, this.executePostToTokenEndpoint(this.authority.tokenEndpoint, requestBody, headers, thumbprint)];
5684
5757
  case 2:
5685
5758
  response = _a.sent();
5686
- if (!(response.body && response.body.error === Constants.AUTHORIZATION_PENDING)) return [3 /*break*/, 4];
5687
- // user authorization is pending. Sleep for polling interval and try again
5688
- this.logger.info(response.body.error_description || "Authorization pending. Continue polling.");
5759
+ if (!(response.body && response.body.error)) return [3 /*break*/, 6];
5760
+ if (!(response.body.error === Constants.AUTHORIZATION_PENDING)) return [3 /*break*/, 4];
5761
+ this.logger.info("Authorization pending. Continue polling.");
5689
5762
  return [4 /*yield*/, TimeUtils.delay(pollingIntervalMilli)];
5690
5763
  case 3:
5691
5764
  _a.sent();
5692
5765
  return [3 /*break*/, 5];
5693
5766
  case 4:
5767
+ // for any other error, throw
5768
+ this.logger.info("Unexpected error in polling from the server");
5769
+ throw ServerError.createPostRequestFailed(response.body.error);
5770
+ case 5: return [3 /*break*/, 7];
5771
+ case 6:
5694
5772
  this.logger.verbose("Authorization completed successfully. Polling stopped.");
5695
5773
  return [2 /*return*/, response.body];
5696
- case 5: return [3 /*break*/, 1];
5697
- case 6:
5774
+ case 7: return [3 /*break*/, 1];
5775
+ case 8:
5698
5776
  /*
5699
5777
  * The above code should've thrown by this point, but to satisfy TypeScript,
5700
5778
  * and in the rare case the conditionals in continuePolling() may not catch everything...
@@ -5733,6 +5811,123 @@ var DeviceCodeClient = /** @class */ (function (_super) {
5733
5811
  return DeviceCodeClient;
5734
5812
  }(BaseClient));
5735
5813
 
5814
+ /*
5815
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5816
+ * Licensed under the MIT License.
5817
+ */
5818
+ /**
5819
+ * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
5820
+ *
5821
+ * @export
5822
+ * @enum {number}
5823
+ */
5824
+ exports.PerformanceEvents = void 0;
5825
+ (function (PerformanceEvents) {
5826
+ /**
5827
+ * acquireTokenByCode API (msal-browser and msal-node).
5828
+ * Used to acquire tokens by trading an authorization code against the token endpoint.
5829
+ */
5830
+ PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
5831
+ /**
5832
+ * acquireTokenByRefreshToken API (msal-browser and msal-node).
5833
+ * Used to renew an access token using a refresh token against the token endpoint.
5834
+ */
5835
+ PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
5836
+ /**
5837
+ * acquireTokenSilent API (msal-browser and msal-node).
5838
+ * Used to silently acquire a new access token (from the cache or the network).
5839
+ */
5840
+ PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
5841
+ /**
5842
+ * acquireTokenSilentAsync (msal-browser).
5843
+ * Internal API for acquireTokenSilent.
5844
+ */
5845
+ PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
5846
+ /**
5847
+ * acquireTokenPopup (msal-browser).
5848
+ * Used to acquire a new access token interactively through pop ups
5849
+ */
5850
+ PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
5851
+ /**
5852
+ * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
5853
+ * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
5854
+ */
5855
+ PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
5856
+ /**
5857
+ * signJwt API in CryptoOpts class (msal-browser).
5858
+ * Used to signed a pop token.
5859
+ */
5860
+ PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
5861
+ /**
5862
+ * acquireToken API in the SilentCacheClient class (msal-browser).
5863
+ * Used to read access tokens from the cache.
5864
+ */
5865
+ PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
5866
+ /**
5867
+ * acquireToken API in the SilentIframeClient class (msal-browser).
5868
+ * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
5869
+ */
5870
+ PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
5871
+ /**
5872
+ * acquireToken API in SilentRereshClient (msal-browser).
5873
+ * Used to acquire a new set of tokens from the token endpoint using a refresh token.
5874
+ */
5875
+ PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
5876
+ /**
5877
+ * ssoSilent API (msal-browser).
5878
+ * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
5879
+ */
5880
+ PerformanceEvents["SsoSilent"] = "ssoSilent";
5881
+ /**
5882
+ * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
5883
+ * Used to load authority metadata for a request.
5884
+ */
5885
+ PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
5886
+ /**
5887
+ * acquireToken APIs in msal-browser.
5888
+ * Used to make an /authorize endpoint call with native brokering enabled.
5889
+ */
5890
+ PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
5891
+ /**
5892
+ * acquireToken API in NativeInteractionClient class (msal-browser).
5893
+ * Used to acquire a token from Native component when native brokering is enabled.
5894
+ */
5895
+ PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
5896
+ /**
5897
+ * Time spent on the network for refresh token acquisition
5898
+ */
5899
+ PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
5900
+ /**
5901
+ * Time spent creating default headers for requests to token endpoint
5902
+ */
5903
+ PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
5904
+ /**
5905
+ * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
5906
+ */
5907
+ PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
5908
+ /**
5909
+ * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
5910
+ */
5911
+ PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
5912
+ /**
5913
+ * acquireToken API in BrokerClientApplication.
5914
+ * Used to acquire a token on behalf of the embedded application (PW-Broker).
5915
+ */
5916
+ PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
5917
+ })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
5918
+ /**
5919
+ * State of the performance event.
5920
+ *
5921
+ * @export
5922
+ * @enum {number}
5923
+ */
5924
+ exports.PerformanceEventStatus = void 0;
5925
+ (function (PerformanceEventStatus) {
5926
+ PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
5927
+ PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
5928
+ PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
5929
+ })(exports.PerformanceEventStatus || (exports.PerformanceEventStatus = {}));
5930
+
5736
5931
  /*
5737
5932
  * Copyright (c) Microsoft Corporation. All rights reserved.
5738
5933
  * Licensed under the MIT License.
@@ -5742,8 +5937,8 @@ var DeviceCodeClient = /** @class */ (function (_super) {
5742
5937
  */
5743
5938
  var RefreshTokenClient = /** @class */ (function (_super) {
5744
5939
  __extends(RefreshTokenClient, _super);
5745
- function RefreshTokenClient(configuration) {
5746
- return _super.call(this, configuration) || this;
5940
+ function RefreshTokenClient(configuration, performanceClient) {
5941
+ return _super.call(this, configuration, performanceClient) || this;
5747
5942
  }
5748
5943
  RefreshTokenClient.prototype.acquireToken = function (request) {
5749
5944
  return __awaiter(this, void 0, void 0, function () {
@@ -5829,13 +6024,16 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5829
6024
  * @param authority
5830
6025
  */
5831
6026
  RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
6027
+ var _a;
5832
6028
  return __awaiter(this, void 0, void 0, function () {
5833
- var requestBody, queryParameters, headers, thumbprint, endpoint;
5834
- return __generator(this, function (_a) {
5835
- switch (_a.label) {
5836
- case 0: return [4 /*yield*/, this.createTokenRequestBody(request)];
6029
+ var acquireTokenMeasurement, requestBody, queryParameters, headers, thumbprint, endpoint;
6030
+ return __generator(this, function (_b) {
6031
+ switch (_b.label) {
6032
+ case 0:
6033
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
6034
+ return [4 /*yield*/, this.createTokenRequestBody(request)];
5837
6035
  case 1:
5838
- requestBody = _a.sent();
6036
+ requestBody = _b.sent();
5839
6037
  queryParameters = this.createTokenQueryParameters(request);
5840
6038
  headers = this.createTokenRequestHeaders(request.ccsCredential);
5841
6039
  thumbprint = {
@@ -5850,7 +6048,19 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5850
6048
  sshKid: request.sshKid
5851
6049
  };
5852
6050
  endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
5853
- return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
6051
+ return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
6052
+ .then(function (result) {
6053
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6054
+ success: true
6055
+ });
6056
+ return result;
6057
+ })
6058
+ .catch(function (error) {
6059
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6060
+ success: false
6061
+ });
6062
+ throw error;
6063
+ })];
5854
6064
  }
5855
6065
  });
5856
6066
  });
@@ -5871,11 +6081,14 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5871
6081
  * @param request
5872
6082
  */
5873
6083
  RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
6084
+ var _a;
5874
6085
  return __awaiter(this, void 0, void 0, function () {
5875
- var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
5876
- return __generator(this, function (_a) {
5877
- switch (_a.label) {
6086
+ var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
6087
+ return __generator(this, function (_b) {
6088
+ switch (_b.label) {
5878
6089
  case 0:
6090
+ correlationId = request.correlationId;
6091
+ acquireTokenMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
5879
6092
  parameterBuilder = new RequestParameterBuilder();
5880
6093
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5881
6094
  parameterBuilder.addScopes(request.scopes);
@@ -5887,7 +6100,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5887
6100
  if (this.serverTelemetryManager) {
5888
6101
  parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
5889
6102
  }
5890
- correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5891
6103
  parameterBuilder.addCorrelationId(correlationId);
5892
6104
  parameterBuilder.addRefreshToken(request.refreshToken);
5893
6105
  if (this.config.clientCredentials.clientSecret) {
@@ -5902,7 +6114,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5902
6114
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5903
6115
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5904
6116
  case 1:
5905
- reqCnfData = _a.sent();
6117
+ reqCnfData = _b.sent();
5906
6118
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
5907
6119
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
5908
6120
  return [3 /*break*/, 3];
@@ -5912,10 +6124,13 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5912
6124
  parameterBuilder.addSshJwk(request.sshJwk);
5913
6125
  }
5914
6126
  else {
6127
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6128
+ success: false
6129
+ });
5915
6130
  throw ClientConfigurationError.createMissingSshJwkError();
5916
6131
  }
5917
6132
  }
5918
- _a.label = 3;
6133
+ _b.label = 3;
5919
6134
  case 3:
5920
6135
  if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
5921
6136
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
@@ -5936,6 +6151,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5936
6151
  break;
5937
6152
  }
5938
6153
  }
6154
+ acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
6155
+ success: true
6156
+ });
5939
6157
  return [2 /*return*/, parameterBuilder.createQueryString()];
5940
6158
  }
5941
6159
  });
@@ -6347,7 +6565,7 @@ var OnBehalfOfClient = /** @class */ (function (_super) {
6347
6565
  }
6348
6566
  var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
6349
6567
  parameterBuilder.addCorrelationId(correlationId);
6350
- parameterBuilder.addRequestTokenUse(AADServerParamKeys.ON_BEHALF_OF);
6568
+ parameterBuilder.addRequestTokenUse(exports.AADServerParamKeys.ON_BEHALF_OF);
6351
6569
  parameterBuilder.addOboAssertion(request.oboAssertion);
6352
6570
  if (this.config.clientCredentials.clientSecret) {
6353
6571
  parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
@@ -6368,8 +6586,8 @@ var OnBehalfOfClient = /** @class */ (function (_super) {
6368
6586
  */
6369
6587
  var SilentFlowClient = /** @class */ (function (_super) {
6370
6588
  __extends(SilentFlowClient, _super);
6371
- function SilentFlowClient(configuration) {
6372
- return _super.call(this, configuration) || this;
6589
+ function SilentFlowClient(configuration, performanceClient) {
6590
+ return _super.call(this, configuration, performanceClient) || this;
6373
6591
  }
6374
6592
  /**
6375
6593
  * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew
@@ -6388,7 +6606,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
6388
6606
  case 2:
6389
6607
  e_1 = _a.sent();
6390
6608
  if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
6391
- refreshTokenClient = new RefreshTokenClient(this.config);
6609
+ refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
6392
6610
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];
6393
6611
  }
6394
6612
  else {
@@ -7707,22 +7925,22 @@ var AuthenticationHeaderParser = /** @class */ (function () {
7707
7925
  */
7708
7926
  AuthenticationHeaderParser.prototype.getShrNonce = function () {
7709
7927
  // Attempt to parse nonce from Authentiacation-Info
7710
- var authenticationInfo = this.headers[HeaderNames.AuthenticationInfo];
7928
+ var authenticationInfo = this.headers[exports.HeaderNames.AuthenticationInfo];
7711
7929
  if (authenticationInfo) {
7712
7930
  var authenticationInfoChallenges = this.parseChallenges(authenticationInfo);
7713
7931
  if (authenticationInfoChallenges.nextnonce) {
7714
7932
  return authenticationInfoChallenges.nextnonce;
7715
7933
  }
7716
- throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.AuthenticationInfo, "nextnonce challenge is missing.");
7934
+ throw ClientConfigurationError.createInvalidAuthenticationHeaderError(exports.HeaderNames.AuthenticationInfo, "nextnonce challenge is missing.");
7717
7935
  }
7718
7936
  // Attempt to parse nonce from WWW-Authenticate
7719
- var wwwAuthenticate = this.headers[HeaderNames.WWWAuthenticate];
7937
+ var wwwAuthenticate = this.headers[exports.HeaderNames.WWWAuthenticate];
7720
7938
  if (wwwAuthenticate) {
7721
7939
  var wwwAuthenticateChallenges = this.parseChallenges(wwwAuthenticate);
7722
7940
  if (wwwAuthenticateChallenges.nonce) {
7723
7941
  return wwwAuthenticateChallenges.nonce;
7724
7942
  }
7725
- throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.WWWAuthenticate, "nonce challenge is missing.");
7943
+ throw ClientConfigurationError.createInvalidAuthenticationHeaderError(exports.HeaderNames.WWWAuthenticate, "nonce challenge is missing.");
7726
7944
  }
7727
7945
  // If neither header is present, throw missing headers error
7728
7946
  throw ClientConfigurationError.createMissingNonceAuthenticationHeadersError();
@@ -7906,115 +8124,6 @@ var ServerTelemetryManager = /** @class */ (function () {
7906
8124
  return ServerTelemetryManager;
7907
8125
  }());
7908
8126
 
7909
- /*
7910
- * Copyright (c) Microsoft Corporation. All rights reserved.
7911
- * Licensed under the MIT License.
7912
- */
7913
- /**
7914
- * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
7915
- *
7916
- * @export
7917
- * @enum {number}
7918
- */
7919
- exports.PerformanceEvents = void 0;
7920
- (function (PerformanceEvents) {
7921
- /**
7922
- * acquireTokenByCode API (msal-browser and msal-node).
7923
- * Used to acquire tokens by trading an authorization code against the token endpoint.
7924
- */
7925
- PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
7926
- /**
7927
- * acquireTokenByRefreshToken API (msal-browser and msal-node).
7928
- * Used to renew an access token using a refresh token against the token endpoint.
7929
- */
7930
- PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
7931
- /**
7932
- * acquireTokenSilent API (msal-browser and msal-node).
7933
- * Used to silently acquire a new access token (from the cache or the network).
7934
- */
7935
- PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
7936
- /**
7937
- * acquireTokenSilentAsync (msal-browser).
7938
- * Internal API for acquireTokenSilent.
7939
- */
7940
- PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
7941
- /**
7942
- * acquireTokenPopup (msal-browser).
7943
- * Used to acquire a new access token interactively through pop ups
7944
- */
7945
- PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
7946
- /**
7947
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
7948
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
7949
- */
7950
- PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
7951
- /**
7952
- * signJwt API in CryptoOpts class (msal-browser).
7953
- * Used to signed a pop token.
7954
- */
7955
- PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
7956
- /**
7957
- * acquireToken API in the SilentCacheClient class (msal-browser).
7958
- * Used to read access tokens from the cache.
7959
- */
7960
- PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
7961
- /**
7962
- * acquireToken API in the SilentIframeClient class (msal-browser).
7963
- * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
7964
- */
7965
- PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
7966
- /**
7967
- * acquireToken API in SilentRereshClient (msal-browser).
7968
- * Used to acquire a new set of tokens from the token endpoint using a refresh token.
7969
- */
7970
- PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
7971
- /**
7972
- * ssoSilent API (msal-browser).
7973
- * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
7974
- */
7975
- PerformanceEvents["SsoSilent"] = "ssoSilent";
7976
- /**
7977
- * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
7978
- * Used to load authority metadata for a request.
7979
- */
7980
- PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
7981
- /**
7982
- * acquireToken APIs in msal-browser.
7983
- * Used to make an /authorize endpoint call with native brokering enabled.
7984
- */
7985
- PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
7986
- /**
7987
- * acquireToken API in NativeInteractionClient class (msal-browser).
7988
- * Used to acquire a token from Native component when native brokering is enabled.
7989
- */
7990
- PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
7991
- /**
7992
- * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
7993
- */
7994
- PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
7995
- /**
7996
- * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
7997
- */
7998
- PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
7999
- /**
8000
- * acquireToken API in BrokerClientApplication.
8001
- * Used to acquire a token on behalf of the embedded application (PW-Broker).
8002
- */
8003
- PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
8004
- })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
8005
- /**
8006
- * State of the performance event.
8007
- *
8008
- * @export
8009
- * @enum {number}
8010
- */
8011
- exports.PerformanceEventStatus = void 0;
8012
- (function (PerformanceEventStatus) {
8013
- PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
8014
- PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
8015
- PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
8016
- })(exports.PerformanceEventStatus || (exports.PerformanceEventStatus = {}));
8017
-
8018
8127
  /*
8019
8128
  * Copyright (c) Microsoft Corporation. All rights reserved.
8020
8129
  * Licensed under the MIT License.
@@ -8336,12 +8445,14 @@ exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
8336
8445
  exports.ClientConfigurationError = ClientConfigurationError;
8337
8446
  exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
8338
8447
  exports.ClientCredentialClient = ClientCredentialClient;
8448
+ exports.CodeChallengeMethodValues = CodeChallengeMethodValues;
8339
8449
  exports.Constants = Constants;
8340
8450
  exports.CredentialEntity = CredentialEntity;
8341
8451
  exports.DEFAULT_CRYPTO_IMPLEMENTATION = DEFAULT_CRYPTO_IMPLEMENTATION;
8342
8452
  exports.DEFAULT_SYSTEM_OPTIONS = DEFAULT_SYSTEM_OPTIONS;
8343
8453
  exports.DefaultStorageClass = DefaultStorageClass;
8344
8454
  exports.DeviceCodeClient = DeviceCodeClient;
8455
+ exports.Errors = Errors;
8345
8456
  exports.IdToken = AuthToken;
8346
8457
  exports.IdTokenEntity = IdTokenEntity;
8347
8458
  exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
@@ -8365,11 +8476,15 @@ exports.SilentFlowClient = SilentFlowClient;
8365
8476
  exports.StringUtils = StringUtils;
8366
8477
  exports.StubPerformanceClient = StubPerformanceClient;
8367
8478
  exports.StubbedNetworkModule = StubbedNetworkModule;
8479
+ exports.THE_FAMILY_ID = THE_FAMILY_ID;
8480
+ exports.ThrottlingConstants = ThrottlingConstants;
8368
8481
  exports.ThrottlingEntity = ThrottlingEntity;
8369
8482
  exports.ThrottlingUtils = ThrottlingUtils;
8370
8483
  exports.TimeUtils = TimeUtils;
8371
8484
  exports.TokenCacheContext = TokenCacheContext;
8372
8485
  exports.UrlString = UrlString;
8373
8486
  exports.UsernamePasswordClient = UsernamePasswordClient;
8487
+ exports.buildClientInfo = buildClientInfo;
8488
+ exports.buildClientInfoFromHomeAccountId = buildClientInfoFromHomeAccountId;
8374
8489
  exports.version = version;
8375
8490
  //# sourceMappingURL=index.cjs.js.map