@azure/msal-common 15.7.1 → 15.8.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.
- package/dist/account/AccountInfo.d.ts +1 -0
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +1 -1
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -2
- package/dist/authority/AuthorityMetadata.mjs.map +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 +25 -23
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +64 -75
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +1 -0
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts +2 -0
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +12 -12
- 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.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +7 -6
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +4 -4
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +5 -5
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +3 -3
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +2 -2
- 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 +2 -4
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.mjs +2 -2
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.d.ts +8 -1
- package/dist/error/CacheError.d.ts.map +1 -1
- package/dist/error/CacheError.mjs +26 -7
- package/dist/error/CacheError.mjs.map +1 -1
- package/dist/error/CacheErrorCodes.d.ts +2 -2
- package/dist/error/CacheErrorCodes.d.ts.map +1 -1
- package/dist/error/CacheErrorCodes.mjs +4 -4
- package/dist/error/CacheErrorCodes.mjs.map +1 -1
- package/dist/error/ClientAuthError.mjs +2 -2
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.d.ts +0 -5
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +2 -7
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +0 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +2 -3
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +2 -2
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +2 -2
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-common.d.ts +1 -1
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/index-browser.mjs +2 -2
- package/dist/index-node.mjs +2 -2
- package/dist/index.mjs +2 -2
- 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.d.ts +2 -2
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +6 -6
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/RequestParameterBuilder.mjs +2 -2
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +6 -6
- 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.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +7 -7
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -4
- package/dist/utils/Constants.mjs.map +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-B6ITzmFz.js → index-node-BCM1mkg5.js} +115 -183
- package/lib/index-node-BCM1mkg5.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/AccountInfo.d.ts +1 -0
- package/lib/types/account/AccountInfo.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +25 -23
- package/lib/types/cache/CacheManager.d.ts.map +1 -1
- package/lib/types/cache/entities/AccountEntity.d.ts +1 -0
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/lib/types/cache/entities/CredentialEntity.d.ts +2 -0
- package/lib/types/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/lib/types/cache/interface/ICacheManager.d.ts +12 -12
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/lib/types/client/BaseClient.d.ts.map +1 -1
- package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
- package/lib/types/client/SilentFlowClient.d.ts.map +1 -1
- package/lib/types/error/CacheError.d.ts +8 -1
- package/lib/types/error/CacheError.d.ts.map +1 -1
- package/lib/types/error/CacheErrorCodes.d.ts +2 -2
- package/lib/types/error/CacheErrorCodes.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationError.d.ts +0 -5
- package/lib/types/error/ClientConfigurationError.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts +0 -1
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/lib/types/exports-common.d.ts +1 -1
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/network/ThrottlingUtils.d.ts +2 -2
- package/lib/types/network/ThrottlingUtils.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/response/ResponseHandler.d.ts +1 -1
- package/lib/types/response/ResponseHandler.d.ts.map +1 -1
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account/AccountInfo.ts +1 -0
- package/src/cache/CacheManager.ts +129 -98
- package/src/cache/entities/AccountEntity.ts +1 -0
- package/src/cache/entities/CredentialEntity.ts +2 -0
- package/src/cache/interface/ICacheManager.ts +30 -12
- package/src/client/AuthorizationCodeClient.ts +5 -2
- package/src/client/BaseClient.ts +11 -2
- package/src/client/RefreshTokenClient.ts +6 -3
- package/src/client/SilentFlowClient.ts +6 -3
- package/src/error/CacheError.ts +26 -5
- package/src/error/CacheErrorCodes.ts +2 -2
- package/src/error/ClientConfigurationError.ts +0 -8
- package/src/error/ClientConfigurationErrorCodes.ts +0 -1
- package/src/exports-common.ts +5 -1
- package/src/network/ThrottlingUtils.ts +8 -5
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +7 -2
- package/src/telemetry/server/ServerTelemetryManager.ts +14 -6
- package/dist/request/RequestValidator.d.ts +0 -28
- package/dist/request/RequestValidator.d.ts.map +0 -1
- package/dist/request/RequestValidator.mjs +0 -73
- package/dist/request/RequestValidator.mjs.map +0 -1
- package/lib/index-node-B6ITzmFz.js.map +0 -1
- package/lib/types/request/RequestValidator.d.ts +0 -28
- package/lib/types/request/RequestValidator.d.ts.map +0 -1
- package/src/request/RequestValidator.ts +0 -90
package/src/client/BaseClient.ts
CHANGED
|
@@ -187,7 +187,11 @@ export abstract class BaseClient {
|
|
|
187
187
|
options: NetworkRequestOptions,
|
|
188
188
|
correlationId: string
|
|
189
189
|
): Promise<NetworkResponse<T>> {
|
|
190
|
-
ThrottlingUtils.preProcess(
|
|
190
|
+
ThrottlingUtils.preProcess(
|
|
191
|
+
this.cacheManager,
|
|
192
|
+
thumbprint,
|
|
193
|
+
correlationId
|
|
194
|
+
);
|
|
191
195
|
|
|
192
196
|
let response;
|
|
193
197
|
try {
|
|
@@ -244,7 +248,12 @@ export abstract class BaseClient {
|
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
|
|
247
|
-
ThrottlingUtils.postProcess(
|
|
251
|
+
ThrottlingUtils.postProcess(
|
|
252
|
+
this.cacheManager,
|
|
253
|
+
thumbprint,
|
|
254
|
+
response,
|
|
255
|
+
correlationId
|
|
256
|
+
);
|
|
248
257
|
|
|
249
258
|
return response;
|
|
250
259
|
}
|
|
@@ -212,9 +212,9 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
212
212
|
)(
|
|
213
213
|
request.account,
|
|
214
214
|
foci,
|
|
215
|
+
request.correlationId,
|
|
215
216
|
undefined,
|
|
216
|
-
this.performanceClient
|
|
217
|
-
request.correlationId
|
|
217
|
+
this.performanceClient
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
if (!refreshToken) {
|
|
@@ -274,7 +274,10 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
274
274
|
);
|
|
275
275
|
const badRefreshTokenKey =
|
|
276
276
|
generateCredentialKey(refreshToken);
|
|
277
|
-
this.cacheManager.removeRefreshToken(
|
|
277
|
+
this.cacheManager.removeRefreshToken(
|
|
278
|
+
badRefreshTokenKey,
|
|
279
|
+
request.correlationId
|
|
280
|
+
);
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
|
|
@@ -115,14 +115,17 @@ export class SilentFlowClient extends BaseClient {
|
|
|
115
115
|
const environment =
|
|
116
116
|
request.authority || this.authority.getPreferredCache();
|
|
117
117
|
const cacheRecord: CacheRecord = {
|
|
118
|
-
account: this.cacheManager.readAccountFromCache(
|
|
118
|
+
account: this.cacheManager.readAccountFromCache(
|
|
119
|
+
request.account,
|
|
120
|
+
request.correlationId
|
|
121
|
+
),
|
|
119
122
|
accessToken: cachedAccessToken,
|
|
120
123
|
idToken: this.cacheManager.getIdToken(
|
|
121
124
|
request.account,
|
|
125
|
+
request.correlationId,
|
|
122
126
|
tokenKeys,
|
|
123
127
|
requestTenantId,
|
|
124
|
-
this.performanceClient
|
|
125
|
-
request.correlationId
|
|
128
|
+
this.performanceClient
|
|
126
129
|
),
|
|
127
130
|
refreshToken: null,
|
|
128
131
|
appMetadata:
|
package/src/error/CacheError.ts
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { AuthError } from "./AuthError.js";
|
|
6
7
|
import * as CacheErrorCodes from "./CacheErrorCodes.js";
|
|
7
8
|
export { CacheErrorCodes };
|
|
8
9
|
|
|
9
10
|
export const CacheErrorMessages = {
|
|
10
|
-
[CacheErrorCodes.
|
|
11
|
-
|
|
12
|
-
[CacheErrorCodes.cacheUnknownErrorCode]:
|
|
11
|
+
[CacheErrorCodes.cacheQuotaExceeded]: "Exceeded cache storage capacity.",
|
|
12
|
+
[CacheErrorCodes.cacheErrorUnknown]:
|
|
13
13
|
"Unexpected error occurred when using cache storage.",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Error thrown when there is an error with the cache
|
|
18
18
|
*/
|
|
19
|
-
export class CacheError extends
|
|
19
|
+
export class CacheError extends AuthError {
|
|
20
20
|
/**
|
|
21
21
|
* Short string denoting error
|
|
22
22
|
*/
|
|
@@ -32,7 +32,7 @@ export class CacheError extends Error {
|
|
|
32
32
|
errorMessage ||
|
|
33
33
|
(CacheErrorMessages[errorCode]
|
|
34
34
|
? CacheErrorMessages[errorCode]
|
|
35
|
-
: CacheErrorMessages[CacheErrorCodes.
|
|
35
|
+
: CacheErrorMessages[CacheErrorCodes.cacheErrorUnknown]);
|
|
36
36
|
|
|
37
37
|
super(`${errorCode}: ${message}`);
|
|
38
38
|
Object.setPrototypeOf(this, CacheError.prototype);
|
|
@@ -42,3 +42,24 @@ export class CacheError extends Error {
|
|
|
42
42
|
this.errorMessage = message;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to wrap browser errors in a CacheError object
|
|
48
|
+
* @param e
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export function createCacheError(e: unknown): CacheError {
|
|
52
|
+
if (!(e instanceof Error)) {
|
|
53
|
+
return new CacheError(CacheErrorCodes.cacheErrorUnknown);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (
|
|
57
|
+
e.name === "QuotaExceededError" ||
|
|
58
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
59
|
+
e.message.includes("exceeded the quota")
|
|
60
|
+
) {
|
|
61
|
+
return new CacheError(CacheErrorCodes.cacheQuotaExceeded);
|
|
62
|
+
} else {
|
|
63
|
+
return new CacheError(e.name, e.message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
6
|
+
export const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
7
|
+
export const cacheErrorUnknown = "cache_error_unknown";
|
|
@@ -19,8 +19,6 @@ export const ClientConfigurationErrorMessages = {
|
|
|
19
19
|
[ClientConfigurationErrorCodes.urlEmptyError]: "URL was empty or null.",
|
|
20
20
|
[ClientConfigurationErrorCodes.emptyInputScopesError]:
|
|
21
21
|
"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",
|
|
22
|
-
[ClientConfigurationErrorCodes.invalidPromptValue]:
|
|
23
|
-
"Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",
|
|
24
22
|
[ClientConfigurationErrorCodes.invalidClaims]:
|
|
25
23
|
"Given claims parameter must be a stringified JSON object.",
|
|
26
24
|
[ClientConfigurationErrorCodes.tokenRequestEmpty]:
|
|
@@ -94,12 +92,6 @@ export const ClientConfigurationErrorMessage = {
|
|
|
94
92
|
ClientConfigurationErrorCodes.emptyInputScopesError
|
|
95
93
|
],
|
|
96
94
|
},
|
|
97
|
-
invalidPrompt: {
|
|
98
|
-
code: ClientConfigurationErrorCodes.invalidPromptValue,
|
|
99
|
-
desc: ClientConfigurationErrorMessages[
|
|
100
|
-
ClientConfigurationErrorCodes.invalidPromptValue
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
95
|
invalidClaimsRequest: {
|
|
104
96
|
code: ClientConfigurationErrorCodes.invalidClaims,
|
|
105
97
|
desc: ClientConfigurationErrorMessages[
|
|
@@ -9,7 +9,6 @@ export const authorityUriInsecure = "authority_uri_insecure";
|
|
|
9
9
|
export const urlParseError = "url_parse_error";
|
|
10
10
|
export const urlEmptyError = "empty_url_error";
|
|
11
11
|
export const emptyInputScopesError = "empty_input_scopes_error";
|
|
12
|
-
export const invalidPromptValue = "invalid_prompt_value";
|
|
13
12
|
export const invalidClaims = "invalid_claims";
|
|
14
13
|
export const tokenRequestEmpty = "token_request_empty";
|
|
15
14
|
export const logoutRequestEmpty = "logout_request_empty";
|
package/src/exports-common.ts
CHANGED
|
@@ -142,7 +142,11 @@ export {
|
|
|
142
142
|
} from "./error/AuthError.js";
|
|
143
143
|
export { ServerError } from "./error/ServerError.js";
|
|
144
144
|
export { NetworkError, createNetworkError } from "./error/NetworkError.js";
|
|
145
|
-
export {
|
|
145
|
+
export {
|
|
146
|
+
CacheError,
|
|
147
|
+
CacheErrorCodes,
|
|
148
|
+
createCacheError,
|
|
149
|
+
} from "./error/CacheError.js";
|
|
146
150
|
export {
|
|
147
151
|
ClientAuthError,
|
|
148
152
|
ClientAuthErrorMessage,
|
|
@@ -38,14 +38,15 @@ export class ThrottlingUtils {
|
|
|
38
38
|
*/
|
|
39
39
|
static preProcess(
|
|
40
40
|
cacheManager: CacheManager,
|
|
41
|
-
thumbprint: RequestThumbprint
|
|
41
|
+
thumbprint: RequestThumbprint,
|
|
42
|
+
correlationId: string
|
|
42
43
|
): void {
|
|
43
44
|
const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
|
|
44
45
|
const value = cacheManager.getThrottlingCache(key);
|
|
45
46
|
|
|
46
47
|
if (value) {
|
|
47
48
|
if (value.throttleTime < Date.now()) {
|
|
48
|
-
cacheManager.removeItem(key);
|
|
49
|
+
cacheManager.removeItem(key, correlationId);
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
throw new ServerError(
|
|
@@ -65,7 +66,8 @@ export class ThrottlingUtils {
|
|
|
65
66
|
static postProcess(
|
|
66
67
|
cacheManager: CacheManager,
|
|
67
68
|
thumbprint: RequestThumbprint,
|
|
68
|
-
response: NetworkResponse<ServerAuthorizationTokenResponse
|
|
69
|
+
response: NetworkResponse<ServerAuthorizationTokenResponse>,
|
|
70
|
+
correlationId: string
|
|
69
71
|
): void {
|
|
70
72
|
if (
|
|
71
73
|
ThrottlingUtils.checkResponseStatus(response) ||
|
|
@@ -82,7 +84,8 @@ export class ThrottlingUtils {
|
|
|
82
84
|
};
|
|
83
85
|
cacheManager.setThrottlingCache(
|
|
84
86
|
ThrottlingUtils.generateThrottlingStorageKey(thumbprint),
|
|
85
|
-
thumbprintValue
|
|
87
|
+
thumbprintValue,
|
|
88
|
+
correlationId
|
|
86
89
|
);
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -146,6 +149,6 @@ export class ThrottlingUtils {
|
|
|
146
149
|
homeAccountIdentifier
|
|
147
150
|
);
|
|
148
151
|
const key = this.generateThrottlingStorageKey(thumbprint);
|
|
149
|
-
cacheManager.removeItem(key);
|
|
152
|
+
cacheManager.removeItem(key, request.correlationId);
|
|
150
153
|
}
|
|
151
154
|
}
|
package/src/packageMetadata.ts
CHANGED
|
@@ -279,7 +279,10 @@ export class ResponseHandler {
|
|
|
279
279
|
cacheRecord.account
|
|
280
280
|
) {
|
|
281
281
|
const key = cacheRecord.account.generateAccountKey();
|
|
282
|
-
const account = this.cacheStorage.getAccount(
|
|
282
|
+
const account = this.cacheStorage.getAccount(
|
|
283
|
+
key,
|
|
284
|
+
request.correlationId
|
|
285
|
+
);
|
|
283
286
|
if (!account) {
|
|
284
287
|
this.logger.warning(
|
|
285
288
|
"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"
|
|
@@ -369,6 +372,7 @@ export class ResponseHandler {
|
|
|
369
372
|
authority,
|
|
370
373
|
this.homeAccountIdentifier,
|
|
371
374
|
this.cryptoObj.base64Decode,
|
|
375
|
+
request.correlationId,
|
|
372
376
|
idTokenClaims,
|
|
373
377
|
serverTokenResponse.client_info,
|
|
374
378
|
env,
|
|
@@ -610,6 +614,7 @@ export function buildAccountToCache(
|
|
|
610
614
|
authority: Authority,
|
|
611
615
|
homeAccountId: string,
|
|
612
616
|
base64Decode: (input: string) => string,
|
|
617
|
+
correlationId: string,
|
|
613
618
|
idTokenClaims?: TokenClaims,
|
|
614
619
|
clientInfo?: string,
|
|
615
620
|
environment?: string,
|
|
@@ -628,7 +633,7 @@ export function buildAccountToCache(
|
|
|
628
633
|
|
|
629
634
|
let cachedAccount: AccountEntity | null = null;
|
|
630
635
|
if (baseAccountKey) {
|
|
631
|
-
cachedAccount = cacheStorage.getAccount(baseAccountKey);
|
|
636
|
+
cachedAccount = cacheStorage.getAccount(baseAccountKey, correlationId);
|
|
632
637
|
}
|
|
633
638
|
|
|
634
639
|
const baseAccount =
|
|
@@ -204,7 +204,8 @@ export class ServerTelemetryManager {
|
|
|
204
204
|
|
|
205
205
|
this.cacheManager.setServerTelemetry(
|
|
206
206
|
this.telemetryCacheKey,
|
|
207
|
-
lastRequests
|
|
207
|
+
lastRequests,
|
|
208
|
+
this.correlationId
|
|
208
209
|
);
|
|
209
210
|
|
|
210
211
|
return;
|
|
@@ -219,7 +220,8 @@ export class ServerTelemetryManager {
|
|
|
219
220
|
|
|
220
221
|
this.cacheManager.setServerTelemetry(
|
|
221
222
|
this.telemetryCacheKey,
|
|
222
|
-
lastRequests
|
|
223
|
+
lastRequests,
|
|
224
|
+
this.correlationId
|
|
223
225
|
);
|
|
224
226
|
return lastRequests.cacheHits;
|
|
225
227
|
}
|
|
@@ -250,7 +252,10 @@ export class ServerTelemetryManager {
|
|
|
250
252
|
const errorCount = lastRequests.errors.length;
|
|
251
253
|
if (numErrorsFlushed === errorCount) {
|
|
252
254
|
// All errors were sent on last request, clear Telemetry cache
|
|
253
|
-
this.cacheManager.removeItem(
|
|
255
|
+
this.cacheManager.removeItem(
|
|
256
|
+
this.telemetryCacheKey,
|
|
257
|
+
this.correlationId
|
|
258
|
+
);
|
|
254
259
|
} else {
|
|
255
260
|
// Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
|
|
256
261
|
const serverTelemEntity: ServerTelemetryEntity = {
|
|
@@ -263,7 +268,8 @@ export class ServerTelemetryManager {
|
|
|
263
268
|
|
|
264
269
|
this.cacheManager.setServerTelemetry(
|
|
265
270
|
this.telemetryCacheKey,
|
|
266
|
-
serverTelemEntity
|
|
271
|
+
serverTelemEntity,
|
|
272
|
+
this.correlationId
|
|
267
273
|
);
|
|
268
274
|
}
|
|
269
275
|
}
|
|
@@ -351,7 +357,8 @@ export class ServerTelemetryManager {
|
|
|
351
357
|
lastRequests.nativeBrokerErrorCode = errorCode;
|
|
352
358
|
this.cacheManager.setServerTelemetry(
|
|
353
359
|
this.telemetryCacheKey,
|
|
354
|
-
lastRequests
|
|
360
|
+
lastRequests,
|
|
361
|
+
this.correlationId
|
|
355
362
|
);
|
|
356
363
|
}
|
|
357
364
|
|
|
@@ -364,7 +371,8 @@ export class ServerTelemetryManager {
|
|
|
364
371
|
delete lastRequests.nativeBrokerErrorCode;
|
|
365
372
|
this.cacheManager.setServerTelemetry(
|
|
366
373
|
this.telemetryCacheKey,
|
|
367
|
-
lastRequests
|
|
374
|
+
lastRequests,
|
|
375
|
+
this.correlationId
|
|
368
376
|
);
|
|
369
377
|
}
|
|
370
378
|
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates server consumable params from the "request" objects
|
|
3
|
-
*/
|
|
4
|
-
export declare class RequestValidator {
|
|
5
|
-
/**
|
|
6
|
-
* Utility to check if the `redirectUri` in the request is a non-null value
|
|
7
|
-
* @param redirectUri
|
|
8
|
-
*/
|
|
9
|
-
static validateRedirectUri(redirectUri: string): void;
|
|
10
|
-
/**
|
|
11
|
-
* Utility to validate prompt sent by the user in the request
|
|
12
|
-
* @param prompt
|
|
13
|
-
*/
|
|
14
|
-
static validatePrompt(prompt: string): void;
|
|
15
|
-
static validateClaims(claims: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Utility to validate code_challenge and code_challenge_method
|
|
18
|
-
* @param codeChallenge
|
|
19
|
-
* @param codeChallengeMethod
|
|
20
|
-
*/
|
|
21
|
-
static validateCodeChallengeParams(codeChallenge: string, codeChallengeMethod: string): void;
|
|
22
|
-
/**
|
|
23
|
-
* Utility to validate code_challenge_method
|
|
24
|
-
* @param codeChallengeMethod
|
|
25
|
-
*/
|
|
26
|
-
static validateCodeChallengeMethod(codeChallengeMethod: string): void;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=RequestValidator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestValidator.d.ts","sourceRoot":"","sources":["../../src/request/RequestValidator.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,qBAAa,gBAAgB;IACzB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAQrD;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAc3C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAU3C;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAC9B,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,GAC5B,IAAI;IAUP;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI;CAYxE"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { createClientConfigurationError } from '../error/ClientConfigurationError.mjs';
|
|
4
|
-
import { CodeChallengeMethodValues, PromptValue } from '../utils/Constants.mjs';
|
|
5
|
-
import { redirectUriEmpty, invalidPromptValue, invalidClaims, pkceParamsMissing, invalidCodeChallengeMethod } from '../error/ClientConfigurationErrorCodes.mjs';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Validates server consumable params from the "request" objects
|
|
13
|
-
*/
|
|
14
|
-
class RequestValidator {
|
|
15
|
-
/**
|
|
16
|
-
* Utility to check if the `redirectUri` in the request is a non-null value
|
|
17
|
-
* @param redirectUri
|
|
18
|
-
*/
|
|
19
|
-
static validateRedirectUri(redirectUri) {
|
|
20
|
-
if (!redirectUri) {
|
|
21
|
-
throw createClientConfigurationError(redirectUriEmpty);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Utility to validate prompt sent by the user in the request
|
|
26
|
-
* @param prompt
|
|
27
|
-
*/
|
|
28
|
-
static validatePrompt(prompt) {
|
|
29
|
-
const promptValues = [];
|
|
30
|
-
for (const value in PromptValue) {
|
|
31
|
-
promptValues.push(PromptValue[value]);
|
|
32
|
-
}
|
|
33
|
-
if (promptValues.indexOf(prompt) < 0) {
|
|
34
|
-
throw createClientConfigurationError(invalidPromptValue);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
static validateClaims(claims) {
|
|
38
|
-
try {
|
|
39
|
-
JSON.parse(claims);
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
throw createClientConfigurationError(invalidClaims);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Utility to validate code_challenge and code_challenge_method
|
|
47
|
-
* @param codeChallenge
|
|
48
|
-
* @param codeChallengeMethod
|
|
49
|
-
*/
|
|
50
|
-
static validateCodeChallengeParams(codeChallenge, codeChallengeMethod) {
|
|
51
|
-
if (!codeChallenge || !codeChallengeMethod) {
|
|
52
|
-
throw createClientConfigurationError(pkceParamsMissing);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.validateCodeChallengeMethod(codeChallengeMethod);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Utility to validate code_challenge_method
|
|
60
|
-
* @param codeChallengeMethod
|
|
61
|
-
*/
|
|
62
|
-
static validateCodeChallengeMethod(codeChallengeMethod) {
|
|
63
|
-
if ([
|
|
64
|
-
CodeChallengeMethodValues.PLAIN,
|
|
65
|
-
CodeChallengeMethodValues.S256,
|
|
66
|
-
].indexOf(codeChallengeMethod) < 0) {
|
|
67
|
-
throw createClientConfigurationError(invalidCodeChallengeMethod);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { RequestValidator };
|
|
73
|
-
//# sourceMappingURL=RequestValidator.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestValidator.mjs","sources":["../../src/request/RequestValidator.ts"],"sourcesContent":[null],"names":["ClientConfigurationErrorCodes.redirectUriEmpty","ClientConfigurationErrorCodes.invalidPromptValue","ClientConfigurationErrorCodes.invalidClaims","ClientConfigurationErrorCodes.pkceParamsMissing","ClientConfigurationErrorCodes.invalidCodeChallengeMethod"],"mappings":";;;;;;AAAA;;;AAGG;AAQH;;AAEG;MACU,gBAAgB,CAAA;AACzB;;;AAGG;IACH,OAAO,mBAAmB,CAAC,WAAmB,EAAA;QAC1C,IAAI,CAAC,WAAW,EAAE;AACd,YAAA,MAAM,8BAA8B,CAChCA,gBAA8C,CACjD,CAAC;AACL,SAAA;KACJ;AAED;;;AAGG;IACH,OAAO,cAAc,CAAC,MAAc,EAAA;QAChC,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,QAAA,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE;YAC7B,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACzC,SAAA;QAED,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;AAClC,YAAA,MAAM,8BAA8B,CAChCC,kBAAgD,CACnD,CAAC;AACL,SAAA;KACJ;IAED,OAAO,cAAc,CAAC,MAAc,EAAA;QAChC,IAAI;AACA,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACtB,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;AACR,YAAA,MAAM,8BAA8B,CAChCC,aAA2C,CAC9C,CAAC;AACL,SAAA;KACJ;AAED;;;;AAIG;AACH,IAAA,OAAO,2BAA2B,CAC9B,aAAqB,EACrB,mBAA2B,EAAA;AAE3B,QAAA,IAAI,CAAC,aAAa,IAAI,CAAC,mBAAmB,EAAE;AACxC,YAAA,MAAM,8BAA8B,CAChCC,iBAA+C,CAClD,CAAC;AACL,SAAA;AAAM,aAAA;AACH,YAAA,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,CAAC;AACzD,SAAA;KACJ;AAED;;;AAGG;IACH,OAAO,2BAA2B,CAAC,mBAA2B,EAAA;QAC1D,IACI;AACI,YAAA,yBAAyB,CAAC,KAAK;AAC/B,YAAA,yBAAyB,CAAC,IAAI;AACjC,SAAA,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,EACpC;AACE,YAAA,MAAM,8BAA8B,CAChCC,0BAAwD,CAC3D,CAAC;AACL,SAAA;KACJ;AACJ;;;;"}
|