@azure/msal-common 15.12.0 → 15.13.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 (140) hide show
  1. package/dist/account/AccountInfo.d.ts +3 -0
  2. package/dist/account/AccountInfo.d.ts.map +1 -1
  3. package/dist/account/AccountInfo.mjs +1 -1
  4. package/dist/account/AccountInfo.mjs.map +1 -1
  5. package/dist/account/AuthToken.d.ts +6 -0
  6. package/dist/account/AuthToken.d.ts.map +1 -1
  7. package/dist/account/AuthToken.mjs +22 -2
  8. package/dist/account/AuthToken.mjs.map +1 -1
  9. package/dist/account/CcsCredential.mjs +1 -1
  10. package/dist/account/ClientInfo.d.ts +5 -1
  11. package/dist/account/ClientInfo.d.ts.map +1 -1
  12. package/dist/account/ClientInfo.mjs +1 -1
  13. package/dist/account/ClientInfo.mjs.map +1 -1
  14. package/dist/account/TokenClaims.d.ts +4 -0
  15. package/dist/account/TokenClaims.d.ts.map +1 -1
  16. package/dist/account/TokenClaims.mjs +1 -1
  17. package/dist/account/TokenClaims.mjs.map +1 -1
  18. package/dist/authority/Authority.mjs +1 -1
  19. package/dist/authority/AuthorityFactory.mjs +1 -1
  20. package/dist/authority/AuthorityMetadata.mjs +1 -1
  21. package/dist/authority/AuthorityOptions.mjs +1 -1
  22. package/dist/authority/AuthorityType.mjs +1 -1
  23. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  24. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  25. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  26. package/dist/authority/ProtocolMode.mjs +1 -1
  27. package/dist/authority/RegionDiscovery.mjs +1 -1
  28. package/dist/cache/CacheManager.d.ts +7 -6
  29. package/dist/cache/CacheManager.d.ts.map +1 -1
  30. package/dist/cache/CacheManager.mjs +13 -11
  31. package/dist/cache/CacheManager.mjs.map +1 -1
  32. package/dist/cache/entities/AccountEntity.d.ts +4 -3
  33. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  34. package/dist/cache/entities/AccountEntity.mjs +18 -12
  35. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  36. package/dist/cache/interface/ICacheManager.d.ts +16 -5
  37. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  38. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  39. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  40. package/dist/client/AuthorizationCodeClient.mjs +1 -1
  41. package/dist/client/BaseClient.mjs +1 -1
  42. package/dist/client/RefreshTokenClient.mjs +1 -1
  43. package/dist/client/SilentFlowClient.mjs +1 -1
  44. package/dist/config/ClientConfiguration.mjs +1 -1
  45. package/dist/constants/AADServerParamKeys.mjs +1 -1
  46. package/dist/crypto/ICrypto.mjs +1 -1
  47. package/dist/crypto/JoseHeader.mjs +1 -1
  48. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  49. package/dist/error/AuthError.mjs +1 -1
  50. package/dist/error/AuthErrorCodes.mjs +1 -1
  51. package/dist/error/CacheError.mjs +1 -1
  52. package/dist/error/CacheErrorCodes.mjs +1 -1
  53. package/dist/error/ClientAuthError.mjs +1 -1
  54. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  55. package/dist/error/ClientConfigurationError.mjs +1 -1
  56. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  57. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  58. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  59. package/dist/error/JoseHeaderError.mjs +1 -1
  60. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  61. package/dist/error/NetworkError.mjs +1 -1
  62. package/dist/error/ServerError.mjs +1 -1
  63. package/dist/index-browser.mjs +1 -1
  64. package/dist/index-node.mjs +1 -1
  65. package/dist/index.mjs +1 -1
  66. package/dist/logger/Logger.mjs +1 -1
  67. package/dist/network/INetworkModule.mjs +1 -1
  68. package/dist/network/RequestThumbprint.mjs +1 -1
  69. package/dist/network/ThrottlingUtils.mjs +1 -1
  70. package/dist/packageMetadata.d.ts +1 -1
  71. package/dist/packageMetadata.mjs +2 -2
  72. package/dist/protocol/Authorize.mjs +1 -1
  73. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  74. package/dist/request/RequestParameterBuilder.mjs +1 -1
  75. package/dist/request/ScopeSet.mjs +1 -1
  76. package/dist/response/ResponseHandler.d.ts.map +1 -1
  77. package/dist/response/ResponseHandler.mjs +5 -5
  78. package/dist/response/ResponseHandler.mjs.map +1 -1
  79. package/dist/telemetry/performance/IPerformanceClient.d.ts +2 -1
  80. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  81. package/dist/telemetry/performance/PerformanceClient.d.ts +4 -1
  82. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  83. package/dist/telemetry/performance/PerformanceClient.mjs +23 -5
  84. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  85. package/dist/telemetry/performance/PerformanceEvent.d.ts +2 -0
  86. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  87. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  88. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  89. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  90. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  91. package/dist/url/UrlString.mjs +1 -1
  92. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  93. package/dist/utils/Constants.mjs +1 -1
  94. package/dist/utils/FunctionWrappers.mjs +1 -1
  95. package/dist/utils/ProtocolUtils.mjs +1 -1
  96. package/dist/utils/StringUtils.mjs +1 -1
  97. package/dist/utils/TimeUtils.mjs +1 -1
  98. package/dist/utils/UrlUtils.mjs +1 -1
  99. package/lib/index-browser.cjs +23 -5
  100. package/lib/index-browser.cjs.map +1 -1
  101. package/lib/{index-node-C8h2xZEM.js → index-node-DhUjlPuB.js} +406 -378
  102. package/lib/index-node-DhUjlPuB.js.map +1 -0
  103. package/lib/index-node.cjs +2 -2
  104. package/lib/index.cjs +2 -2
  105. package/lib/types/account/AccountInfo.d.ts +3 -0
  106. package/lib/types/account/AccountInfo.d.ts.map +1 -1
  107. package/lib/types/account/AuthToken.d.ts +6 -0
  108. package/lib/types/account/AuthToken.d.ts.map +1 -1
  109. package/lib/types/account/ClientInfo.d.ts +5 -1
  110. package/lib/types/account/ClientInfo.d.ts.map +1 -1
  111. package/lib/types/account/TokenClaims.d.ts +4 -0
  112. package/lib/types/account/TokenClaims.d.ts.map +1 -1
  113. package/lib/types/cache/CacheManager.d.ts +7 -6
  114. package/lib/types/cache/CacheManager.d.ts.map +1 -1
  115. package/lib/types/cache/entities/AccountEntity.d.ts +4 -3
  116. package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
  117. package/lib/types/cache/interface/ICacheManager.d.ts +16 -5
  118. package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
  119. package/lib/types/packageMetadata.d.ts +1 -1
  120. package/lib/types/response/ResponseHandler.d.ts.map +1 -1
  121. package/lib/types/telemetry/performance/IPerformanceClient.d.ts +2 -1
  122. package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  123. package/lib/types/telemetry/performance/PerformanceClient.d.ts +4 -1
  124. package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  125. package/lib/types/telemetry/performance/PerformanceEvent.d.ts +2 -0
  126. package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  127. package/package.json +1 -1
  128. package/src/account/AccountInfo.ts +5 -0
  129. package/src/account/AuthToken.ts +23 -0
  130. package/src/account/ClientInfo.ts +5 -1
  131. package/src/account/TokenClaims.ts +4 -0
  132. package/src/cache/CacheManager.ts +23 -13
  133. package/src/cache/entities/AccountEntity.ts +20 -12
  134. package/src/cache/interface/ICacheManager.ts +23 -4
  135. package/src/packageMetadata.ts +1 -1
  136. package/src/response/ResponseHandler.ts +8 -3
  137. package/src/telemetry/performance/IPerformanceClient.ts +3 -1
  138. package/src/telemetry/performance/PerformanceClient.ts +29 -3
  139. package/src/telemetry/performance/PerformanceEvent.ts +4 -0
  140. package/lib/index-node-C8h2xZEM.js.map +0 -1
@@ -11,6 +11,7 @@ import {
11
11
  AccountInfo,
12
12
  TenantProfile,
13
13
  buildTenantProfile,
14
+ DataBoundary,
14
15
  } from "../../account/AccountInfo.js";
15
16
  import {
16
17
  createClientAuthError,
@@ -64,27 +65,29 @@ export class AccountEntity {
64
65
  nativeAccountId?: string;
65
66
  tenantProfiles?: Array<TenantProfile>;
66
67
  lastUpdatedAt: string;
68
+ dataBoundary?: DataBoundary;
67
69
 
68
70
  /**
69
71
  * Returns the AccountInfo interface for this account.
70
72
  */
71
- getAccountInfo(): AccountInfo {
73
+ static getAccountInfo(accountEntity: AccountEntity): AccountInfo {
72
74
  return {
73
- homeAccountId: this.homeAccountId,
74
- environment: this.environment,
75
- tenantId: this.realm,
76
- username: this.username,
77
- localAccountId: this.localAccountId,
78
- loginHint: this.loginHint,
79
- name: this.name,
80
- nativeAccountId: this.nativeAccountId,
81
- authorityType: this.authorityType,
75
+ homeAccountId: accountEntity.homeAccountId,
76
+ environment: accountEntity.environment,
77
+ tenantId: accountEntity.realm,
78
+ username: accountEntity.username,
79
+ localAccountId: accountEntity.localAccountId,
80
+ loginHint: accountEntity.loginHint,
81
+ name: accountEntity.name,
82
+ nativeAccountId: accountEntity.nativeAccountId,
83
+ authorityType: accountEntity.authorityType,
82
84
  // Deserialize tenant profiles array into a Map
83
85
  tenantProfiles: new Map(
84
- (this.tenantProfiles || []).map((tenantProfile) => {
86
+ (accountEntity.tenantProfiles || []).map((tenantProfile) => {
85
87
  return [tenantProfile.tenantId, tenantProfile];
86
88
  })
87
89
  ),
90
+ dataBoundary: accountEntity.dataBoundary,
88
91
  };
89
92
  }
90
93
 
@@ -130,6 +133,10 @@ export class AccountEntity {
130
133
  accountDetails.clientInfo,
131
134
  base64Decode
132
135
  );
136
+ if (clientInfo.xms_tdbr) {
137
+ account.dataBoundary =
138
+ clientInfo.xms_tdbr === "EU" ? "EU" : "None";
139
+ }
133
140
  }
134
141
 
135
142
  account.clientInfo = accountDetails.clientInfo;
@@ -227,6 +234,7 @@ export class AccountEntity {
227
234
  account.tenantProfiles = Array.from(
228
235
  accountInfo.tenantProfiles?.values() || []
229
236
  );
237
+ account.dataBoundary = accountInfo.dataBoundary;
230
238
 
231
239
  return account;
232
240
  }
@@ -273,7 +281,7 @@ export class AccountEntity {
273
281
  * Validates an entity: checks for all expected params
274
282
  * @param entity
275
283
  */
276
- static isAccountEntity(entity: object): boolean {
284
+ static isAccountEntity(entity: object): entity is AccountEntity {
277
285
  if (!entity) {
278
286
  return false;
279
287
  }
@@ -26,8 +26,14 @@ export interface ICacheManager {
26
26
  /**
27
27
  * set account entity in the platform cache
28
28
  * @param account
29
+ * @param correlationId
30
+ * @param kmsi
29
31
  */
30
- setAccount(account: AccountEntity, correlationId: string): Promise<void>;
32
+ setAccount(
33
+ account: AccountEntity,
34
+ correlationId: string,
35
+ kmsi: boolean
36
+ ): Promise<void>;
31
37
 
32
38
  /**
33
39
  * fetch the idToken entity from the platform cache
@@ -41,10 +47,13 @@ export interface ICacheManager {
41
47
  /**
42
48
  * set idToken entity to the platform cache
43
49
  * @param idToken
50
+ * @param correlationId
51
+ * @param kmsi
44
52
  */
45
53
  setIdTokenCredential(
46
54
  idToken: IdTokenEntity,
47
- correlationId: string
55
+ correlationId: string,
56
+ kmsi: boolean
48
57
  ): Promise<void>;
49
58
 
50
59
  /**
@@ -59,10 +68,13 @@ export interface ICacheManager {
59
68
  /**
60
69
  * set idToken entity to the platform cache
61
70
  * @param accessToken
71
+ * @param correlationId
72
+ * @param kmsi
62
73
  */
63
74
  setAccessTokenCredential(
64
75
  accessToken: AccessTokenEntity,
65
- correlationId: string
76
+ correlationId: string,
77
+ kmsi: boolean
66
78
  ): Promise<void>;
67
79
 
68
80
  /**
@@ -77,10 +89,13 @@ export interface ICacheManager {
77
89
  /**
78
90
  * set idToken entity to the platform cache
79
91
  * @param refreshToken
92
+ * @param correlationId
93
+ * @param kmsi
80
94
  */
81
95
  setRefreshTokenCredential(
82
96
  refreshToken: RefreshTokenEntity,
83
- correlationId: string
97
+ correlationId: string,
98
+ kmsi: boolean
84
99
  ): Promise<void>;
85
100
 
86
101
  /**
@@ -172,10 +187,14 @@ export interface ICacheManager {
172
187
  /**
173
188
  * saves a cache record
174
189
  * @param cacheRecord
190
+ * @param correlationId
191
+ * @param kmsi
192
+ * @param storeInCache
175
193
  */
176
194
  saveCacheRecord(
177
195
  cacheRecord: CacheRecord,
178
196
  correlationId: string,
197
+ kmsi: boolean,
179
198
  storeInCache?: StoreInCache
180
199
  ): Promise<void>;
181
200
 
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-common";
3
- export const version = "15.12.0";
3
+ export const version = "15.13.1";
@@ -40,7 +40,11 @@ import { AuthorizationCodePayload } from "./AuthorizationCodePayload.js";
40
40
  import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
41
41
  import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
42
42
  import { PerformanceEvents } from "../telemetry/performance/PerformanceEvent.js";
43
- import { checkMaxAge, extractTokenClaims } from "../account/AuthToken.js";
43
+ import {
44
+ checkMaxAge,
45
+ extractTokenClaims,
46
+ isKmsi,
47
+ } from "../account/AuthToken.js";
44
48
  import {
45
49
  TokenClaims,
46
50
  getTenantIdFromIdTokenClaims,
@@ -279,7 +283,7 @@ export class ResponseHandler {
279
283
  cacheRecord.account
280
284
  ) {
281
285
  const key = this.cacheStorage.generateAccountKey(
282
- cacheRecord.account.getAccountInfo()
286
+ AccountEntity.getAccountInfo(cacheRecord.account)
283
287
  );
284
288
  const account = this.cacheStorage.getAccount(
285
289
  key,
@@ -305,6 +309,7 @@ export class ResponseHandler {
305
309
  await this.cacheStorage.saveCacheRecord(
306
310
  cacheRecord,
307
311
  request.correlationId,
312
+ isKmsi(idTokenClaims || {}),
308
313
  request.storeInCache
309
314
  );
310
315
  } finally {
@@ -572,7 +577,7 @@ export class ResponseHandler {
572
577
 
573
578
  const accountInfo: AccountInfo | null = cacheRecord.account
574
579
  ? updateAccountTenantProfileData(
575
- cacheRecord.account.getAccountInfo(),
580
+ AccountEntity.getAccountInfo(cacheRecord.account),
576
581
  undefined, // tenantProfile optional
577
582
  idTokenClaims,
578
583
  cacheRecord.idToken?.secret
@@ -5,13 +5,15 @@
5
5
 
6
6
  import { PerformanceEvent } from "./PerformanceEvent.js";
7
7
  import { IPerformanceMeasurement } from "./IPerformanceMeasurement.js";
8
+ import { AccountInfo } from "../../account/AccountInfo.js";
8
9
 
9
10
  export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void;
10
11
 
11
12
  export type InProgressPerformanceEvent = {
12
13
  end: (
13
14
  event?: Partial<PerformanceEvent>,
14
- error?: unknown
15
+ error?: unknown,
16
+ account?: AccountInfo
15
17
  ) => PerformanceEvent | null;
16
18
  discard: () => void;
17
19
  add: (fields: { [key: string]: {} | undefined }) => void;
@@ -26,6 +26,7 @@ import { AuthError } from "../../error/AuthError.js";
26
26
  import { CacheError } from "../../error/CacheError.js";
27
27
  import { ServerError } from "../../error/ServerError.js";
28
28
  import { InteractionRequiredAuthError } from "../../error/InteractionRequiredAuthError.js";
29
+ import { AccountInfo } from "../../account/AccountInfo.js";
29
30
 
30
31
  export interface PreQueueEvent {
31
32
  name: PerformanceEvents;
@@ -264,6 +265,22 @@ export function compactStackLine(line: string): string {
264
265
  return line.trimStart();
265
266
  }
266
267
 
268
+ export function getAccountType(
269
+ account?: AccountInfo
270
+ ): "AAD" | "MSA" | "B2C" | undefined {
271
+ const idTokenClaims = account?.idTokenClaims;
272
+ if (idTokenClaims?.tfp || idTokenClaims?.acr) {
273
+ return "B2C";
274
+ }
275
+
276
+ if (!idTokenClaims?.tid) {
277
+ return undefined;
278
+ } else if (idTokenClaims?.tid === "9188040d-6c67-4c5b-b112-36a304b66dad") {
279
+ return "MSA";
280
+ }
281
+ return "AAD";
282
+ }
283
+
267
284
  export abstract class PerformanceClient implements IPerformanceClient {
268
285
  protected authority: string;
269
286
  protected libraryName: string;
@@ -562,7 +579,8 @@ export abstract class PerformanceClient implements IPerformanceClient {
562
579
  return {
563
580
  end: (
564
581
  event?: Partial<PerformanceEvent>,
565
- error?: unknown
582
+ error?: unknown,
583
+ account?: AccountInfo
566
584
  ): PerformanceEvent | null => {
567
585
  return this.endMeasurement(
568
586
  {
@@ -571,7 +589,8 @@ export abstract class PerformanceClient implements IPerformanceClient {
571
589
  // Properties set when event ends
572
590
  ...event,
573
591
  },
574
- error
592
+ error,
593
+ account
575
594
  );
576
595
  },
577
596
  discard: () => {
@@ -599,11 +618,13 @@ export abstract class PerformanceClient implements IPerformanceClient {
599
618
  *
600
619
  * @param {PerformanceEvent} event
601
620
  * @param {unknown} error
621
+ * @param {AccountInfo?} account
602
622
  * @returns {(PerformanceEvent | null)}
603
623
  */
604
624
  endMeasurement(
605
625
  event: PerformanceEvent,
606
- error?: unknown
626
+ error?: unknown,
627
+ account?: AccountInfo
607
628
  ): PerformanceEvent | null {
608
629
  const rootEvent: PerformanceEvent | undefined =
609
630
  this.eventsByCorrelationId.get(event.correlationId);
@@ -691,6 +712,11 @@ export abstract class PerformanceClient implements IPerformanceClient {
691
712
  incompleteSubsCount,
692
713
  context,
693
714
  };
715
+ if (account) {
716
+ finalEvent.accountType = getAccountType(account);
717
+ finalEvent.dataBoundary = account.dataBoundary;
718
+ }
719
+
694
720
  this.truncateIntegralFields(finalEvent);
695
721
  this.emitEvents([finalEvent], event.correlationId);
696
722
 
@@ -3,6 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { DataBoundary } from "../../account/AccountInfo.js";
7
+
6
8
  /**
7
9
  * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
8
10
  *
@@ -912,6 +914,8 @@ export type PerformanceEvent = {
912
914
  sameClientIdInstanceCount?: number;
913
915
 
914
916
  navigateCallbackResult?: boolean;
917
+
918
+ dataBoundary?: DataBoundary;
915
919
  };
916
920
 
917
921
  export type PerformanceEventContext = {