@azure/msal-common 15.13.0 → 15.13.2

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 (146) hide show
  1. package/dist/account/AccountInfo.mjs +1 -1
  2. package/dist/account/AuthToken.d.ts +6 -0
  3. package/dist/account/AuthToken.d.ts.map +1 -1
  4. package/dist/account/AuthToken.mjs +22 -2
  5. package/dist/account/AuthToken.mjs.map +1 -1
  6. package/dist/account/CcsCredential.mjs +1 -1
  7. package/dist/account/ClientInfo.mjs +1 -1
  8. package/dist/account/TokenClaims.d.ts +4 -0
  9. package/dist/account/TokenClaims.d.ts.map +1 -1
  10. package/dist/account/TokenClaims.mjs +1 -1
  11. package/dist/account/TokenClaims.mjs.map +1 -1
  12. package/dist/authority/Authority.mjs +1 -1
  13. package/dist/authority/AuthorityFactory.mjs +1 -1
  14. package/dist/authority/AuthorityMetadata.mjs +1 -1
  15. package/dist/authority/AuthorityOptions.mjs +1 -1
  16. package/dist/authority/AuthorityType.mjs +1 -1
  17. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  18. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  19. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  20. package/dist/authority/ProtocolMode.mjs +1 -1
  21. package/dist/authority/RegionDiscovery.mjs +1 -1
  22. package/dist/cache/CacheManager.d.ts +7 -6
  23. package/dist/cache/CacheManager.d.ts.map +1 -1
  24. package/dist/cache/CacheManager.mjs +13 -11
  25. package/dist/cache/CacheManager.mjs.map +1 -1
  26. package/dist/cache/entities/AccountEntity.d.ts +2 -2
  27. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  28. package/dist/cache/entities/AccountEntity.mjs +13 -13
  29. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  30. package/dist/cache/interface/ICacheManager.d.ts +16 -5
  31. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  32. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  33. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  34. package/dist/client/AuthorizationCodeClient.mjs +1 -1
  35. package/dist/client/BaseClient.mjs +1 -1
  36. package/dist/client/RefreshTokenClient.mjs +1 -1
  37. package/dist/client/SilentFlowClient.mjs +1 -1
  38. package/dist/config/ClientConfiguration.mjs +1 -1
  39. package/dist/constants/AADServerParamKeys.mjs +1 -1
  40. package/dist/crypto/ICrypto.mjs +1 -1
  41. package/dist/crypto/JoseHeader.mjs +1 -1
  42. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  43. package/dist/error/AuthError.d.ts +5 -0
  44. package/dist/error/AuthError.d.ts.map +1 -1
  45. package/dist/error/AuthError.mjs +1 -1
  46. package/dist/error/AuthError.mjs.map +1 -1
  47. package/dist/error/AuthErrorCodes.mjs +1 -1
  48. package/dist/error/CacheError.mjs +1 -1
  49. package/dist/error/CacheErrorCodes.mjs +1 -1
  50. package/dist/error/ClientAuthError.d.ts +5 -0
  51. package/dist/error/ClientAuthError.d.ts.map +1 -1
  52. package/dist/error/ClientAuthError.mjs +7 -2
  53. package/dist/error/ClientAuthError.mjs.map +1 -1
  54. package/dist/error/ClientAuthErrorCodes.d.ts +1 -0
  55. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
  56. package/dist/error/ClientAuthErrorCodes.mjs +4 -3
  57. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  58. package/dist/error/ClientConfigurationError.mjs +1 -1
  59. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  60. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  61. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  62. package/dist/error/JoseHeaderError.mjs +1 -1
  63. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  64. package/dist/error/NetworkError.mjs +1 -1
  65. package/dist/error/PlatformBrokerError.d.ts +16 -0
  66. package/dist/error/PlatformBrokerError.d.ts.map +1 -0
  67. package/dist/error/PlatformBrokerError.mjs +48 -0
  68. package/dist/error/PlatformBrokerError.mjs.map +1 -0
  69. package/dist/error/ServerError.mjs +1 -1
  70. package/dist/exports-common.d.ts +1 -0
  71. package/dist/exports-common.d.ts.map +1 -1
  72. package/dist/index-browser.mjs +2 -1
  73. package/dist/index-browser.mjs.map +1 -1
  74. package/dist/index-node.mjs +2 -1
  75. package/dist/index-node.mjs.map +1 -1
  76. package/dist/index.mjs +2 -1
  77. package/dist/index.mjs.map +1 -1
  78. package/dist/logger/Logger.mjs +1 -1
  79. package/dist/network/INetworkModule.mjs +1 -1
  80. package/dist/network/RequestThumbprint.mjs +1 -1
  81. package/dist/network/ThrottlingUtils.mjs +1 -1
  82. package/dist/packageMetadata.d.ts +1 -1
  83. package/dist/packageMetadata.mjs +2 -2
  84. package/dist/protocol/Authorize.mjs +1 -1
  85. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  86. package/dist/request/RequestParameterBuilder.mjs +1 -1
  87. package/dist/request/ScopeSet.mjs +1 -1
  88. package/dist/response/ResponseHandler.d.ts.map +1 -1
  89. package/dist/response/ResponseHandler.mjs +5 -5
  90. package/dist/response/ResponseHandler.mjs.map +1 -1
  91. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  92. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  93. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  94. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  95. package/dist/url/UrlString.mjs +1 -1
  96. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  97. package/dist/utils/Constants.mjs +1 -1
  98. package/dist/utils/FunctionWrappers.mjs +1 -1
  99. package/dist/utils/ProtocolUtils.mjs +1 -1
  100. package/dist/utils/StringUtils.mjs +1 -1
  101. package/dist/utils/TimeUtils.mjs +1 -1
  102. package/dist/utils/UrlUtils.mjs +1 -1
  103. package/lib/index-browser.cjs +3 -2
  104. package/lib/index-browser.cjs.map +1 -1
  105. package/lib/{index-node-D8Iaiqq3.js → index-node-BF0Vz18w.js} +471 -399
  106. package/lib/index-node-BF0Vz18w.js.map +1 -0
  107. package/lib/index-node.cjs +3 -2
  108. package/lib/index-node.cjs.map +1 -1
  109. package/lib/index.cjs +3 -2
  110. package/lib/index.cjs.map +1 -1
  111. package/lib/types/account/AuthToken.d.ts +6 -0
  112. package/lib/types/account/AuthToken.d.ts.map +1 -1
  113. package/lib/types/account/TokenClaims.d.ts +4 -0
  114. package/lib/types/account/TokenClaims.d.ts.map +1 -1
  115. package/lib/types/cache/CacheManager.d.ts +7 -6
  116. package/lib/types/cache/CacheManager.d.ts.map +1 -1
  117. package/lib/types/cache/entities/AccountEntity.d.ts +2 -2
  118. package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
  119. package/lib/types/cache/interface/ICacheManager.d.ts +16 -5
  120. package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
  121. package/lib/types/error/AuthError.d.ts +5 -0
  122. package/lib/types/error/AuthError.d.ts.map +1 -1
  123. package/lib/types/error/ClientAuthError.d.ts +5 -0
  124. package/lib/types/error/ClientAuthError.d.ts.map +1 -1
  125. package/lib/types/error/ClientAuthErrorCodes.d.ts +1 -0
  126. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
  127. package/lib/types/error/PlatformBrokerError.d.ts +16 -0
  128. package/lib/types/error/PlatformBrokerError.d.ts.map +1 -0
  129. package/lib/types/exports-common.d.ts +1 -0
  130. package/lib/types/exports-common.d.ts.map +1 -1
  131. package/lib/types/packageMetadata.d.ts +1 -1
  132. package/lib/types/response/ResponseHandler.d.ts.map +1 -1
  133. package/package.json +1 -1
  134. package/src/account/AuthToken.ts +23 -0
  135. package/src/account/TokenClaims.ts +4 -0
  136. package/src/cache/CacheManager.ts +23 -13
  137. package/src/cache/entities/AccountEntity.ts +13 -13
  138. package/src/cache/interface/ICacheManager.ts +23 -4
  139. package/src/error/AuthError.ts +6 -0
  140. package/src/error/ClientAuthError.ts +6 -0
  141. package/src/error/ClientAuthErrorCodes.ts +1 -0
  142. package/src/error/PlatformBrokerError.ts +66 -0
  143. package/src/exports-common.ts +1 -0
  144. package/src/packageMetadata.ts +1 -1
  145. package/src/response/ResponseHandler.ts +8 -3
  146. package/lib/index-node-D8Iaiqq3.js.map +0 -1
@@ -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
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { Constants } from "../utils/Constants.js";
7
7
  import * as AuthErrorCodes from "./AuthErrorCodes.js";
8
+ import type { PlatformBrokerError } from "./PlatformBrokerError.js";
8
9
  export { AuthErrorCodes };
9
10
 
10
11
  export const AuthErrorMessages = {
@@ -52,6 +53,11 @@ export class AuthError extends Error {
52
53
  */
53
54
  correlationId: string;
54
55
 
56
+ /**
57
+ * Default PlatformBrokerError from MsalNodeRuntime when broker is enabled
58
+ */
59
+ platformBrokerError?: PlatformBrokerError;
60
+
55
61
  constructor(errorCode?: string, errorMessage?: string, suberror?: string) {
56
62
  const errorString = errorMessage
57
63
  ? `${errorCode}: ${errorMessage}`
@@ -91,6 +91,8 @@ export const ClientAuthErrorMessages = {
91
91
  "This method has not been implemented",
92
92
  [ClientAuthErrorCodes.nestedAppAuthBridgeDisabled]:
93
93
  "The nested app auth bridge is disabled",
94
+ [ClientAuthErrorCodes.platformBrokerError]:
95
+ "An error occurred in the native broker. See the platformBrokerError property for details.",
94
96
  };
95
97
 
96
98
  /**
@@ -314,6 +316,10 @@ export const ClientAuthErrorMessage = {
314
316
  ClientAuthErrorCodes.nestedAppAuthBridgeDisabled
315
317
  ],
316
318
  },
319
+ platformBrokerError: {
320
+ code: ClientAuthErrorCodes.platformBrokerError,
321
+ desc: ClientAuthErrorMessages[ClientAuthErrorCodes.platformBrokerError],
322
+ },
317
323
  };
318
324
 
319
325
  /**
@@ -50,3 +50,4 @@ export const userCanceled = "user_canceled";
50
50
  export const missingTenantIdError = "missing_tenant_id_error";
51
51
  export const methodNotImplemented = "method_not_implemented";
52
52
  export const nestedAppAuthBridgeDisabled = "nested_app_auth_bridge_disabled";
53
+ export const platformBrokerError = "platform_broker_error";
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { AuthError } from "./AuthError.js";
7
+
8
+ /**
9
+ * Converts a numeric tag to a string representation
10
+ * @param tag - The numeric tag to convert
11
+ * @returns The string representation of the tag
12
+ */
13
+ function tagToString(tag: number): string {
14
+ if (tag === 0) {
15
+ return "UNTAG";
16
+ }
17
+
18
+ const tagSymbolSpace =
19
+ "abcdefghijklmnopqrstuvwxyz0123456789****************************";
20
+ let tagBuffer = "*****";
21
+
22
+ const chars = [
23
+ tagSymbolSpace[(tag >> 24) & 0x3f],
24
+ tagSymbolSpace[(tag >> 18) & 0x3f],
25
+ tagSymbolSpace[(tag >> 12) & 0x3f],
26
+ tagSymbolSpace[(tag >> 6) & 0x3f],
27
+ tagSymbolSpace[(tag >> 0) & 0x3f],
28
+ ];
29
+
30
+ tagBuffer = chars.join("");
31
+
32
+ return tagBuffer;
33
+ }
34
+
35
+ /**
36
+ * Error class for MSAL Runtime errors that preserves detailed broker information
37
+ */
38
+ export class PlatformBrokerError extends AuthError {
39
+ /**
40
+ * Numeric error code from MSAL Runtime
41
+ */
42
+ public statusCode: number;
43
+
44
+ /**
45
+ * Error tag from MSAL Runtime
46
+ */
47
+ public tag: string;
48
+
49
+ constructor(
50
+ errorStatus: string,
51
+ errorContext: string,
52
+ errorCode: number,
53
+ errorTag: number
54
+ ) {
55
+ const tagString = tagToString(errorTag);
56
+ const enhancedErrorContext = errorContext
57
+ ? `${errorContext} (Error Code: ${errorCode}, Tag: ${tagString})`
58
+ : `(Error Code: ${errorCode}, Tag: ${tagString})`;
59
+
60
+ super(errorStatus, enhancedErrorContext);
61
+ this.name = "PlatformBrokerError";
62
+ this.statusCode = errorCode;
63
+ this.tag = tagString;
64
+ Object.setPrototypeOf(this, PlatformBrokerError.prototype);
65
+ }
66
+ }
@@ -140,6 +140,7 @@ export {
140
140
  AuthErrorCodes,
141
141
  createAuthError,
142
142
  } from "./error/AuthError.js";
143
+ export { PlatformBrokerError } from "./error/PlatformBrokerError.js";
143
144
  export { ServerError } from "./error/ServerError.js";
144
145
  export { NetworkError, createNetworkError } from "./error/NetworkError.js";
145
146
  export {
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-common";
3
- export const version = "15.13.0";
3
+ export const version = "15.13.2";
@@ -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