@azure/msal-common 15.7.1 → 15.8.0
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.mjs +3 -3
- 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.mjs +2 -2
- package/dist/error/ClientConfigurationErrorCodes.mjs +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/RequestValidator.mjs +1 -1
- 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-2PsHlOld.js} +112 -110
- package/lib/index-node-2PsHlOld.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/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/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/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/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/lib/index-node-B6ITzmFz.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v15.
|
|
1
|
+
/*! @azure/msal-common v15.8.0 2025-07-01 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -234,7 +234,6 @@ const AuthorityMetadataSource = {
|
|
|
234
234
|
};
|
|
235
235
|
const SERVER_TELEM_CONSTANTS = {
|
|
236
236
|
SCHEMA_VERSION: 5,
|
|
237
|
-
MAX_CUR_HEADER_BYTES: 80,
|
|
238
237
|
MAX_LAST_HEADER_BYTES: 330,
|
|
239
238
|
MAX_CACHED_ERRORS: 50,
|
|
240
239
|
CACHE_KEY: "server-telemetry",
|
|
@@ -289,9 +288,7 @@ const RegionDiscoverySources = {
|
|
|
289
288
|
* Region Discovery Outcomes
|
|
290
289
|
*/
|
|
291
290
|
const RegionDiscoveryOutcomes = {
|
|
292
|
-
CONFIGURED_MATCHES_DETECTED: "1",
|
|
293
291
|
CONFIGURED_NO_AUTO_DETECTION: "2",
|
|
294
|
-
CONFIGURED_NOT_DETECTED: "3",
|
|
295
292
|
AUTO_DETECTION_REQUESTED_SUCCESSFUL: "4",
|
|
296
293
|
AUTO_DETECTION_REQUESTED_FAILED: "5",
|
|
297
294
|
};
|
|
@@ -1371,7 +1368,6 @@ const rawMetdataJSON = {
|
|
|
1371
1368
|
},
|
|
1372
1369
|
},
|
|
1373
1370
|
instanceDiscoveryMetadata: {
|
|
1374
|
-
tenant_discovery_endpoint: "https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",
|
|
1375
1371
|
metadata: [
|
|
1376
1372
|
{
|
|
1377
1373
|
preferred_network: "login.microsoftonline.com",
|
|
@@ -3893,7 +3889,7 @@ class Logger {
|
|
|
3893
3889
|
|
|
3894
3890
|
/* eslint-disable header/header */
|
|
3895
3891
|
const name = "@azure/msal-common";
|
|
3896
|
-
const version = "15.
|
|
3892
|
+
const version = "15.8.0";
|
|
3897
3893
|
|
|
3898
3894
|
/*
|
|
3899
3895
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4466,13 +4462,13 @@ class AccountEntity {
|
|
|
4466
4462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4467
4463
|
* Licensed under the MIT License.
|
|
4468
4464
|
*/
|
|
4469
|
-
const
|
|
4470
|
-
const
|
|
4465
|
+
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4466
|
+
const cacheErrorUnknown = "cache_error_unknown";
|
|
4471
4467
|
|
|
4472
4468
|
var CacheErrorCodes = /*#__PURE__*/Object.freeze({
|
|
4473
4469
|
__proto__: null,
|
|
4474
|
-
|
|
4475
|
-
|
|
4470
|
+
cacheErrorUnknown: cacheErrorUnknown,
|
|
4471
|
+
cacheQuotaExceeded: cacheQuotaExceeded
|
|
4476
4472
|
});
|
|
4477
4473
|
|
|
4478
4474
|
/*
|
|
@@ -4480,24 +4476,42 @@ var CacheErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
4480
4476
|
* Licensed under the MIT License.
|
|
4481
4477
|
*/
|
|
4482
4478
|
const CacheErrorMessages = {
|
|
4483
|
-
[
|
|
4484
|
-
[
|
|
4479
|
+
[cacheQuotaExceeded]: "Exceeded cache storage capacity.",
|
|
4480
|
+
[cacheErrorUnknown]: "Unexpected error occurred when using cache storage.",
|
|
4485
4481
|
};
|
|
4486
4482
|
/**
|
|
4487
4483
|
* Error thrown when there is an error with the cache
|
|
4488
4484
|
*/
|
|
4489
|
-
class CacheError extends
|
|
4485
|
+
class CacheError extends AuthError {
|
|
4490
4486
|
constructor(errorCode, errorMessage) {
|
|
4491
4487
|
const message = errorMessage ||
|
|
4492
4488
|
(CacheErrorMessages[errorCode]
|
|
4493
4489
|
? CacheErrorMessages[errorCode]
|
|
4494
|
-
: CacheErrorMessages[
|
|
4490
|
+
: CacheErrorMessages[cacheErrorUnknown]);
|
|
4495
4491
|
super(`${errorCode}: ${message}`);
|
|
4496
4492
|
Object.setPrototypeOf(this, CacheError.prototype);
|
|
4497
4493
|
this.name = "CacheError";
|
|
4498
4494
|
this.errorCode = errorCode;
|
|
4499
4495
|
this.errorMessage = message;
|
|
4500
4496
|
}
|
|
4497
|
+
}
|
|
4498
|
+
/**
|
|
4499
|
+
* Helper function to wrap browser errors in a CacheError object
|
|
4500
|
+
* @param e
|
|
4501
|
+
* @returns
|
|
4502
|
+
*/
|
|
4503
|
+
function createCacheError(e) {
|
|
4504
|
+
if (!(e instanceof Error)) {
|
|
4505
|
+
return new CacheError(cacheErrorUnknown);
|
|
4506
|
+
}
|
|
4507
|
+
if (e.name === "QuotaExceededError" ||
|
|
4508
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
4509
|
+
e.message.includes("exceeded the quota")) {
|
|
4510
|
+
return new CacheError(cacheQuotaExceeded);
|
|
4511
|
+
}
|
|
4512
|
+
else {
|
|
4513
|
+
return new CacheError(e.name, e.message);
|
|
4514
|
+
}
|
|
4501
4515
|
}
|
|
4502
4516
|
|
|
4503
4517
|
/*
|
|
@@ -4521,14 +4535,14 @@ class CacheManager {
|
|
|
4521
4535
|
* @param accountFilter - (Optional) filter to narrow down the accounts returned
|
|
4522
4536
|
* @returns Array of AccountInfo objects in cache
|
|
4523
4537
|
*/
|
|
4524
|
-
getAllAccounts(accountFilter) {
|
|
4525
|
-
return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter
|
|
4538
|
+
getAllAccounts(accountFilter, correlationId) {
|
|
4539
|
+
return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter, correlationId), correlationId, accountFilter);
|
|
4526
4540
|
}
|
|
4527
4541
|
/**
|
|
4528
4542
|
* Gets first tenanted AccountInfo object found based on provided filters
|
|
4529
4543
|
*/
|
|
4530
|
-
getAccountInfoFilteredBy(accountFilter) {
|
|
4531
|
-
const allAccounts = this.getAllAccounts(accountFilter);
|
|
4544
|
+
getAccountInfoFilteredBy(accountFilter, correlationId) {
|
|
4545
|
+
const allAccounts = this.getAllAccounts(accountFilter, correlationId);
|
|
4532
4546
|
if (allAccounts.length > 1) {
|
|
4533
4547
|
// If one or more accounts are found, prioritize accounts that have an ID token
|
|
4534
4548
|
const sortedAccounts = allAccounts.sort((account) => {
|
|
@@ -4549,8 +4563,8 @@ class CacheManager {
|
|
|
4549
4563
|
* @param accountFilter
|
|
4550
4564
|
* @returns
|
|
4551
4565
|
*/
|
|
4552
|
-
getBaseAccountInfo(accountFilter) {
|
|
4553
|
-
const accountEntities = this.getAccountsFilteredBy(accountFilter);
|
|
4566
|
+
getBaseAccountInfo(accountFilter, correlationId) {
|
|
4567
|
+
const accountEntities = this.getAccountsFilteredBy(accountFilter, correlationId);
|
|
4554
4568
|
if (accountEntities.length > 0) {
|
|
4555
4569
|
return accountEntities[0].getAccountInfo();
|
|
4556
4570
|
}
|
|
@@ -4565,12 +4579,12 @@ class CacheManager {
|
|
|
4565
4579
|
* @param accountFilter
|
|
4566
4580
|
* @returns Array of AccountInfo objects that match account and tenant profile filters
|
|
4567
4581
|
*/
|
|
4568
|
-
buildTenantProfiles(cachedAccounts, accountFilter) {
|
|
4582
|
+
buildTenantProfiles(cachedAccounts, correlationId, accountFilter) {
|
|
4569
4583
|
return cachedAccounts.flatMap((accountEntity) => {
|
|
4570
|
-
return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);
|
|
4584
|
+
return this.getTenantProfilesFromAccountEntity(accountEntity, correlationId, accountFilter?.tenantId, accountFilter);
|
|
4571
4585
|
});
|
|
4572
4586
|
}
|
|
4573
|
-
getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter) {
|
|
4587
|
+
getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter) {
|
|
4574
4588
|
let tenantedAccountInfo = null;
|
|
4575
4589
|
let idTokenClaims;
|
|
4576
4590
|
if (tenantProfileFilter) {
|
|
@@ -4578,7 +4592,7 @@ class CacheManager {
|
|
|
4578
4592
|
return null;
|
|
4579
4593
|
}
|
|
4580
4594
|
}
|
|
4581
|
-
const idToken = this.getIdToken(accountInfo, tokenKeys, tenantProfile.tenantId);
|
|
4595
|
+
const idToken = this.getIdToken(accountInfo, correlationId, tokenKeys, tenantProfile.tenantId);
|
|
4582
4596
|
if (idToken) {
|
|
4583
4597
|
idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);
|
|
4584
4598
|
if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {
|
|
@@ -4590,7 +4604,7 @@ class CacheManager {
|
|
|
4590
4604
|
tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims, idToken?.secret);
|
|
4591
4605
|
return tenantedAccountInfo;
|
|
4592
4606
|
}
|
|
4593
|
-
getTenantProfilesFromAccountEntity(accountEntity, targetTenantId, tenantProfileFilter) {
|
|
4607
|
+
getTenantProfilesFromAccountEntity(accountEntity, correlationId, targetTenantId, tenantProfileFilter) {
|
|
4594
4608
|
const accountInfo = accountEntity.getAccountInfo();
|
|
4595
4609
|
let searchTenantProfiles = accountInfo.tenantProfiles || new Map();
|
|
4596
4610
|
const tokenKeys = this.getTokenKeys();
|
|
@@ -4610,7 +4624,7 @@ class CacheManager {
|
|
|
4610
4624
|
}
|
|
4611
4625
|
const matchingTenantProfiles = [];
|
|
4612
4626
|
searchTenantProfiles.forEach((tenantProfile) => {
|
|
4613
|
-
const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter);
|
|
4627
|
+
const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter);
|
|
4614
4628
|
if (tenantedAccountInfo) {
|
|
4615
4629
|
matchingTenantProfiles.push(tenantedAccountInfo);
|
|
4616
4630
|
}
|
|
@@ -4684,26 +4698,16 @@ class CacheManager {
|
|
|
4684
4698
|
await this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
|
|
4685
4699
|
}
|
|
4686
4700
|
if (!!cacheRecord.appMetadata) {
|
|
4687
|
-
this.setAppMetadata(cacheRecord.appMetadata);
|
|
4701
|
+
this.setAppMetadata(cacheRecord.appMetadata, correlationId);
|
|
4688
4702
|
}
|
|
4689
4703
|
}
|
|
4690
4704
|
catch (e) {
|
|
4691
4705
|
this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
|
|
4692
|
-
if (e instanceof
|
|
4693
|
-
|
|
4694
|
-
if (e.name === "QuotaExceededError" ||
|
|
4695
|
-
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
4696
|
-
e.message.includes("exceeded the quota")) {
|
|
4697
|
-
this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
|
|
4698
|
-
throw new CacheError(cacheQuotaExceededErrorCode);
|
|
4699
|
-
}
|
|
4700
|
-
else {
|
|
4701
|
-
throw new CacheError(e.name, e.message);
|
|
4702
|
-
}
|
|
4706
|
+
if (e instanceof AuthError) {
|
|
4707
|
+
throw e;
|
|
4703
4708
|
}
|
|
4704
4709
|
else {
|
|
4705
|
-
|
|
4706
|
-
throw new CacheError(cacheUnknownErrorCode);
|
|
4710
|
+
throw createCacheError(e);
|
|
4707
4711
|
}
|
|
4708
4712
|
}
|
|
4709
4713
|
}
|
|
@@ -4727,7 +4731,7 @@ class CacheManager {
|
|
|
4727
4731
|
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
|
|
4728
4732
|
return;
|
|
4729
4733
|
}
|
|
4730
|
-
const tokenEntity = this.getAccessTokenCredential(key);
|
|
4734
|
+
const tokenEntity = this.getAccessTokenCredential(key, correlationId);
|
|
4731
4735
|
if (tokenEntity &&
|
|
4732
4736
|
this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {
|
|
4733
4737
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
|
|
@@ -4743,7 +4747,7 @@ class CacheManager {
|
|
|
4743
4747
|
* Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
|
|
4744
4748
|
* @param accountFilter - An object containing Account properties to filter by
|
|
4745
4749
|
*/
|
|
4746
|
-
getAccountsFilteredBy(accountFilter) {
|
|
4750
|
+
getAccountsFilteredBy(accountFilter, correlationId) {
|
|
4747
4751
|
const allAccountKeys = this.getAccountKeys();
|
|
4748
4752
|
const matchingAccounts = [];
|
|
4749
4753
|
allAccountKeys.forEach((cacheKey) => {
|
|
@@ -4751,7 +4755,7 @@ class CacheManager {
|
|
|
4751
4755
|
// Don't parse value if the key doesn't match the account filters
|
|
4752
4756
|
return;
|
|
4753
4757
|
}
|
|
4754
|
-
const entity = this.getAccount(cacheKey,
|
|
4758
|
+
const entity = this.getAccount(cacheKey, correlationId);
|
|
4755
4759
|
// Match base account fields
|
|
4756
4760
|
if (!entity) {
|
|
4757
4761
|
return;
|
|
@@ -4988,12 +4992,12 @@ class CacheManager {
|
|
|
4988
4992
|
* @param account
|
|
4989
4993
|
*/
|
|
4990
4994
|
removeAccount(accountKey, correlationId) {
|
|
4991
|
-
const account = this.getAccount(accountKey,
|
|
4995
|
+
const account = this.getAccount(accountKey, correlationId);
|
|
4992
4996
|
if (!account) {
|
|
4993
4997
|
return;
|
|
4994
4998
|
}
|
|
4995
4999
|
this.removeAccountContext(account, correlationId);
|
|
4996
|
-
this.removeItem(accountKey);
|
|
5000
|
+
this.removeItem(accountKey, correlationId);
|
|
4997
5001
|
}
|
|
4998
5002
|
/**
|
|
4999
5003
|
* Removes credentials associated with the provided account
|
|
@@ -5004,7 +5008,7 @@ class CacheManager {
|
|
|
5004
5008
|
const accountId = account.generateAccountId();
|
|
5005
5009
|
allTokenKeys.idToken.forEach((key) => {
|
|
5006
5010
|
if (key.indexOf(accountId) === 0) {
|
|
5007
|
-
this.removeIdToken(key);
|
|
5011
|
+
this.removeIdToken(key, correlationId);
|
|
5008
5012
|
}
|
|
5009
5013
|
});
|
|
5010
5014
|
allTokenKeys.accessToken.forEach((key) => {
|
|
@@ -5014,45 +5018,43 @@ class CacheManager {
|
|
|
5014
5018
|
});
|
|
5015
5019
|
allTokenKeys.refreshToken.forEach((key) => {
|
|
5016
5020
|
if (key.indexOf(accountId) === 0) {
|
|
5017
|
-
this.removeRefreshToken(key);
|
|
5021
|
+
this.removeRefreshToken(key, correlationId);
|
|
5018
5022
|
}
|
|
5019
5023
|
});
|
|
5020
5024
|
}
|
|
5021
5025
|
/**
|
|
5022
|
-
*
|
|
5023
|
-
* @param
|
|
5026
|
+
* Removes accessToken from the cache
|
|
5027
|
+
* @param key
|
|
5028
|
+
* @param correlationId
|
|
5024
5029
|
*/
|
|
5025
5030
|
removeAccessToken(key, correlationId) {
|
|
5026
|
-
const credential = this.getAccessTokenCredential(key);
|
|
5027
|
-
|
|
5031
|
+
const credential = this.getAccessTokenCredential(key, correlationId);
|
|
5032
|
+
this.removeItem(key, correlationId);
|
|
5033
|
+
this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
|
|
5034
|
+
if (!credential ||
|
|
5035
|
+
credential.credentialType.toLowerCase() !==
|
|
5036
|
+
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase() ||
|
|
5037
|
+
credential.tokenType !== AuthenticationScheme.POP) {
|
|
5038
|
+
// If the credential is not a PoP token, we can return
|
|
5028
5039
|
return;
|
|
5029
5040
|
}
|
|
5030
|
-
this.removeItem(key);
|
|
5031
5041
|
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
void this.cryptoImpl
|
|
5039
|
-
.removeTokenBindingKey(kid)
|
|
5040
|
-
.catch(() => {
|
|
5041
|
-
this.commonLogger.error(`Failed to remove token binding key ${kid}`, correlationId);
|
|
5042
|
-
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
5043
|
-
});
|
|
5044
|
-
}
|
|
5045
|
-
}
|
|
5042
|
+
const kid = credential.keyId;
|
|
5043
|
+
if (kid) {
|
|
5044
|
+
void this.cryptoImpl.removeTokenBindingKey(kid).catch(() => {
|
|
5045
|
+
this.commonLogger.error(`Failed to remove token binding key ${kid}`, correlationId);
|
|
5046
|
+
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
5047
|
+
});
|
|
5046
5048
|
}
|
|
5047
5049
|
}
|
|
5048
5050
|
/**
|
|
5049
5051
|
* Removes all app metadata objects from cache.
|
|
5050
5052
|
*/
|
|
5051
|
-
removeAppMetadata() {
|
|
5053
|
+
removeAppMetadata(correlationId) {
|
|
5052
5054
|
const allCacheKeys = this.getKeys();
|
|
5053
5055
|
allCacheKeys.forEach((cacheKey) => {
|
|
5054
5056
|
if (this.isAppMetadata(cacheKey)) {
|
|
5055
|
-
this.removeItem(cacheKey);
|
|
5057
|
+
this.removeItem(cacheKey, correlationId);
|
|
5056
5058
|
}
|
|
5057
5059
|
});
|
|
5058
5060
|
return true;
|
|
@@ -5061,9 +5063,9 @@ class CacheManager {
|
|
|
5061
5063
|
* Retrieve AccountEntity from cache
|
|
5062
5064
|
* @param account
|
|
5063
5065
|
*/
|
|
5064
|
-
readAccountFromCache(account) {
|
|
5066
|
+
readAccountFromCache(account, correlationId) {
|
|
5065
5067
|
const accountKey = AccountEntity.generateAccountCacheKey(account);
|
|
5066
|
-
return this.getAccount(accountKey,
|
|
5068
|
+
return this.getAccount(accountKey, correlationId);
|
|
5067
5069
|
}
|
|
5068
5070
|
/**
|
|
5069
5071
|
* Retrieve IdTokenEntity from cache
|
|
@@ -5073,7 +5075,7 @@ class CacheManager {
|
|
|
5073
5075
|
* @param performanceClient {?IPerformanceClient}
|
|
5074
5076
|
* @param correlationId {?string}
|
|
5075
5077
|
*/
|
|
5076
|
-
getIdToken(account, tokenKeys, targetRealm, performanceClient
|
|
5078
|
+
getIdToken(account, correlationId, tokenKeys, targetRealm, performanceClient) {
|
|
5077
5079
|
this.commonLogger.trace("CacheManager - getIdToken called");
|
|
5078
5080
|
const idTokenFilter = {
|
|
5079
5081
|
homeAccountId: account.homeAccountId,
|
|
@@ -5082,7 +5084,7 @@ class CacheManager {
|
|
|
5082
5084
|
clientId: this.clientId,
|
|
5083
5085
|
realm: targetRealm,
|
|
5084
5086
|
};
|
|
5085
|
-
const idTokenMap = this.getIdTokensByFilter(idTokenFilter, tokenKeys);
|
|
5087
|
+
const idTokenMap = this.getIdTokensByFilter(idTokenFilter, correlationId, tokenKeys);
|
|
5086
5088
|
const numIdTokens = idTokenMap.size;
|
|
5087
5089
|
if (numIdTokens < 1) {
|
|
5088
5090
|
this.commonLogger.info("CacheManager:getIdToken - No token found");
|
|
@@ -5115,7 +5117,7 @@ class CacheManager {
|
|
|
5115
5117
|
// Multiple tokens for a single tenant profile, remove all and return null
|
|
5116
5118
|
this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them");
|
|
5117
5119
|
tokensToBeRemoved.forEach((idToken, key) => {
|
|
5118
|
-
this.removeIdToken(key);
|
|
5120
|
+
this.removeIdToken(key, correlationId);
|
|
5119
5121
|
});
|
|
5120
5122
|
if (performanceClient && correlationId) {
|
|
5121
5123
|
performanceClient.addFields({ multiMatchedID: idTokenMap.size }, correlationId);
|
|
@@ -5130,7 +5132,7 @@ class CacheManager {
|
|
|
5130
5132
|
* @param filter
|
|
5131
5133
|
* @returns
|
|
5132
5134
|
*/
|
|
5133
|
-
getIdTokensByFilter(filter, tokenKeys) {
|
|
5135
|
+
getIdTokensByFilter(filter, correlationId, tokenKeys) {
|
|
5134
5136
|
const idTokenKeys = (tokenKeys && tokenKeys.idToken) || this.getTokenKeys().idToken;
|
|
5135
5137
|
const idTokens = new Map();
|
|
5136
5138
|
idTokenKeys.forEach((key) => {
|
|
@@ -5140,7 +5142,7 @@ class CacheManager {
|
|
|
5140
5142
|
})) {
|
|
5141
5143
|
return;
|
|
5142
5144
|
}
|
|
5143
|
-
const idToken = this.getIdTokenCredential(key);
|
|
5145
|
+
const idToken = this.getIdTokenCredential(key, correlationId);
|
|
5144
5146
|
if (idToken && this.credentialMatchesFilter(idToken, filter)) {
|
|
5145
5147
|
idTokens.set(key, idToken);
|
|
5146
5148
|
}
|
|
@@ -5169,20 +5171,21 @@ class CacheManager {
|
|
|
5169
5171
|
* Removes idToken from the cache
|
|
5170
5172
|
* @param key
|
|
5171
5173
|
*/
|
|
5172
|
-
removeIdToken(key) {
|
|
5173
|
-
this.removeItem(key);
|
|
5174
|
+
removeIdToken(key, correlationId) {
|
|
5175
|
+
this.removeItem(key, correlationId);
|
|
5174
5176
|
}
|
|
5175
5177
|
/**
|
|
5176
5178
|
* Removes refresh token from the cache
|
|
5177
5179
|
* @param key
|
|
5178
5180
|
*/
|
|
5179
|
-
removeRefreshToken(key) {
|
|
5180
|
-
this.removeItem(key);
|
|
5181
|
+
removeRefreshToken(key, correlationId) {
|
|
5182
|
+
this.removeItem(key, correlationId);
|
|
5181
5183
|
}
|
|
5182
5184
|
/**
|
|
5183
5185
|
* Retrieve AccessTokenEntity from cache
|
|
5184
5186
|
* @param account {AccountInfo}
|
|
5185
5187
|
* @param request {BaseAuthRequest}
|
|
5188
|
+
* @param correlationId {?string}
|
|
5186
5189
|
* @param tokenKeys {?TokenKeys}
|
|
5187
5190
|
* @param performanceClient {?IPerformanceClient}
|
|
5188
5191
|
*/
|
|
@@ -5217,7 +5220,7 @@ class CacheManager {
|
|
|
5217
5220
|
accessTokenKeys.forEach((key) => {
|
|
5218
5221
|
// Validate key
|
|
5219
5222
|
if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
|
|
5220
|
-
const accessToken = this.getAccessTokenCredential(key);
|
|
5223
|
+
const accessToken = this.getAccessTokenCredential(key, correlationId);
|
|
5221
5224
|
// Validate value
|
|
5222
5225
|
if (accessToken &&
|
|
5223
5226
|
this.credentialMatchesFilter(accessToken, accessTokenFilter)) {
|
|
@@ -5287,14 +5290,14 @@ class CacheManager {
|
|
|
5287
5290
|
* @param filter
|
|
5288
5291
|
* @returns
|
|
5289
5292
|
*/
|
|
5290
|
-
getAccessTokensByFilter(filter) {
|
|
5293
|
+
getAccessTokensByFilter(filter, correlationId) {
|
|
5291
5294
|
const tokenKeys = this.getTokenKeys();
|
|
5292
5295
|
const accessTokens = [];
|
|
5293
5296
|
tokenKeys.accessToken.forEach((key) => {
|
|
5294
5297
|
if (!this.accessTokenKeyMatchesFilter(key, filter, true)) {
|
|
5295
5298
|
return;
|
|
5296
5299
|
}
|
|
5297
|
-
const accessToken = this.getAccessTokenCredential(key);
|
|
5300
|
+
const accessToken = this.getAccessTokenCredential(key, correlationId);
|
|
5298
5301
|
if (accessToken &&
|
|
5299
5302
|
this.credentialMatchesFilter(accessToken, filter)) {
|
|
5300
5303
|
accessTokens.push(accessToken);
|
|
@@ -5306,11 +5309,11 @@ class CacheManager {
|
|
|
5306
5309
|
* Helper to retrieve the appropriate refresh token from cache
|
|
5307
5310
|
* @param account {AccountInfo}
|
|
5308
5311
|
* @param familyRT {boolean}
|
|
5312
|
+
* @param correlationId {?string}
|
|
5309
5313
|
* @param tokenKeys {?TokenKeys}
|
|
5310
5314
|
* @param performanceClient {?IPerformanceClient}
|
|
5311
|
-
* @param correlationId {?string}
|
|
5312
5315
|
*/
|
|
5313
|
-
getRefreshToken(account, familyRT, tokenKeys, performanceClient
|
|
5316
|
+
getRefreshToken(account, familyRT, correlationId, tokenKeys, performanceClient) {
|
|
5314
5317
|
this.commonLogger.trace("CacheManager - getRefreshToken called");
|
|
5315
5318
|
const id = familyRT ? THE_FAMILY_ID : undefined;
|
|
5316
5319
|
const refreshTokenFilter = {
|
|
@@ -5326,7 +5329,7 @@ class CacheManager {
|
|
|
5326
5329
|
refreshTokenKeys.forEach((key) => {
|
|
5327
5330
|
// Validate key
|
|
5328
5331
|
if (this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {
|
|
5329
|
-
const refreshToken = this.getRefreshTokenCredential(key);
|
|
5332
|
+
const refreshToken = this.getRefreshTokenCredential(key, correlationId);
|
|
5330
5333
|
// Validate value
|
|
5331
5334
|
if (refreshToken &&
|
|
5332
5335
|
this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {
|
|
@@ -6365,12 +6368,12 @@ class ThrottlingUtils {
|
|
|
6365
6368
|
* @param cacheManager
|
|
6366
6369
|
* @param thumbprint
|
|
6367
6370
|
*/
|
|
6368
|
-
static preProcess(cacheManager, thumbprint) {
|
|
6371
|
+
static preProcess(cacheManager, thumbprint, correlationId) {
|
|
6369
6372
|
const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
|
|
6370
6373
|
const value = cacheManager.getThrottlingCache(key);
|
|
6371
6374
|
if (value) {
|
|
6372
6375
|
if (value.throttleTime < Date.now()) {
|
|
6373
|
-
cacheManager.removeItem(key);
|
|
6376
|
+
cacheManager.removeItem(key, correlationId);
|
|
6374
6377
|
return;
|
|
6375
6378
|
}
|
|
6376
6379
|
throw new ServerError(value.errorCodes?.join(" ") || Constants.EMPTY_STRING, value.errorMessage, value.subError);
|
|
@@ -6382,7 +6385,7 @@ class ThrottlingUtils {
|
|
|
6382
6385
|
* @param thumbprint
|
|
6383
6386
|
* @param response
|
|
6384
6387
|
*/
|
|
6385
|
-
static postProcess(cacheManager, thumbprint, response) {
|
|
6388
|
+
static postProcess(cacheManager, thumbprint, response, correlationId) {
|
|
6386
6389
|
if (ThrottlingUtils.checkResponseStatus(response) ||
|
|
6387
6390
|
ThrottlingUtils.checkResponseForRetryAfter(response)) {
|
|
6388
6391
|
const thumbprintValue = {
|
|
@@ -6392,7 +6395,7 @@ class ThrottlingUtils {
|
|
|
6392
6395
|
errorMessage: response.body.error_description,
|
|
6393
6396
|
subError: response.body.suberror,
|
|
6394
6397
|
};
|
|
6395
|
-
cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
|
|
6398
|
+
cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue, correlationId);
|
|
6396
6399
|
}
|
|
6397
6400
|
}
|
|
6398
6401
|
/**
|
|
@@ -6428,7 +6431,7 @@ class ThrottlingUtils {
|
|
|
6428
6431
|
static removeThrottle(cacheManager, clientId, request, homeAccountIdentifier) {
|
|
6429
6432
|
const thumbprint = getRequestThumbprint(clientId, request, homeAccountIdentifier);
|
|
6430
6433
|
const key = this.generateThrottlingStorageKey(thumbprint);
|
|
6431
|
-
cacheManager.removeItem(key);
|
|
6434
|
+
cacheManager.removeItem(key, request.correlationId);
|
|
6432
6435
|
}
|
|
6433
6436
|
}
|
|
6434
6437
|
|
|
@@ -6541,7 +6544,7 @@ class BaseClient {
|
|
|
6541
6544
|
* @param correlationId - CorrelationId for telemetry
|
|
6542
6545
|
*/
|
|
6543
6546
|
async sendPostRequest(thumbprint, tokenEndpoint, options, correlationId) {
|
|
6544
|
-
ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
|
|
6547
|
+
ThrottlingUtils.preProcess(this.cacheManager, thumbprint, correlationId);
|
|
6545
6548
|
let response;
|
|
6546
6549
|
try {
|
|
6547
6550
|
response = await invokeAsync((this.networkClient.sendPostRequestAsync.bind(this.networkClient)), PerformanceEvents.NetworkClientSendPostRequestAsync, this.logger, this.performanceClient, correlationId)(tokenEndpoint, options);
|
|
@@ -6576,7 +6579,7 @@ class BaseClient {
|
|
|
6576
6579
|
throw createClientAuthError(networkError);
|
|
6577
6580
|
}
|
|
6578
6581
|
}
|
|
6579
|
-
ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
|
|
6582
|
+
ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response, correlationId);
|
|
6580
6583
|
return response;
|
|
6581
6584
|
}
|
|
6582
6585
|
/**
|
|
@@ -6797,9 +6800,7 @@ class ProtocolUtils {
|
|
|
6797
6800
|
* Licensed under the MIT License.
|
|
6798
6801
|
*/
|
|
6799
6802
|
const KeyLocation = {
|
|
6800
|
-
SW: "sw"
|
|
6801
|
-
UHW: "uhw",
|
|
6802
|
-
};
|
|
6803
|
+
SW: "sw"};
|
|
6803
6804
|
/** @internal */
|
|
6804
6805
|
class PopTokenGenerator {
|
|
6805
6806
|
constructor(cryptoUtils, performanceClient) {
|
|
@@ -7011,7 +7012,7 @@ class ResponseHandler {
|
|
|
7011
7012
|
!forceCacheRefreshTokenResponse &&
|
|
7012
7013
|
cacheRecord.account) {
|
|
7013
7014
|
const key = cacheRecord.account.generateAccountKey();
|
|
7014
|
-
const account = this.cacheStorage.getAccount(key);
|
|
7015
|
+
const account = this.cacheStorage.getAccount(key, request.correlationId);
|
|
7015
7016
|
if (!account) {
|
|
7016
7017
|
this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
|
|
7017
7018
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
@@ -7046,7 +7047,7 @@ class ResponseHandler {
|
|
|
7046
7047
|
let cachedAccount;
|
|
7047
7048
|
if (serverTokenResponse.id_token && !!idTokenClaims) {
|
|
7048
7049
|
cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
|
|
7049
|
-
cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
|
|
7050
|
+
cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, request.correlationId, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
|
|
7050
7051
|
this.logger);
|
|
7051
7052
|
}
|
|
7052
7053
|
// AccessToken
|
|
@@ -7195,7 +7196,7 @@ class ResponseHandler {
|
|
|
7195
7196
|
};
|
|
7196
7197
|
}
|
|
7197
7198
|
}
|
|
7198
|
-
function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
|
|
7199
|
+
function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
|
|
7199
7200
|
logger?.verbose("setCachedAccount called");
|
|
7200
7201
|
// Check if base account is already cached
|
|
7201
7202
|
const accountKeys = cacheStorage.getAccountKeys();
|
|
@@ -7204,7 +7205,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
7204
7205
|
});
|
|
7205
7206
|
let cachedAccount = null;
|
|
7206
7207
|
if (baseAccountKey) {
|
|
7207
|
-
cachedAccount = cacheStorage.getAccount(baseAccountKey);
|
|
7208
|
+
cachedAccount = cacheStorage.getAccount(baseAccountKey, correlationId);
|
|
7208
7209
|
}
|
|
7209
7210
|
const baseAccount = cachedAccount ||
|
|
7210
7211
|
AccountEntity.createAccount({
|
|
@@ -7618,7 +7619,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7618
7619
|
async acquireTokenWithCachedRefreshToken(request, foci) {
|
|
7619
7620
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
7620
7621
|
// fetches family RT or application RT based on FOCI value
|
|
7621
|
-
const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, undefined, this.performanceClient
|
|
7622
|
+
const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, request.correlationId, undefined, this.performanceClient);
|
|
7622
7623
|
if (!refreshToken) {
|
|
7623
7624
|
throw createInteractionRequiredAuthError(noTokensFound);
|
|
7624
7625
|
}
|
|
@@ -7648,7 +7649,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7648
7649
|
// Remove bad refresh token from cache
|
|
7649
7650
|
this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");
|
|
7650
7651
|
const badRefreshTokenKey = generateCredentialKey(refreshToken);
|
|
7651
|
-
this.cacheManager.removeRefreshToken(badRefreshTokenKey);
|
|
7652
|
+
this.cacheManager.removeRefreshToken(badRefreshTokenKey, request.correlationId);
|
|
7652
7653
|
}
|
|
7653
7654
|
}
|
|
7654
7655
|
throw e;
|
|
@@ -7804,9 +7805,9 @@ class SilentFlowClient extends BaseClient {
|
|
|
7804
7805
|
}
|
|
7805
7806
|
const environment = request.authority || this.authority.getPreferredCache();
|
|
7806
7807
|
const cacheRecord = {
|
|
7807
|
-
account: this.cacheManager.readAccountFromCache(request.account),
|
|
7808
|
+
account: this.cacheManager.readAccountFromCache(request.account, request.correlationId),
|
|
7808
7809
|
accessToken: cachedAccessToken,
|
|
7809
|
-
idToken: this.cacheManager.getIdToken(request.account, tokenKeys, requestTenantId, this.performanceClient
|
|
7810
|
+
idToken: this.cacheManager.getIdToken(request.account, request.correlationId, tokenKeys, requestTenantId, this.performanceClient),
|
|
7810
7811
|
refreshToken: null,
|
|
7811
7812
|
appMetadata: this.cacheManager.readAppMetadataFromCache(environment),
|
|
7812
7813
|
};
|
|
@@ -8286,7 +8287,7 @@ class ServerTelemetryManager {
|
|
|
8286
8287
|
else {
|
|
8287
8288
|
lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);
|
|
8288
8289
|
}
|
|
8289
|
-
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
|
|
8290
|
+
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
|
|
8290
8291
|
return;
|
|
8291
8292
|
}
|
|
8292
8293
|
/**
|
|
@@ -8295,7 +8296,7 @@ class ServerTelemetryManager {
|
|
|
8295
8296
|
incrementCacheHits() {
|
|
8296
8297
|
const lastRequests = this.getLastRequests();
|
|
8297
8298
|
lastRequests.cacheHits += 1;
|
|
8298
|
-
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
|
|
8299
|
+
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
|
|
8299
8300
|
return lastRequests.cacheHits;
|
|
8300
8301
|
}
|
|
8301
8302
|
/**
|
|
@@ -8319,7 +8320,7 @@ class ServerTelemetryManager {
|
|
|
8319
8320
|
const errorCount = lastRequests.errors.length;
|
|
8320
8321
|
if (numErrorsFlushed === errorCount) {
|
|
8321
8322
|
// All errors were sent on last request, clear Telemetry cache
|
|
8322
|
-
this.cacheManager.removeItem(this.telemetryCacheKey);
|
|
8323
|
+
this.cacheManager.removeItem(this.telemetryCacheKey, this.correlationId);
|
|
8323
8324
|
}
|
|
8324
8325
|
else {
|
|
8325
8326
|
// Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
|
|
@@ -8328,7 +8329,7 @@ class ServerTelemetryManager {
|
|
|
8328
8329
|
errors: lastRequests.errors.slice(numErrorsFlushed),
|
|
8329
8330
|
cacheHits: 0,
|
|
8330
8331
|
};
|
|
8331
|
-
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
|
|
8332
|
+
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity, this.correlationId);
|
|
8332
8333
|
}
|
|
8333
8334
|
}
|
|
8334
8335
|
/**
|
|
@@ -8395,7 +8396,7 @@ class ServerTelemetryManager {
|
|
|
8395
8396
|
setNativeBrokerErrorCode(errorCode) {
|
|
8396
8397
|
const lastRequests = this.getLastRequests();
|
|
8397
8398
|
lastRequests.nativeBrokerErrorCode = errorCode;
|
|
8398
|
-
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
|
|
8399
|
+
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
|
|
8399
8400
|
}
|
|
8400
8401
|
getNativeBrokerErrorCode() {
|
|
8401
8402
|
return this.getLastRequests().nativeBrokerErrorCode;
|
|
@@ -8403,7 +8404,7 @@ class ServerTelemetryManager {
|
|
|
8403
8404
|
clearNativeBrokerErrorCode() {
|
|
8404
8405
|
const lastRequests = this.getLastRequests();
|
|
8405
8406
|
delete lastRequests.nativeBrokerErrorCode;
|
|
8406
|
-
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
|
|
8407
|
+
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
|
|
8407
8408
|
}
|
|
8408
8409
|
static makeExtraSkuString(params) {
|
|
8409
8410
|
return makeExtraSkuString(params);
|
|
@@ -8499,6 +8500,7 @@ exports.buildClientInfoFromHomeAccountId = buildClientInfoFromHomeAccountId;
|
|
|
8499
8500
|
exports.buildStaticAuthorityOptions = buildStaticAuthorityOptions;
|
|
8500
8501
|
exports.buildTenantProfile = buildTenantProfile;
|
|
8501
8502
|
exports.createAuthError = createAuthError;
|
|
8503
|
+
exports.createCacheError = createCacheError;
|
|
8502
8504
|
exports.createClientAuthError = createClientAuthError;
|
|
8503
8505
|
exports.createClientConfigurationError = createClientConfigurationError;
|
|
8504
8506
|
exports.createInteractionRequiredAuthError = createInteractionRequiredAuthError;
|
|
@@ -8512,4 +8514,4 @@ exports.invokeAsync = invokeAsync;
|
|
|
8512
8514
|
exports.tenantIdMatchesHomeTenant = tenantIdMatchesHomeTenant;
|
|
8513
8515
|
exports.updateAccountTenantProfileData = updateAccountTenantProfileData;
|
|
8514
8516
|
exports.version = version;
|
|
8515
|
-
//# sourceMappingURL=index-node-
|
|
8517
|
+
//# sourceMappingURL=index-node-2PsHlOld.js.map
|