@azure/msal-common 13.3.0 → 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 (79) 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.d.ts.map +1 -1
  18. package/dist/cache/CacheManager.js +13 -4
  19. package/dist/cache/CacheManager.js.map +1 -1
  20. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  21. package/dist/cache/entities/AccountEntity.d.ts +20 -17
  22. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  23. package/dist/cache/entities/AccountEntity.js +59 -79
  24. package/dist/cache/entities/AccountEntity.js.map +1 -1
  25. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  26. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  27. package/dist/cache/entities/CacheRecord.js +1 -1
  28. package/dist/cache/entities/CredentialEntity.js +1 -1
  29. package/dist/cache/entities/IdTokenEntity.js +1 -1
  30. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  31. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  32. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  33. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  34. package/dist/client/AuthorizationCodeClient.js +2 -2
  35. package/dist/client/BaseClient.js +1 -1
  36. package/dist/client/ClientCredentialClient.js +1 -1
  37. package/dist/client/DeviceCodeClient.js +1 -1
  38. package/dist/client/OnBehalfOfClient.js +1 -1
  39. package/dist/client/RefreshTokenClient.js +1 -1
  40. package/dist/client/SilentFlowClient.js +1 -1
  41. package/dist/client/UsernamePasswordClient.js +1 -1
  42. package/dist/config/ClientConfiguration.js +1 -1
  43. package/dist/crypto/ICrypto.js +1 -1
  44. package/dist/crypto/JoseHeader.js +1 -1
  45. package/dist/crypto/PopTokenGenerator.js +1 -1
  46. package/dist/error/AuthError.js +1 -1
  47. package/dist/error/ClientAuthError.js +1 -1
  48. package/dist/error/ClientConfigurationError.js +1 -1
  49. package/dist/error/InteractionRequiredAuthError.js +1 -1
  50. package/dist/error/JoseHeaderError.js +1 -1
  51. package/dist/error/ServerError.js +1 -1
  52. package/dist/index.cjs.js +90 -119
  53. package/dist/index.cjs.js.map +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/logger/Logger.js +1 -1
  56. package/dist/network/INetworkModule.js +1 -1
  57. package/dist/network/NetworkManager.js +1 -1
  58. package/dist/network/ThrottlingUtils.js +1 -1
  59. package/dist/packageMetadata.d.ts +1 -1
  60. package/dist/packageMetadata.js +2 -2
  61. package/dist/packageMetadata.js.map +1 -1
  62. package/dist/request/AuthenticationHeaderParser.js +1 -1
  63. package/dist/request/RequestParameterBuilder.js +1 -1
  64. package/dist/request/RequestValidator.js +1 -1
  65. package/dist/request/ScopeSet.js +1 -1
  66. package/dist/response/ResponseHandler.d.ts +0 -7
  67. package/dist/response/ResponseHandler.d.ts.map +1 -1
  68. package/dist/response/ResponseHandler.js +9 -27
  69. package/dist/response/ResponseHandler.js.map +1 -1
  70. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  71. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  72. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  73. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  74. package/dist/url/UrlString.js +1 -1
  75. package/dist/utils/Constants.js +1 -1
  76. package/dist/utils/ProtocolUtils.js +1 -1
  77. package/dist/utils/StringUtils.js +1 -1
  78. package/dist/utils/TimeUtils.js +1 -1
  79. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
1
  import { Authority } from "../../authority/Authority";
2
- import { AuthToken } from "../../account/AuthToken";
3
2
  import { ICrypto } from "../../crypto/ICrypto";
4
3
  import { AccountInfo } from "../../account/AccountInfo";
5
4
  import { AuthorityType } from "../../authority/AuthorityType";
@@ -20,8 +19,8 @@ import { TokenClaims } from "../../account/TokenClaims";
20
19
  * localAccountId: Original tenant-specific accountID, usually used for legacy cases
21
20
  * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt
22
21
  * authorityType: Accounts authority type as a string
23
- * name: Full name for the account, including given name and family name,
24
22
  * clientInfo: Full base64 encoded client info received from ESTS
23
+ * name: Full name for the account, including given name and family name
25
24
  * lastModificationTime: last time this entity was modified in the cache
26
25
  * lastModificationApp:
27
26
  * idTokenClaims: Object containing claims parsed from ID token
@@ -35,8 +34,8 @@ export declare class AccountEntity {
35
34
  localAccountId: string;
36
35
  username: string;
37
36
  authorityType: string;
38
- name?: string;
39
37
  clientInfo?: string;
38
+ name?: string;
40
39
  lastModificationTime?: string;
41
40
  lastModificationApp?: string;
42
41
  cloudGraphHostName?: string;
@@ -51,10 +50,6 @@ export declare class AccountEntity {
51
50
  * Generate Account Cache Key as per the schema: <home_account_id>-<environment>-<realm*>
52
51
  */
53
52
  generateAccountKey(): string;
54
- /**
55
- * returns the type of the cache (in this case account)
56
- */
57
- generateType(): number;
58
53
  /**
59
54
  * Returns the AccountInfo interface for this account.
60
55
  */
@@ -65,25 +60,33 @@ export declare class AccountEntity {
65
60
  */
66
61
  static generateAccountCacheKey(accountInterface: AccountInfo): string;
67
62
  /**
68
- * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
69
- * @param clientInfo
63
+ * Build Account cache from account properties.
64
+ * @param accountDetails
70
65
  * @param authority
71
- * @param idToken
72
- * @param policy
73
66
  */
74
- static createAccount(clientInfo: string, homeAccountId: string, idToken: AuthToken, authority?: Authority, cloudGraphHostName?: string, msGraphHost?: string, environment?: string, nativeAccountId?: string): AccountEntity;
67
+ static createAccount(accountDetails: {
68
+ homeAccountId: string;
69
+ idTokenClaims: TokenClaims;
70
+ clientInfo?: string;
71
+ cloudGraphHostName?: string;
72
+ msGraphHost?: string;
73
+ environment?: string;
74
+ nativeAccountId?: string;
75
+ }, authority: Authority): AccountEntity;
75
76
  /**
76
- * Builds non-AAD/ADFS account.
77
- * @param authority
78
- * @param idToken
77
+ * Creates an account object from AccountInfo
78
+ * @param accountInfo
79
+ * @param cloudGraphHostName
80
+ * @param msGraphHost
81
+ * @returns AccountEntity
79
82
  */
80
- static createGenericAccount(homeAccountId: string, idToken: AuthToken, authority?: Authority, cloudGraphHostName?: string, msGraphHost?: string, environment?: string): AccountEntity;
83
+ static createFromAccountInfo(accountInfo: AccountInfo, cloudGraphHostName?: string, msGraphHost?: string): AccountEntity;
81
84
  /**
82
85
  * Generate HomeAccountId from server response
83
86
  * @param serverClientInfo
84
87
  * @param authType
85
88
  */
86
- static generateHomeAccountId(serverClientInfo: string, authType: AuthorityType, logger: Logger, cryptoObj: ICrypto, idToken?: AuthToken): string;
89
+ static generateHomeAccountId(serverClientInfo: string, authType: AuthorityType, logger: Logger, cryptoObj: ICrypto, idTokenClaims?: TokenClaims): string;
87
90
  /**
88
91
  * Validates an entity: checks for all expected params
89
92
  * @param entity
@@ -1 +1 @@
1
- {"version":3,"file":"AccountEntity.d.ts","sourceRoot":"","sources":["../../../src/cache/entities/AccountEntity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO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SAAS,EAAE,OAAO,EAClB,aAAa,CAAC,EAAE,WAAW,GAC5B,MAAM;IAwBT;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAgB/C;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO;CAuB1H"}
@@ -1,10 +1,11 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
- import { Separators, CacheAccountType, CacheType, Constants } from '../../utils/Constants.js';
3
+ import { Separators, CacheAccountType, Constants } from '../../utils/Constants.js';
4
4
  import { buildClientInfo } from '../../account/ClientInfo.js';
5
5
  import { StringUtils } from '../../utils/StringUtils.js';
6
6
  import { ClientAuthError } from '../../error/ClientAuthError.js';
7
7
  import { AuthorityType } from '../../authority/AuthorityType.js';
8
+ import { ProtocolMode } from '../../authority/ProtocolMode.js';
8
9
 
9
10
  /*
10
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25,8 +26,8 @@ import { AuthorityType } from '../../authority/AuthorityType.js';
25
26
  * localAccountId: Original tenant-specific accountID, usually used for legacy cases
26
27
  * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt
27
28
  * authorityType: Accounts authority type as a string
28
- * name: Full name for the account, including given name and family name,
29
29
  * clientInfo: Full base64 encoded client info received from ESTS
30
+ * name: Full name for the account, including given name and family name
30
31
  * lastModificationTime: last time this entity was modified in the cache
31
32
  * lastModificationApp:
32
33
  * idTokenClaims: Object containing claims parsed from ID token
@@ -55,24 +56,6 @@ var AccountEntity = /** @class */ (function () {
55
56
  localAccountId: this.localAccountId
56
57
  });
57
58
  };
58
- /**
59
- * returns the type of the cache (in this case account)
60
- */
61
- AccountEntity.prototype.generateType = function () {
62
- switch (this.authorityType) {
63
- case CacheAccountType.ADFS_ACCOUNT_TYPE:
64
- return CacheType.ADFS;
65
- case CacheAccountType.MSAV1_ACCOUNT_TYPE:
66
- return CacheType.MSA;
67
- case CacheAccountType.MSSTS_ACCOUNT_TYPE:
68
- return CacheType.MSSTS;
69
- case CacheAccountType.GENERIC_ACCOUNT_TYPE:
70
- return CacheType.GENERIC;
71
- default: {
72
- throw ClientAuthError.createUnexpectedAccountTypeError();
73
- }
74
- }
75
- };
76
59
  /**
77
60
  * Returns the AccountInfo interface for this account.
78
61
  */
@@ -85,7 +68,8 @@ var AccountEntity = /** @class */ (function () {
85
68
  localAccountId: this.localAccountId,
86
69
  name: this.name,
87
70
  idTokenClaims: this.idTokenClaims,
88
- nativeAccountId: this.nativeAccountId
71
+ nativeAccountId: this.nativeAccountId,
72
+ authorityType: this.authorityType
89
73
  };
90
74
  };
91
75
  /**
@@ -101,76 +85,73 @@ var AccountEntity = /** @class */ (function () {
101
85
  return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
102
86
  };
103
87
  /**
104
- * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
105
- * @param clientInfo
88
+ * Build Account cache from account properties.
89
+ * @param accountDetails
106
90
  * @param authority
107
- * @param idToken
108
- * @param policy
109
91
  */
110
- AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {
111
- var _a, _b, _c, _d, _e, _f;
92
+ AccountEntity.createAccount = function (accountDetails, authority) {
112
93
  var account = new AccountEntity();
113
- account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;
114
- account.clientInfo = clientInfo;
115
- account.homeAccountId = homeAccountId;
116
- account.nativeAccountId = nativeAccountId;
117
- var env = environment || (authority && authority.getPreferredCache());
94
+ if (authority.authorityType === AuthorityType.Adfs) {
95
+ account.authorityType = CacheAccountType.ADFS_ACCOUNT_TYPE;
96
+ }
97
+ else if (authority.protocolMode === ProtocolMode.AAD) {
98
+ account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;
99
+ }
100
+ else {
101
+ account.authorityType = CacheAccountType.GENERIC_ACCOUNT_TYPE;
102
+ }
103
+ account.clientInfo = accountDetails.clientInfo;
104
+ account.homeAccountId = accountDetails.homeAccountId;
105
+ account.nativeAccountId = accountDetails.nativeAccountId;
106
+ var env = accountDetails.environment || (authority && authority.getPreferredCache());
118
107
  if (!env) {
119
108
  throw ClientAuthError.createInvalidCacheEnvironmentError();
120
109
  }
121
110
  account.environment = env;
122
111
  // non AAD scenarios can have empty realm
123
- account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || Constants.EMPTY_STRING;
124
- if (idToken) {
125
- account.idTokenClaims = idToken.claims;
126
- // How do you account for MSA CID here?
127
- 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;
128
- /*
129
- * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
130
- * In most cases it will contain a single email. This field should not be relied upon if a custom
131
- * policy is configured to return more than 1 email.
132
- */
133
- var preferredUsername = (_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username;
134
- 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;
135
- account.username = preferredUsername || email || Constants.EMPTY_STRING;
136
- account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;
112
+ account.realm = accountDetails.idTokenClaims.tid || Constants.EMPTY_STRING;
113
+ account.idTokenClaims = accountDetails.idTokenClaims;
114
+ // How do you account for MSA CID here?
115
+ account.localAccountId = accountDetails.idTokenClaims.oid || accountDetails.idTokenClaims.sub || Constants.EMPTY_STRING;
116
+ /*
117
+ * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
118
+ * In most cases it will contain a single email. This field should not be relied upon if a custom
119
+ * policy is configured to return more than 1 email.
120
+ */
121
+ if (account.authorityType === CacheAccountType.MSSTS_ACCOUNT_TYPE) {
122
+ var preferredUsername = accountDetails.idTokenClaims.preferred_username;
123
+ var email = (accountDetails.idTokenClaims.emails) ? accountDetails.idTokenClaims.emails[0] : null;
124
+ account.username = preferredUsername || email || "";
137
125
  }
138
- account.cloudGraphHostName = cloudGraphHostName;
139
- account.msGraphHost = msGraphHost;
126
+ else {
127
+ account.username = accountDetails.idTokenClaims.upn || "";
128
+ }
129
+ account.name = accountDetails.idTokenClaims.name;
130
+ account.cloudGraphHostName = accountDetails.cloudGraphHostName;
131
+ account.msGraphHost = accountDetails.msGraphHost;
140
132
  return account;
141
133
  };
142
134
  /**
143
- * Builds non-AAD/ADFS account.
144
- * @param authority
145
- * @param idToken
135
+ * Creates an account object from AccountInfo
136
+ * @param accountInfo
137
+ * @param cloudGraphHostName
138
+ * @param msGraphHost
139
+ * @returns AccountEntity
146
140
  */
147
- AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {
148
- var _a, _b, _c, _d;
141
+ AccountEntity.createFromAccountInfo = function (accountInfo, cloudGraphHostName, msGraphHost) {
149
142
  var account = new AccountEntity();
150
- account.authorityType = (authority &&
151
- authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;
152
- account.homeAccountId = homeAccountId;
153
- // non AAD scenarios can have empty realm
154
- account.realm = Constants.EMPTY_STRING;
155
- var env = environment || authority && authority.getPreferredCache();
156
- if (!env) {
157
- throw ClientAuthError.createInvalidCacheEnvironmentError();
158
- }
159
- if (idToken) {
160
- // How do you account for MSA CID here?
161
- 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;
162
- // upn claim for most ADFS scenarios
163
- account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) || Constants.EMPTY_STRING;
164
- account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) || Constants.EMPTY_STRING;
165
- account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;
166
- }
167
- account.environment = env;
143
+ account.authorityType =
144
+ accountInfo.authorityType || CacheAccountType.GENERIC_ACCOUNT_TYPE;
145
+ account.homeAccountId = accountInfo.homeAccountId;
146
+ account.localAccountId = accountInfo.localAccountId;
147
+ account.nativeAccountId = accountInfo.nativeAccountId;
148
+ account.realm = accountInfo.tenantId;
149
+ account.environment = accountInfo.environment;
150
+ account.username = accountInfo.username;
151
+ account.name = accountInfo.name;
152
+ account.idTokenClaims = accountInfo.idTokenClaims;
168
153
  account.cloudGraphHostName = cloudGraphHostName;
169
154
  account.msGraphHost = msGraphHost;
170
- /*
171
- * add uniqueName to claims
172
- * account.name = idToken.claims.uniqueName;
173
- */
174
155
  return account;
175
156
  };
176
157
  /**
@@ -178,9 +159,8 @@ var AccountEntity = /** @class */ (function () {
178
159
  * @param serverClientInfo
179
160
  * @param authType
180
161
  */
181
- AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idToken) {
182
- var _a;
183
- 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;
162
+ AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idTokenClaims) {
163
+ var accountId = (idTokenClaims === null || idTokenClaims === void 0 ? void 0 : idTokenClaims.sub) ? idTokenClaims.sub : Constants.EMPTY_STRING;
184
164
  // since ADFS does not have tid and does not set client_info
185
165
  if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {
186
166
  return accountId;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountEntity.js","sources":["../../../src/cache/entities/AccountEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport {\r\n Separators,\r\n CacheAccountType,\r\n CacheType,\r\n Constants,\r\n} from \"../../utils/Constants\";\r\nimport { Authority } from \"../../authority/Authority\";\r\nimport { AuthToken } from \"../../account/AuthToken\";\r\nimport { ICrypto } from \"../../crypto/ICrypto\";\r\nimport { buildClientInfo } from \"../../account/ClientInfo\";\r\nimport { StringUtils } from \"../../utils/StringUtils\";\r\nimport { AccountInfo } from \"../../account/AccountInfo\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\nimport { AuthorityType } from \"../../authority/AuthorityType\";\r\nimport { Logger } from \"../../logger/Logger\";\r\nimport { TokenClaims } from \"../../account/TokenClaims\";\r\n\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: <home_account_id>-<environment>-<realm*>\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * name: Full name for the account, including given name and family name,\r\n * clientInfo: Full base64 encoded client info received from ESTS\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * idTokenClaims: Object containing claims parsed from ID token\r\n * nativeAccountId: Account identifier on the native device\r\n * }\r\n */\r\nexport class AccountEntity {\r\n homeAccountId: string;\r\n environment: string;\r\n realm: string;\r\n localAccountId: string;\r\n username: string;\r\n authorityType: string;\r\n name?: string;\r\n clientInfo?: string;\r\n lastModificationTime?: string;\r\n lastModificationApp?: string;\r\n cloudGraphHostName?: string;\r\n msGraphHost?: string;\r\n idTokenClaims?: TokenClaims;\r\n nativeAccountId?: string;\r\n\r\n /**\r\n * Generate Account Id key component as per the schema: <home_account_id>-<environment>\r\n */\r\n generateAccountId(): string {\r\n const accountId: Array<string> = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate Account Cache Key as per the schema: <home_account_id>-<environment>-<realm*>\r\n */\r\n generateAccountKey(): string {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId\r\n });\r\n }\r\n\r\n /**\r\n * returns the type of the cache (in this case account)\r\n */\r\n generateType(): number {\r\n switch (this.authorityType) {\r\n case CacheAccountType.ADFS_ACCOUNT_TYPE:\r\n return CacheType.ADFS;\r\n case CacheAccountType.MSAV1_ACCOUNT_TYPE:\r\n return CacheType.MSA;\r\n case CacheAccountType.MSSTS_ACCOUNT_TYPE:\r\n return CacheType.MSSTS;\r\n case CacheAccountType.GENERIC_ACCOUNT_TYPE:\r\n return CacheType.GENERIC;\r\n default: {\r\n throw ClientAuthError.createUnexpectedAccountTypeError();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n getAccountInfo(): AccountInfo {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n idTokenClaims: this.idTokenClaims,\r\n nativeAccountId: this.nativeAccountId\r\n };\r\n }\r\n\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n static generateAccountCacheKey(accountInterface: AccountInfo): string {\r\n const accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || Constants.EMPTY_STRING,\r\n accountInterface.tenantId || Constants.EMPTY_STRING,\r\n ];\r\n\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\r\n * @param clientInfo\r\n * @param authority\r\n * @param idToken\r\n * @param policy\r\n */\r\n static createAccount(\r\n clientInfo: string,\r\n homeAccountId: string,\r\n idToken: AuthToken,\r\n authority?: Authority,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string,\r\n environment?: string,\r\n nativeAccountId?: string\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n account.clientInfo = clientInfo;\r\n account.homeAccountId = homeAccountId;\r\n account.nativeAccountId = nativeAccountId;\r\n\r\n const env = environment || (authority && authority.getPreferredCache());\r\n\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm = idToken?.claims?.tid || Constants.EMPTY_STRING;\r\n\r\n if (idToken) {\r\n account.idTokenClaims = idToken.claims;\r\n\r\n // How do you account for MSA CID here?\r\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\r\n\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\r\n * In most cases it will contain a single email. This field should not be relied upon if a custom \r\n * policy is configured to return more than 1 email.\r\n */\r\n const preferredUsername = idToken?.claims?.preferred_username;\r\n const email = (idToken?.claims?.emails) ? idToken.claims.emails[0] : null;\r\n \r\n account.username = preferredUsername || email || Constants.EMPTY_STRING;\r\n account.name = idToken?.claims?.name;\r\n }\r\n\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Builds non-AAD/ADFS account.\r\n * @param authority\r\n * @param idToken\r\n */\r\n static createGenericAccount(\r\n homeAccountId: string,\r\n idToken: AuthToken,\r\n authority?: Authority,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string,\r\n environment?: string\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n account.authorityType = (\r\n authority &&\r\n authority.authorityType === AuthorityType.Adfs\r\n ) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n \r\n account.homeAccountId = homeAccountId;\r\n // non AAD scenarios can have empty realm\r\n account.realm = Constants.EMPTY_STRING;\r\n\r\n const env = environment || authority && authority.getPreferredCache();\r\n\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n if (idToken) {\r\n // How do you account for MSA CID here?\r\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\r\n // upn claim for most ADFS scenarios\r\n account.username = idToken?.claims?.upn || Constants.EMPTY_STRING;\r\n account.name = idToken?.claims?.name || Constants.EMPTY_STRING;\r\n account.idTokenClaims = idToken?.claims;\r\n }\r\n\r\n account.environment = env;\r\n\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n\r\n /*\r\n * add uniqueName to claims\r\n * account.name = idToken.claims.uniqueName;\r\n */\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n static generateHomeAccountId(\r\n serverClientInfo: string,\r\n authType: AuthorityType,\r\n logger: Logger,\r\n cryptoObj: ICrypto,\r\n idToken?: AuthToken\r\n ): string {\r\n\r\n const accountId = idToken?.claims?.sub ? idToken.claims.sub : Constants.EMPTY_STRING;\r\n\r\n // since ADFS does not have tid and does not set client_info\r\n if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {\r\n return accountId;\r\n }\r\n\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\r\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\r\n return `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`;\r\n }\r\n } catch (e) {}\r\n }\r\n\r\n // default to \"sub\" claim\r\n logger.verbose(\"No client info in response\");\r\n return accountId;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAccountEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\")\r\n );\r\n }\r\n\r\n /**\r\n * Helper function to determine whether 2 accountInfo objects represent the same account\r\n * @param accountA\r\n * @param accountB\r\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\r\n */\r\n static accountInfoIsEqual(accountA: AccountInfo | null, accountB: AccountInfo | null, compareClaims?: boolean): boolean {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n\r\n let claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\r\n if (compareClaims) {\r\n const accountAClaims = (accountA.idTokenClaims || {}) as TokenClaims;\r\n const accountBClaims = (accountB.idTokenClaims || {}) as TokenClaims;\r\n\r\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\r\n claimsMatch = (accountAClaims.iat === accountBClaims.iat) &&\r\n (accountAClaims.nonce === accountBClaims.nonce);\r\n }\r\n\r\n return (accountA.homeAccountId === accountB.homeAccountId) &&\r\n (accountA.localAccountId === accountB.localAccountId) &&\r\n (accountA.username === accountB.username) &&\r\n (accountA.tenantId === accountB.tenantId) &&\r\n (accountA.environment === accountB.environment) &&\r\n (accountA.nativeAccountId === accountB.nativeAccountId) &&\r\n claimsMatch;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAmBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,IAAA,aAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,aAAA,GAAA;KAwRC;AAxQG;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,YAAA;QACI,IAAM,SAAS,GAAkB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;KACvE,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;QACI,OAAO,aAAa,CAAC,uBAAuB,CAAC;YACzC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;AACtC,SAAA,CAAC,CAAC;KACN,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,YAAA;QACI,QAAQ,IAAI,CAAC,aAAa;YACtB,KAAK,gBAAgB,CAAC,iBAAiB;gBACnC,OAAO,SAAS,CAAC,IAAI,CAAC;YAC1B,KAAK,gBAAgB,CAAC,kBAAkB;gBACpC,OAAO,SAAS,CAAC,GAAG,CAAC;YACzB,KAAK,gBAAgB,CAAC,kBAAkB;gBACpC,OAAO,SAAS,CAAC,KAAK,CAAC;YAC3B,KAAK,gBAAgB,CAAC,oBAAoB;gBACtC,OAAO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,KAAK,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC;AACnD,SAAA;QAED,OAAO,CAAC,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,aAAa;AACrD,aAAC,QAAQ,CAAC,cAAc,KAAK,QAAQ,CAAC,cAAc,CAAC;AACrD,aAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACzC,aAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACzC,aAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,CAAC;AAC/C,aAAC,QAAQ,CAAC,eAAe,KAAK,QAAQ,CAAC,eAAe,CAAC;AACvD,YAAA,WAAW,CAAC;KACnB,CAAA;IACL,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"AccountEntity.js","sources":["../../../src/cache/entities/AccountEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport {\r\n Separators,\r\n CacheAccountType,\r\n Constants,\r\n} from \"../../utils/Constants\";\r\nimport { Authority } from \"../../authority/Authority\";\r\nimport { ICrypto } from \"../../crypto/ICrypto\";\r\nimport { buildClientInfo } from \"../../account/ClientInfo\";\r\nimport { StringUtils } from \"../../utils/StringUtils\";\r\nimport { AccountInfo } from \"../../account/AccountInfo\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\nimport { AuthorityType } from \"../../authority/AuthorityType\";\r\nimport { Logger } from \"../../logger/Logger\";\r\nimport { TokenClaims } from \"../../account/TokenClaims\";\r\nimport { ProtocolMode } from \"../../authority/ProtocolMode\";\r\n\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: <home_account_id>-<environment>-<realm*>\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * clientInfo: Full base64 encoded client info received from ESTS\r\n * name: Full name for the account, including given name and family name\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * idTokenClaims: Object containing claims parsed from ID token\r\n * nativeAccountId: Account identifier on the native device\r\n * }\r\n */\r\nexport class AccountEntity {\r\n homeAccountId: string;\r\n environment: string;\r\n realm: string;\r\n localAccountId: string;\r\n username: string;\r\n authorityType: string;\r\n clientInfo?: string;\r\n name?: string;\r\n lastModificationTime?: string;\r\n lastModificationApp?: string;\r\n cloudGraphHostName?: string;\r\n msGraphHost?: string;\r\n idTokenClaims?: TokenClaims;\r\n nativeAccountId?: string;\r\n\r\n /**\r\n * Generate Account Id key component as per the schema: <home_account_id>-<environment>\r\n */\r\n generateAccountId(): string {\r\n const accountId: Array<string> = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate Account Cache Key as per the schema: <home_account_id>-<environment>-<realm*>\r\n */\r\n generateAccountKey(): string {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId\r\n });\r\n }\r\n\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n getAccountInfo(): AccountInfo {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n idTokenClaims: this.idTokenClaims,\r\n nativeAccountId: this.nativeAccountId,\r\n authorityType: this.authorityType\r\n };\r\n }\r\n\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n static generateAccountCacheKey(accountInterface: AccountInfo): string {\r\n const accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || Constants.EMPTY_STRING,\r\n accountInterface.tenantId || Constants.EMPTY_STRING,\r\n ];\r\n\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Build Account cache from account properties.\r\n * @param accountDetails\r\n * @param authority\r\n */\r\n static createAccount(\r\n accountDetails: {\r\n homeAccountId: string,\r\n idTokenClaims: TokenClaims,\r\n clientInfo?: string,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string,\r\n environment?: string,\r\n nativeAccountId?: string\r\n },\r\n authority: Authority\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n if (authority.authorityType === AuthorityType.Adfs) {\r\n account.authorityType = CacheAccountType.ADFS_ACCOUNT_TYPE;\r\n } else if (authority.protocolMode === ProtocolMode.AAD) {\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n } else {\r\n account.authorityType = CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n }\r\n\r\n account.clientInfo = accountDetails.clientInfo;\r\n account.homeAccountId = accountDetails.homeAccountId;\r\n account.nativeAccountId = accountDetails.nativeAccountId;\r\n\r\n const env = accountDetails.environment || (authority && authority.getPreferredCache());\r\n\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm = accountDetails.idTokenClaims.tid || Constants.EMPTY_STRING;\r\n\r\n account.idTokenClaims = accountDetails.idTokenClaims;\r\n\r\n // How do you account for MSA CID here?\r\n account.localAccountId = accountDetails.idTokenClaims.oid || accountDetails.idTokenClaims.sub || Constants.EMPTY_STRING;\r\n\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\r\n * In most cases it will contain a single email. This field should not be relied upon if a custom \r\n * policy is configured to return more than 1 email.\r\n */\r\n if (account.authorityType === CacheAccountType.MSSTS_ACCOUNT_TYPE) {\r\n const preferredUsername = accountDetails.idTokenClaims.preferred_username;\r\n const email = (accountDetails.idTokenClaims.emails) ? accountDetails.idTokenClaims.emails[0] : null;\r\n \r\n account.username = preferredUsername || email || \"\";\r\n } else {\r\n account.username = accountDetails.idTokenClaims.upn || \"\";\r\n }\r\n account.name = accountDetails.idTokenClaims.name;\r\n\r\n account.cloudGraphHostName = accountDetails.cloudGraphHostName;\r\n account.msGraphHost = accountDetails.msGraphHost;\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Creates an account object from AccountInfo\r\n * @param accountInfo\r\n * @param cloudGraphHostName\r\n * @param msGraphHost\r\n * @returns AccountEntity\r\n */\r\n static createFromAccountInfo(\r\n accountInfo: AccountInfo,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n account.authorityType =\r\n accountInfo.authorityType || CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n account.homeAccountId = accountInfo.homeAccountId;\r\n account.localAccountId = accountInfo.localAccountId;\r\n account.nativeAccountId = accountInfo.nativeAccountId;\r\n \r\n account.realm = accountInfo.tenantId;\r\n account.environment = accountInfo.environment;\r\n\r\n account.username = accountInfo.username;\r\n account.name = accountInfo.name;\r\n account.idTokenClaims = accountInfo.idTokenClaims;\r\n\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n static generateHomeAccountId(\r\n serverClientInfo: string,\r\n authType: AuthorityType,\r\n logger: Logger,\r\n cryptoObj: ICrypto,\r\n idTokenClaims?: TokenClaims\r\n ): string {\r\n\r\n const accountId = idTokenClaims?.sub ? idTokenClaims.sub : Constants.EMPTY_STRING;\r\n\r\n // since ADFS does not have tid and does not set client_info\r\n if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {\r\n return accountId;\r\n }\r\n\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\r\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\r\n return `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`;\r\n }\r\n } catch (e) {}\r\n }\r\n\r\n // default to \"sub\" claim\r\n logger.verbose(\"No client info in response\");\r\n return accountId;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAccountEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\")\r\n );\r\n }\r\n\r\n /**\r\n * Helper function to determine whether 2 accountInfo objects represent the same account\r\n * @param accountA\r\n * @param accountB\r\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\r\n */\r\n static accountInfoIsEqual(accountA: AccountInfo | null, accountB: AccountInfo | null, compareClaims?: boolean): boolean {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n\r\n let claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\r\n if (compareClaims) {\r\n const accountAClaims = (accountA.idTokenClaims || {}) as TokenClaims;\r\n const accountBClaims = (accountB.idTokenClaims || {}) as TokenClaims;\r\n\r\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\r\n claimsMatch = (accountAClaims.iat === accountBClaims.iat) &&\r\n (accountAClaims.nonce === accountBClaims.nonce);\r\n }\r\n\r\n return (accountA.homeAccountId === accountB.homeAccountId) &&\r\n (accountA.localAccountId === accountB.localAccountId) &&\r\n (accountA.username === accountB.username) &&\r\n (accountA.tenantId === accountB.tenantId) &&\r\n (accountA.environment === accountB.environment) &&\r\n (accountA.nativeAccountId === accountB.nativeAccountId) &&\r\n claimsMatch;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;AAGG;AAkBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,IAAA,aAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,aAAA,GAAA;KA4PC;AA5OG;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,YAAA;QACI,IAAM,SAAS,GAAkB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;KACvE,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;QACI,OAAO,aAAa,CAAC,uBAAuB,CAAC;YACzC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;AACtC,SAAA,CAAC,CAAC;KACN,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,cAAc,GAAd,YAAA;QACI,OAAO;YACH,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,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vB,QAAA,IAAI,aAAa,EAAE;YACf,IAAM,cAAc,IAAI,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAgB,CAAC;YACrE,IAAM,cAAc,IAAI,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAgB,CAAC;;YAGrE,WAAW,GAAG,CAAC,cAAc,CAAC,GAAG,KAAK,cAAc,CAAC,GAAG;iBACvD,cAAc,CAAC,KAAK,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC;AACnD,SAAA;QAED,OAAO,CAAC,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,aAAa;AACrD,aAAC,QAAQ,CAAC,cAAc,KAAK,QAAQ,CAAC,cAAc,CAAC;AACrD,aAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACzC,aAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC;AACzC,aAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,CAAC;AAC/C,aAAC,QAAQ,CAAC,eAAe,KAAK,QAAQ,CAAC,eAAe,CAAC;AACvD,YAAA,WAAW,CAAC;KACnB,CAAA;IACL,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { Separators, APP_METADATA } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.js';
4
4
  import { TimeUtils } from '../../utils/TimeUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { CredentialType, CacheType, Separators, Constants, AuthenticationScheme } from '../../utils/Constants.js';
4
4
  import { ClientAuthError } from '../../error/ClientAuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
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 { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
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 { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  import { ThrottlingConstants } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,6 +1,6 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
1
+ /*! @azure/msal-common v13.3.3 2024-06-06 */
2
2
  'use strict';
3
- import { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';
3
+ import { __extends, __awaiter, __assign, __generator, __spreadArrays } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
5
5
  import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
6
6
  import { Separators, AADServerParamKeys, AuthenticationScheme, GrantType, PromptValue, HeaderNames } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
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 { buildClientConfiguration } from '../config/ClientConfiguration.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v13.3.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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.0 2023-08-24 */
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';