@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.
- package/dist/account/AccountInfo.mjs +1 -1
- package/dist/account/AuthToken.d.ts +6 -0
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +22 -2
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.d.ts +4 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/account/TokenClaims.mjs.map +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/cache/CacheManager.d.ts +7 -6
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +13 -11
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +2 -2
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +13 -13
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +16 -5
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.mjs +1 -1
- package/dist/client/SilentFlowClient.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/error/AuthError.d.ts +5 -0
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.d.ts +5 -0
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +7 -2
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +1 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +4 -3
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +1 -1
- package/dist/error/PlatformBrokerError.d.ts +16 -0
- package/dist/error/PlatformBrokerError.d.ts.map +1 -0
- package/dist/error/PlatformBrokerError.mjs +48 -0
- package/dist/error/PlatformBrokerError.mjs.map +1 -0
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-common.d.ts +1 -0
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/index-browser.mjs +2 -1
- package/dist/index-browser.mjs.map +1 -1
- package/dist/index-node.mjs +2 -1
- package/dist/index-node.mjs.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/RequestThumbprint.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +5 -5
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/lib/index-browser.cjs +3 -2
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-D8Iaiqq3.js → index-node-BF0Vz18w.js} +471 -399
- package/lib/index-node-BF0Vz18w.js.map +1 -0
- package/lib/index-node.cjs +3 -2
- package/lib/index-node.cjs.map +1 -1
- package/lib/index.cjs +3 -2
- package/lib/index.cjs.map +1 -1
- package/lib/types/account/AuthToken.d.ts +6 -0
- package/lib/types/account/AuthToken.d.ts.map +1 -1
- package/lib/types/account/TokenClaims.d.ts +4 -0
- package/lib/types/account/TokenClaims.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +7 -6
- package/lib/types/cache/CacheManager.d.ts.map +1 -1
- package/lib/types/cache/entities/AccountEntity.d.ts +2 -2
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/lib/types/cache/interface/ICacheManager.d.ts +16 -5
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/lib/types/error/AuthError.d.ts +5 -0
- package/lib/types/error/AuthError.d.ts.map +1 -1
- package/lib/types/error/ClientAuthError.d.ts +5 -0
- package/lib/types/error/ClientAuthError.d.ts.map +1 -1
- package/lib/types/error/ClientAuthErrorCodes.d.ts +1 -0
- package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/error/PlatformBrokerError.d.ts +16 -0
- package/lib/types/error/PlatformBrokerError.d.ts.map +1 -0
- package/lib/types/exports-common.d.ts +1 -0
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/response/ResponseHandler.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account/AuthToken.ts +23 -0
- package/src/account/TokenClaims.ts +4 -0
- package/src/cache/CacheManager.ts +23 -13
- package/src/cache/entities/AccountEntity.ts +13 -13
- package/src/cache/interface/ICacheManager.ts +23 -4
- package/src/error/AuthError.ts +6 -0
- package/src/error/ClientAuthError.ts +6 -0
- package/src/error/ClientAuthErrorCodes.ts +1 -0
- package/src/error/PlatformBrokerError.ts +66 -0
- package/src/exports-common.ts +1 -0
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +8 -3
- 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(
|
|
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
|
|
package/src/error/AuthError.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/exports-common.ts
CHANGED
|
@@ -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 {
|
package/src/packageMetadata.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
|
580
|
+
AccountEntity.getAccountInfo(cacheRecord.account),
|
|
576
581
|
undefined, // tenantProfile optional
|
|
577
582
|
idTokenClaims,
|
|
578
583
|
cacheRecord.idToken?.secret
|