@azure/msal-common 13.3.1 → 13.3.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 (77) hide show
  1. package/dist/_virtual/_tslib.js +1 -1
  2. package/dist/account/AccountInfo.d.ts +1 -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 +1 -1
  7. package/dist/authority/Authority.js +2 -2
  8. package/dist/authority/AuthorityFactory.js +1 -1
  9. package/dist/authority/AuthorityMetadata.js +1 -1
  10. package/dist/authority/AuthorityOptions.js +1 -1
  11. package/dist/authority/AuthorityType.js +1 -1
  12. package/dist/authority/CloudInstanceDiscoveryErrorResponse.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.js +2 -2
  18. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  19. package/dist/cache/entities/AccountEntity.d.ts +20 -17
  20. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  21. package/dist/cache/entities/AccountEntity.js +59 -79
  22. package/dist/cache/entities/AccountEntity.js.map +1 -1
  23. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  24. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  25. package/dist/cache/entities/CacheRecord.js +1 -1
  26. package/dist/cache/entities/CredentialEntity.js +1 -1
  27. package/dist/cache/entities/IdTokenEntity.js +1 -1
  28. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  29. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  30. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  31. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  32. package/dist/client/AuthorizationCodeClient.js +2 -2
  33. package/dist/client/BaseClient.js +1 -1
  34. package/dist/client/ClientCredentialClient.js +1 -1
  35. package/dist/client/DeviceCodeClient.js +1 -1
  36. package/dist/client/OnBehalfOfClient.js +1 -1
  37. package/dist/client/RefreshTokenClient.js +1 -1
  38. package/dist/client/SilentFlowClient.js +1 -1
  39. package/dist/client/UsernamePasswordClient.js +1 -1
  40. package/dist/config/ClientConfiguration.js +1 -1
  41. package/dist/crypto/ICrypto.js +1 -1
  42. package/dist/crypto/JoseHeader.js +1 -1
  43. package/dist/crypto/PopTokenGenerator.js +1 -1
  44. package/dist/error/AuthError.js +1 -1
  45. package/dist/error/ClientAuthError.js +1 -1
  46. package/dist/error/ClientConfigurationError.js +1 -1
  47. package/dist/error/InteractionRequiredAuthError.js +1 -1
  48. package/dist/error/JoseHeaderError.js +1 -1
  49. package/dist/error/ServerError.js +1 -1
  50. package/dist/index.cjs.js +79 -117
  51. package/dist/index.cjs.js.map +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/logger/Logger.js +1 -1
  54. package/dist/network/INetworkModule.js +1 -1
  55. package/dist/network/NetworkManager.js +1 -1
  56. package/dist/network/ThrottlingUtils.js +1 -1
  57. package/dist/packageMetadata.d.ts +1 -1
  58. package/dist/packageMetadata.js +2 -2
  59. package/dist/packageMetadata.js.map +1 -1
  60. package/dist/request/AuthenticationHeaderParser.js +1 -1
  61. package/dist/request/RequestParameterBuilder.js +1 -1
  62. package/dist/request/RequestValidator.js +1 -1
  63. package/dist/request/ScopeSet.js +1 -1
  64. package/dist/response/ResponseHandler.d.ts +0 -7
  65. package/dist/response/ResponseHandler.d.ts.map +1 -1
  66. package/dist/response/ResponseHandler.js +9 -27
  67. package/dist/response/ResponseHandler.js.map +1 -1
  68. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  69. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  70. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  71. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  72. package/dist/url/UrlString.js +1 -1
  73. package/dist/utils/Constants.js +1 -1
  74. package/dist/utils/ProtocolUtils.js +1 -1
  75. package/dist/utils/StringUtils.js +1 -1
  76. package/dist/utils/TimeUtils.js +1 -1
  77. package/package.json +77 -77
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from '../error/AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { JoseHeaderError } from '../error/JoseHeaderError.js';
4
4
  import { JsonTypes } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { TimeUtils } from '../utils/TimeUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { ClientAuthError } from './ClientAuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.1 2023-10-27 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -1424,7 +1424,7 @@ var Logger = /** @class */ (function () {
1424
1424
 
1425
1425
  /* eslint-disable header/header */
1426
1426
  var name = "@azure/msal-common";
1427
- var version = "13.3.1";
1427
+ var version = "13.3.3";
1428
1428
 
1429
1429
  /*
1430
1430
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1957,6 +1957,19 @@ exports.AuthorityType = void 0;
1957
1957
  AuthorityType[AuthorityType["Ciam"] = 3] = "Ciam";
1958
1958
  })(exports.AuthorityType || (exports.AuthorityType = {}));
1959
1959
 
1960
+ /*
1961
+ * Copyright (c) Microsoft Corporation. All rights reserved.
1962
+ * Licensed under the MIT License.
1963
+ */
1964
+ /**
1965
+ * Protocol modes supported by MSAL.
1966
+ */
1967
+ exports.ProtocolMode = void 0;
1968
+ (function (ProtocolMode) {
1969
+ ProtocolMode["AAD"] = "AAD";
1970
+ ProtocolMode["OIDC"] = "OIDC";
1971
+ })(exports.ProtocolMode || (exports.ProtocolMode = {}));
1972
+
1960
1973
  /*
1961
1974
  * Copyright (c) Microsoft Corporation. All rights reserved.
1962
1975
  * Licensed under the MIT License.
@@ -1976,8 +1989,8 @@ exports.AuthorityType = void 0;
1976
1989
  * localAccountId: Original tenant-specific accountID, usually used for legacy cases
1977
1990
  * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt
1978
1991
  * authorityType: Accounts authority type as a string
1979
- * name: Full name for the account, including given name and family name,
1980
1992
  * clientInfo: Full base64 encoded client info received from ESTS
1993
+ * name: Full name for the account, including given name and family name
1981
1994
  * lastModificationTime: last time this entity was modified in the cache
1982
1995
  * lastModificationApp:
1983
1996
  * idTokenClaims: Object containing claims parsed from ID token
@@ -2006,24 +2019,6 @@ var AccountEntity = /** @class */ (function () {
2006
2019
  localAccountId: this.localAccountId
2007
2020
  });
2008
2021
  };
2009
- /**
2010
- * returns the type of the cache (in this case account)
2011
- */
2012
- AccountEntity.prototype.generateType = function () {
2013
- switch (this.authorityType) {
2014
- case exports.CacheAccountType.ADFS_ACCOUNT_TYPE:
2015
- return exports.CacheType.ADFS;
2016
- case exports.CacheAccountType.MSAV1_ACCOUNT_TYPE:
2017
- return exports.CacheType.MSA;
2018
- case exports.CacheAccountType.MSSTS_ACCOUNT_TYPE:
2019
- return exports.CacheType.MSSTS;
2020
- case exports.CacheAccountType.GENERIC_ACCOUNT_TYPE:
2021
- return exports.CacheType.GENERIC;
2022
- default: {
2023
- throw ClientAuthError.createUnexpectedAccountTypeError();
2024
- }
2025
- }
2026
- };
2027
2022
  /**
2028
2023
  * Returns the AccountInfo interface for this account.
2029
2024
  */
@@ -2036,7 +2031,8 @@ var AccountEntity = /** @class */ (function () {
2036
2031
  localAccountId: this.localAccountId,
2037
2032
  name: this.name,
2038
2033
  idTokenClaims: this.idTokenClaims,
2039
- nativeAccountId: this.nativeAccountId
2034
+ nativeAccountId: this.nativeAccountId,
2035
+ authorityType: this.authorityType
2040
2036
  };
2041
2037
  };
2042
2038
  /**
@@ -2052,76 +2048,73 @@ var AccountEntity = /** @class */ (function () {
2052
2048
  return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
2053
2049
  };
2054
2050
  /**
2055
- * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
2056
- * @param clientInfo
2051
+ * Build Account cache from account properties.
2052
+ * @param accountDetails
2057
2053
  * @param authority
2058
- * @param idToken
2059
- * @param policy
2060
2054
  */
2061
- AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {
2062
- var _a, _b, _c, _d, _e, _f;
2055
+ AccountEntity.createAccount = function (accountDetails, authority) {
2063
2056
  var account = new AccountEntity();
2064
- account.authorityType = exports.CacheAccountType.MSSTS_ACCOUNT_TYPE;
2065
- account.clientInfo = clientInfo;
2066
- account.homeAccountId = homeAccountId;
2067
- account.nativeAccountId = nativeAccountId;
2068
- var env = environment || (authority && authority.getPreferredCache());
2057
+ if (authority.authorityType === exports.AuthorityType.Adfs) {
2058
+ account.authorityType = exports.CacheAccountType.ADFS_ACCOUNT_TYPE;
2059
+ }
2060
+ else if (authority.protocolMode === exports.ProtocolMode.AAD) {
2061
+ account.authorityType = exports.CacheAccountType.MSSTS_ACCOUNT_TYPE;
2062
+ }
2063
+ else {
2064
+ account.authorityType = exports.CacheAccountType.GENERIC_ACCOUNT_TYPE;
2065
+ }
2066
+ account.clientInfo = accountDetails.clientInfo;
2067
+ account.homeAccountId = accountDetails.homeAccountId;
2068
+ account.nativeAccountId = accountDetails.nativeAccountId;
2069
+ var env = accountDetails.environment || (authority && authority.getPreferredCache());
2069
2070
  if (!env) {
2070
2071
  throw ClientAuthError.createInvalidCacheEnvironmentError();
2071
2072
  }
2072
2073
  account.environment = env;
2073
2074
  // non AAD scenarios can have empty realm
2074
- account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || Constants.EMPTY_STRING;
2075
- if (idToken) {
2076
- account.idTokenClaims = idToken.claims;
2077
- // How do you account for MSA CID here?
2078
- account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) || Constants.EMPTY_STRING;
2079
- /*
2080
- * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
2081
- * In most cases it will contain a single email. This field should not be relied upon if a custom
2082
- * policy is configured to return more than 1 email.
2083
- */
2084
- var preferredUsername = (_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username;
2085
- var email = ((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] : null;
2086
- account.username = preferredUsername || email || Constants.EMPTY_STRING;
2087
- account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;
2075
+ account.realm = accountDetails.idTokenClaims.tid || Constants.EMPTY_STRING;
2076
+ account.idTokenClaims = accountDetails.idTokenClaims;
2077
+ // How do you account for MSA CID here?
2078
+ account.localAccountId = accountDetails.idTokenClaims.oid || accountDetails.idTokenClaims.sub || Constants.EMPTY_STRING;
2079
+ /*
2080
+ * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
2081
+ * In most cases it will contain a single email. This field should not be relied upon if a custom
2082
+ * policy is configured to return more than 1 email.
2083
+ */
2084
+ if (account.authorityType === exports.CacheAccountType.MSSTS_ACCOUNT_TYPE) {
2085
+ var preferredUsername = accountDetails.idTokenClaims.preferred_username;
2086
+ var email = (accountDetails.idTokenClaims.emails) ? accountDetails.idTokenClaims.emails[0] : null;
2087
+ account.username = preferredUsername || email || "";
2088
2088
  }
2089
- account.cloudGraphHostName = cloudGraphHostName;
2090
- account.msGraphHost = msGraphHost;
2089
+ else {
2090
+ account.username = accountDetails.idTokenClaims.upn || "";
2091
+ }
2092
+ account.name = accountDetails.idTokenClaims.name;
2093
+ account.cloudGraphHostName = accountDetails.cloudGraphHostName;
2094
+ account.msGraphHost = accountDetails.msGraphHost;
2091
2095
  return account;
2092
2096
  };
2093
2097
  /**
2094
- * Builds non-AAD/ADFS account.
2095
- * @param authority
2096
- * @param idToken
2098
+ * Creates an account object from AccountInfo
2099
+ * @param accountInfo
2100
+ * @param cloudGraphHostName
2101
+ * @param msGraphHost
2102
+ * @returns AccountEntity
2097
2103
  */
2098
- AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {
2099
- var _a, _b, _c, _d;
2104
+ AccountEntity.createFromAccountInfo = function (accountInfo, cloudGraphHostName, msGraphHost) {
2100
2105
  var account = new AccountEntity();
2101
- account.authorityType = (authority &&
2102
- authority.authorityType === exports.AuthorityType.Adfs) ? exports.CacheAccountType.ADFS_ACCOUNT_TYPE : exports.CacheAccountType.GENERIC_ACCOUNT_TYPE;
2103
- account.homeAccountId = homeAccountId;
2104
- // non AAD scenarios can have empty realm
2105
- account.realm = Constants.EMPTY_STRING;
2106
- var env = environment || authority && authority.getPreferredCache();
2107
- if (!env) {
2108
- throw ClientAuthError.createInvalidCacheEnvironmentError();
2109
- }
2110
- if (idToken) {
2111
- // How do you account for MSA CID here?
2112
- account.localAccountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.oid) || ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.sub) || Constants.EMPTY_STRING;
2113
- // upn claim for most ADFS scenarios
2114
- account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) || Constants.EMPTY_STRING;
2115
- account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) || Constants.EMPTY_STRING;
2116
- account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;
2117
- }
2118
- account.environment = env;
2106
+ account.authorityType =
2107
+ accountInfo.authorityType || exports.CacheAccountType.GENERIC_ACCOUNT_TYPE;
2108
+ account.homeAccountId = accountInfo.homeAccountId;
2109
+ account.localAccountId = accountInfo.localAccountId;
2110
+ account.nativeAccountId = accountInfo.nativeAccountId;
2111
+ account.realm = accountInfo.tenantId;
2112
+ account.environment = accountInfo.environment;
2113
+ account.username = accountInfo.username;
2114
+ account.name = accountInfo.name;
2115
+ account.idTokenClaims = accountInfo.idTokenClaims;
2119
2116
  account.cloudGraphHostName = cloudGraphHostName;
2120
2117
  account.msGraphHost = msGraphHost;
2121
- /*
2122
- * add uniqueName to claims
2123
- * account.name = idToken.claims.uniqueName;
2124
- */
2125
2118
  return account;
2126
2119
  };
2127
2120
  /**
@@ -2129,9 +2122,8 @@ var AccountEntity = /** @class */ (function () {
2129
2122
  * @param serverClientInfo
2130
2123
  * @param authType
2131
2124
  */
2132
- AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idToken) {
2133
- var _a;
2134
- var accountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.sub) ? idToken.claims.sub : Constants.EMPTY_STRING;
2125
+ AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idTokenClaims) {
2126
+ var accountId = (idTokenClaims === null || idTokenClaims === void 0 ? void 0 : idTokenClaims.sub) ? idTokenClaims.sub : Constants.EMPTY_STRING;
2135
2127
  // since ADFS does not have tid and does not set client_info
2136
2128
  if (authType === exports.AuthorityType.Adfs || authType === exports.AuthorityType.Dsts) {
2137
2129
  return accountId;
@@ -5473,7 +5465,7 @@ var ResponseHandler = /** @class */ (function () {
5473
5465
  }
5474
5466
  }
5475
5467
  // generate homeAccountId
5476
- this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);
5468
+ this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims);
5477
5469
  if (!!authCodePayload && !!authCodePayload.state) {
5478
5470
  requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);
5479
5471
  }
@@ -5538,7 +5530,13 @@ var ResponseHandler = /** @class */ (function () {
5538
5530
  var cachedAccount;
5539
5531
  if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {
5540
5532
  cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
5541
- cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority, authCodePayload);
5533
+ cachedAccount = AccountEntity.createAccount({
5534
+ homeAccountId: this.homeAccountIdentifier,
5535
+ idTokenClaims: idTokenObj.claims,
5536
+ clientInfo: serverTokenResponse.client_info || Constants.EMPTY_STRING,
5537
+ cloudGraphHostName: authCodePayload === null || authCodePayload === void 0 ? void 0 : authCodePayload.cloud_graph_host_name,
5538
+ msGraphHost: authCodePayload === null || authCodePayload === void 0 ? void 0 : authCodePayload.msgraph_host,
5539
+ }, authority);
5542
5540
  }
5543
5541
  // AccessToken
5544
5542
  var cachedAccessToken = null;
@@ -5570,29 +5568,6 @@ var ResponseHandler = /** @class */ (function () {
5570
5568
  }
5571
5569
  return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
5572
5570
  };
5573
- /**
5574
- * Generate Account
5575
- * @param serverTokenResponse
5576
- * @param idToken
5577
- * @param authority
5578
- */
5579
- ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, authCodePayload) {
5580
- var authorityType = authority.authorityType;
5581
- var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;
5582
- var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;
5583
- // ADFS does not require client_info in the response
5584
- if (authorityType === exports.AuthorityType.Adfs) {
5585
- this.logger.verbose("Authority type is ADFS, creating ADFS account");
5586
- return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
5587
- }
5588
- // This fallback applies to B2C as well as they fall under an AAD account type.
5589
- if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === "AAD") {
5590
- throw ClientAuthError.createClientInfoEmptyError();
5591
- }
5592
- return serverTokenResponse.client_info ?
5593
- AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :
5594
- AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
5595
- };
5596
5571
  /**
5597
5572
  * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
5598
5573
  *
@@ -7338,19 +7313,6 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
7338
7313
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
7339
7314
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
7340
7315
 
7341
- /*
7342
- * Copyright (c) Microsoft Corporation. All rights reserved.
7343
- * Licensed under the MIT License.
7344
- */
7345
- /**
7346
- * Protocol modes supported by MSAL.
7347
- */
7348
- exports.ProtocolMode = void 0;
7349
- (function (ProtocolMode) {
7350
- ProtocolMode["AAD"] = "AAD";
7351
- ProtocolMode["OIDC"] = "OIDC";
7352
- })(exports.ProtocolMode || (exports.ProtocolMode = {}));
7353
-
7354
7316
  /*
7355
7317
  * Copyright (c) Microsoft Corporation. All rights reserved.
7356
7318
  * Licensed under the MIT License.