@azure/msal-common 14.15.0 → 14.16.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 -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/broker/nativeBroker/INativeBrokerPlugin.d.ts +1 -0
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
- package/dist/cache/CacheManager.d.ts +34 -39
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +84 -102
- 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 +21 -21
- 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 +24 -13
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +10 -3
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +62 -10
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +12 -6
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +4 -4
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.d.ts +2 -0
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.d.ts +2 -0
- package/dist/constants/AADServerParamKeys.d.ts.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +5 -3
- package/dist/constants/AADServerParamKeys.mjs.map +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.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.d.ts +6 -0
- package/dist/error/CacheError.d.ts.map +1 -1
- package/dist/error/CacheError.mjs +24 -6
- 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 +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +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.d.ts +19 -0
- package/dist/error/NetworkError.d.ts.map +1 -0
- package/dist/error/NetworkError.mjs +34 -0
- package/dist/error/NetworkError.mjs.map +1 -0
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-common.d.ts +3 -2
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/index-browser.mjs +3 -3
- package/dist/index-node.mjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkResponse.d.ts +6 -0
- package/dist/network/NetworkResponse.d.ts.map +1 -0
- package/dist/network/ThrottlingUtils.d.ts +3 -3
- 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/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +2 -0
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +8 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +26 -3
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +29 -10
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +9 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +6 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +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.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +2 -1
- 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 +34 -13
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-aee3f7b6.js → index-node-CebvEPer.js} +390 -298
- package/lib/index-node-CebvEPer.js.map +1 -0
- package/lib/index-node.cjs +6 -4
- package/lib/index-node.cjs.map +1 -1
- package/lib/index.cjs +6 -4
- 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/broker/nativeBroker/INativeBrokerPlugin.d.ts +1 -0
- package/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +34 -39
- 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 +21 -21
- 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 +10 -3
- 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/config/ClientConfiguration.d.ts +2 -0
- package/lib/types/config/ClientConfiguration.d.ts.map +1 -1
- package/lib/types/constants/AADServerParamKeys.d.ts +2 -0
- package/lib/types/constants/AADServerParamKeys.d.ts.map +1 -1
- package/lib/types/error/CacheError.d.ts +6 -0
- 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/NetworkError.d.ts +19 -0
- package/lib/types/error/NetworkError.d.ts.map +1 -0
- package/lib/types/exports-common.d.ts +3 -2
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/network/INetworkModule.d.ts +1 -1
- package/lib/types/network/INetworkModule.d.ts.map +1 -1
- package/lib/types/network/NetworkResponse.d.ts +6 -0
- package/lib/types/network/NetworkResponse.d.ts.map +1 -0
- package/lib/types/network/ThrottlingUtils.d.ts +3 -3
- package/lib/types/network/ThrottlingUtils.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/request/BaseAuthRequest.d.ts +2 -0
- package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/lib/types/request/RequestParameterBuilder.d.ts +8 -1
- package/lib/types/request/RequestParameterBuilder.d.ts.map +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/performance/PerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts +9 -0
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +1 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/package.json +2 -4
- package/src/account/AccountInfo.ts +1 -0
- package/src/authority/RegionDiscovery.ts +1 -1
- package/src/cache/CacheManager.ts +184 -131
- package/src/cache/entities/AccountEntity.ts +1 -0
- package/src/cache/entities/CredentialEntity.ts +2 -0
- package/src/cache/interface/ICacheManager.ts +45 -20
- package/src/client/AuthorizationCodeClient.ts +37 -16
- package/src/client/BaseClient.ts +113 -22
- package/src/client/RefreshTokenClient.ts +20 -8
- package/src/client/SilentFlowClient.ts +7 -5
- package/src/config/ClientConfiguration.ts +2 -0
- package/src/constants/AADServerParamKeys.ts +2 -0
- package/src/error/CacheError.ts +24 -4
- package/src/error/CacheErrorCodes.ts +2 -2
- package/src/error/NetworkError.ts +44 -0
- package/src/exports-common.ts +7 -6
- package/src/network/INetworkModule.ts +1 -1
- package/src/network/NetworkResponse.ts +10 -0
- package/src/network/ThrottlingUtils.ts +9 -6
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +2 -0
- package/src/request/RequestParameterBuilder.ts +51 -1
- package/src/response/ResponseHandler.ts +14 -4
- package/src/telemetry/performance/PerformanceClient.ts +42 -12
- package/src/telemetry/performance/PerformanceEvent.ts +15 -0
- package/src/telemetry/server/ServerTelemetryManager.ts +14 -6
- package/src/utils/Constants.ts +1 -0
- package/dist/network/NetworkManager.d.ts +0 -34
- package/dist/network/NetworkManager.d.ts.map +0 -1
- package/dist/network/NetworkManager.mjs +0 -44
- package/dist/network/NetworkManager.mjs.map +0 -1
- package/lib/index-node-aee3f7b6.js.map +0 -1
- package/lib/types/network/NetworkManager.d.ts +0 -34
- package/lib/types/network/NetworkManager.d.ts.map +0 -1
- package/src/network/NetworkManager.ts +0 -76
|
@@ -53,7 +53,8 @@ import { getAliasesFromStaticSources } from "../authority/AuthorityMetadata.js";
|
|
|
53
53
|
import { StaticAuthorityOptions } from "../authority/AuthorityOptions.js";
|
|
54
54
|
import { TokenClaims } from "../account/TokenClaims.js";
|
|
55
55
|
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
|
|
56
|
-
import {
|
|
56
|
+
import { createCacheError } from "../error/CacheError.js";
|
|
57
|
+
import { AuthError } from "../error/AuthError.js";
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.
|
|
@@ -84,64 +85,85 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
84
85
|
*/
|
|
85
86
|
abstract getAccount(
|
|
86
87
|
accountKey: string,
|
|
88
|
+
correlationId: string,
|
|
87
89
|
logger?: Logger
|
|
88
90
|
): AccountEntity | null;
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
93
|
* Returns deserialized account if found in the cache, otherwiser returns null
|
|
92
94
|
*/
|
|
93
|
-
abstract getCachedAccountEntity(
|
|
95
|
+
abstract getCachedAccountEntity(
|
|
96
|
+
accountKey: string,
|
|
97
|
+
correlationId: string
|
|
98
|
+
): AccountEntity | null;
|
|
94
99
|
|
|
95
100
|
/**
|
|
96
101
|
* set account entity in the platform cache
|
|
97
102
|
* @param account
|
|
98
103
|
*/
|
|
99
|
-
abstract setAccount(account: AccountEntity): void;
|
|
104
|
+
abstract setAccount(account: AccountEntity, correlationId: string): void;
|
|
100
105
|
|
|
101
106
|
/**
|
|
102
107
|
* remove account entity from the platform cache if it's outdated
|
|
103
108
|
*/
|
|
104
|
-
abstract removeOutdatedAccount(
|
|
109
|
+
abstract removeOutdatedAccount(
|
|
110
|
+
accountKey: string,
|
|
111
|
+
correlationId: string
|
|
112
|
+
): void;
|
|
105
113
|
|
|
106
114
|
/**
|
|
107
115
|
* fetch the idToken entity from the platform cache
|
|
108
116
|
* @param idTokenKey
|
|
109
117
|
*/
|
|
110
|
-
abstract getIdTokenCredential(
|
|
118
|
+
abstract getIdTokenCredential(
|
|
119
|
+
idTokenKey: string,
|
|
120
|
+
correlationId: string
|
|
121
|
+
): IdTokenEntity | null;
|
|
111
122
|
|
|
112
123
|
/**
|
|
113
124
|
* set idToken entity to the platform cache
|
|
114
125
|
* @param idToken
|
|
115
126
|
*/
|
|
116
|
-
abstract setIdTokenCredential(
|
|
127
|
+
abstract setIdTokenCredential(
|
|
128
|
+
idToken: IdTokenEntity,
|
|
129
|
+
correlationId: string
|
|
130
|
+
): void;
|
|
117
131
|
|
|
118
132
|
/**
|
|
119
133
|
* fetch the idToken entity from the platform cache
|
|
120
134
|
* @param accessTokenKey
|
|
121
135
|
*/
|
|
122
136
|
abstract getAccessTokenCredential(
|
|
123
|
-
accessTokenKey: string
|
|
137
|
+
accessTokenKey: string,
|
|
138
|
+
correlationId: string
|
|
124
139
|
): AccessTokenEntity | null;
|
|
125
140
|
|
|
126
141
|
/**
|
|
127
142
|
* set idToken entity to the platform cache
|
|
128
143
|
* @param accessToken
|
|
129
144
|
*/
|
|
130
|
-
abstract setAccessTokenCredential(
|
|
145
|
+
abstract setAccessTokenCredential(
|
|
146
|
+
accessToken: AccessTokenEntity,
|
|
147
|
+
correlationId: string
|
|
148
|
+
): void;
|
|
131
149
|
|
|
132
150
|
/**
|
|
133
151
|
* fetch the idToken entity from the platform cache
|
|
134
152
|
* @param refreshTokenKey
|
|
135
153
|
*/
|
|
136
154
|
abstract getRefreshTokenCredential(
|
|
137
|
-
refreshTokenKey: string
|
|
155
|
+
refreshTokenKey: string,
|
|
156
|
+
correlationId: string
|
|
138
157
|
): RefreshTokenEntity | null;
|
|
139
158
|
|
|
140
159
|
/**
|
|
141
160
|
* set idToken entity to the platform cache
|
|
142
161
|
* @param refreshToken
|
|
143
162
|
*/
|
|
144
|
-
abstract setRefreshTokenCredential(
|
|
163
|
+
abstract setRefreshTokenCredential(
|
|
164
|
+
refreshToken: RefreshTokenEntity,
|
|
165
|
+
correlationId: string
|
|
166
|
+
): void;
|
|
145
167
|
|
|
146
168
|
/**
|
|
147
169
|
* fetch appMetadata entity from the platform cache
|
|
@@ -153,7 +175,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
153
175
|
* set appMetadata entity to the platform cache
|
|
154
176
|
* @param appMetadata
|
|
155
177
|
*/
|
|
156
|
-
abstract setAppMetadata(
|
|
178
|
+
abstract setAppMetadata(
|
|
179
|
+
appMetadata: AppMetadataEntity,
|
|
180
|
+
correlationId: string
|
|
181
|
+
): void;
|
|
157
182
|
|
|
158
183
|
/**
|
|
159
184
|
* fetch server telemetry entity from the platform cache
|
|
@@ -170,7 +195,8 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
170
195
|
*/
|
|
171
196
|
abstract setServerTelemetry(
|
|
172
197
|
serverTelemetryKey: string,
|
|
173
|
-
serverTelemetry: ServerTelemetryEntity
|
|
198
|
+
serverTelemetry: ServerTelemetryEntity,
|
|
199
|
+
correlationId: string
|
|
174
200
|
): void;
|
|
175
201
|
|
|
176
202
|
/**
|
|
@@ -209,14 +235,15 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
209
235
|
*/
|
|
210
236
|
abstract setThrottlingCache(
|
|
211
237
|
throttlingCacheKey: string,
|
|
212
|
-
throttlingCache: ThrottlingEntity
|
|
238
|
+
throttlingCache: ThrottlingEntity,
|
|
239
|
+
correlationId: string
|
|
213
240
|
): void;
|
|
214
241
|
|
|
215
242
|
/**
|
|
216
243
|
* Function to remove an item from cache given its key.
|
|
217
244
|
* @param key
|
|
218
245
|
*/
|
|
219
|
-
abstract removeItem(key: string): void;
|
|
246
|
+
abstract removeItem(key: string, correlationId: string): void;
|
|
220
247
|
|
|
221
248
|
/**
|
|
222
249
|
* Function which retrieves all current keys from the cache.
|
|
@@ -233,17 +260,13 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
233
260
|
*/
|
|
234
261
|
abstract getTokenKeys(): TokenKeys;
|
|
235
262
|
|
|
236
|
-
/**
|
|
237
|
-
* Function which clears cache.
|
|
238
|
-
*/
|
|
239
|
-
abstract clear(): Promise<void>;
|
|
240
|
-
|
|
241
263
|
/**
|
|
242
264
|
* Function which updates an outdated credential cache key
|
|
243
265
|
*/
|
|
244
266
|
abstract updateCredentialCacheKey(
|
|
245
267
|
currentCacheKey: string,
|
|
246
|
-
credential: ValidCredentialType
|
|
268
|
+
credential: ValidCredentialType,
|
|
269
|
+
correlationId: string
|
|
247
270
|
): string;
|
|
248
271
|
|
|
249
272
|
/**
|
|
@@ -251,9 +274,13 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
251
274
|
* @param accountFilter - (Optional) filter to narrow down the accounts returned
|
|
252
275
|
* @returns Array of AccountInfo objects in cache
|
|
253
276
|
*/
|
|
254
|
-
getAllAccounts(
|
|
277
|
+
getAllAccounts(
|
|
278
|
+
correlationId: string,
|
|
279
|
+
accountFilter?: AccountFilter
|
|
280
|
+
): AccountInfo[] {
|
|
255
281
|
return this.buildTenantProfiles(
|
|
256
|
-
this.getAccountsFilteredBy(accountFilter || {}),
|
|
282
|
+
this.getAccountsFilteredBy(accountFilter || {}, correlationId),
|
|
283
|
+
correlationId,
|
|
257
284
|
accountFilter
|
|
258
285
|
);
|
|
259
286
|
}
|
|
@@ -261,8 +288,11 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
261
288
|
/**
|
|
262
289
|
* Gets first tenanted AccountInfo object found based on provided filters
|
|
263
290
|
*/
|
|
264
|
-
getAccountInfoFilteredBy(
|
|
265
|
-
|
|
291
|
+
getAccountInfoFilteredBy(
|
|
292
|
+
accountFilter: AccountFilter,
|
|
293
|
+
correlationId: string
|
|
294
|
+
): AccountInfo | null {
|
|
295
|
+
const allAccounts = this.getAllAccounts(correlationId, accountFilter);
|
|
266
296
|
if (allAccounts.length > 1) {
|
|
267
297
|
// If one or more accounts are found, prioritize accounts that have an ID token
|
|
268
298
|
const sortedAccounts = allAccounts.sort((account) => {
|
|
@@ -282,8 +312,14 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
282
312
|
* @param accountFilter
|
|
283
313
|
* @returns
|
|
284
314
|
*/
|
|
285
|
-
getBaseAccountInfo(
|
|
286
|
-
|
|
315
|
+
getBaseAccountInfo(
|
|
316
|
+
accountFilter: AccountFilter,
|
|
317
|
+
correlationId: string
|
|
318
|
+
): AccountInfo | null {
|
|
319
|
+
const accountEntities = this.getAccountsFilteredBy(
|
|
320
|
+
accountFilter,
|
|
321
|
+
correlationId
|
|
322
|
+
);
|
|
287
323
|
if (accountEntities.length > 0) {
|
|
288
324
|
return accountEntities[0].getAccountInfo();
|
|
289
325
|
} else {
|
|
@@ -300,11 +336,13 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
300
336
|
*/
|
|
301
337
|
private buildTenantProfiles(
|
|
302
338
|
cachedAccounts: AccountEntity[],
|
|
339
|
+
correlationId: string,
|
|
303
340
|
accountFilter?: AccountFilter
|
|
304
341
|
): AccountInfo[] {
|
|
305
342
|
return cachedAccounts.flatMap((accountEntity) => {
|
|
306
343
|
return this.getTenantProfilesFromAccountEntity(
|
|
307
344
|
accountEntity,
|
|
345
|
+
correlationId,
|
|
308
346
|
accountFilter?.tenantId,
|
|
309
347
|
accountFilter
|
|
310
348
|
);
|
|
@@ -315,6 +353,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
315
353
|
accountInfo: AccountInfo,
|
|
316
354
|
tokenKeys: TokenKeys,
|
|
317
355
|
tenantProfile: TenantProfile,
|
|
356
|
+
correlationId: string,
|
|
318
357
|
tenantProfileFilter?: TenantProfileFilter
|
|
319
358
|
): AccountInfo | null {
|
|
320
359
|
let tenantedAccountInfo: AccountInfo | null = null;
|
|
@@ -333,6 +372,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
333
372
|
|
|
334
373
|
const idToken = this.getIdToken(
|
|
335
374
|
accountInfo,
|
|
375
|
+
correlationId,
|
|
336
376
|
tokenKeys,
|
|
337
377
|
tenantProfile.tenantId
|
|
338
378
|
);
|
|
@@ -367,6 +407,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
367
407
|
|
|
368
408
|
private getTenantProfilesFromAccountEntity(
|
|
369
409
|
accountEntity: AccountEntity,
|
|
410
|
+
correlationId: string,
|
|
370
411
|
targetTenantId?: string,
|
|
371
412
|
tenantProfileFilter?: TenantProfileFilter
|
|
372
413
|
): AccountInfo[] {
|
|
@@ -395,6 +436,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
395
436
|
accountInfo,
|
|
396
437
|
tokenKeys,
|
|
397
438
|
tenantProfile,
|
|
439
|
+
correlationId,
|
|
398
440
|
tenantProfileFilter
|
|
399
441
|
);
|
|
400
442
|
if (tenantedAccountInfo) {
|
|
@@ -498,8 +540,8 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
498
540
|
*/
|
|
499
541
|
async saveCacheRecord(
|
|
500
542
|
cacheRecord: CacheRecord,
|
|
501
|
-
|
|
502
|
-
|
|
543
|
+
correlationId: string,
|
|
544
|
+
storeInCache?: StoreInCache
|
|
503
545
|
): Promise<void> {
|
|
504
546
|
if (!cacheRecord) {
|
|
505
547
|
throw createClientAuthError(
|
|
@@ -509,59 +551,42 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
509
551
|
|
|
510
552
|
try {
|
|
511
553
|
if (!!cacheRecord.account) {
|
|
512
|
-
this.setAccount(cacheRecord.account);
|
|
554
|
+
this.setAccount(cacheRecord.account, correlationId);
|
|
513
555
|
}
|
|
514
556
|
|
|
515
557
|
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
516
|
-
this.setIdTokenCredential(cacheRecord.idToken);
|
|
558
|
+
this.setIdTokenCredential(cacheRecord.idToken, correlationId);
|
|
517
559
|
}
|
|
518
560
|
|
|
519
561
|
if (
|
|
520
562
|
!!cacheRecord.accessToken &&
|
|
521
563
|
storeInCache?.accessToken !== false
|
|
522
564
|
) {
|
|
523
|
-
await this.saveAccessToken(
|
|
565
|
+
await this.saveAccessToken(
|
|
566
|
+
cacheRecord.accessToken,
|
|
567
|
+
correlationId
|
|
568
|
+
);
|
|
524
569
|
}
|
|
525
570
|
|
|
526
571
|
if (
|
|
527
572
|
!!cacheRecord.refreshToken &&
|
|
528
573
|
storeInCache?.refreshToken !== false
|
|
529
574
|
) {
|
|
530
|
-
this.setRefreshTokenCredential(
|
|
575
|
+
this.setRefreshTokenCredential(
|
|
576
|
+
cacheRecord.refreshToken,
|
|
577
|
+
correlationId
|
|
578
|
+
);
|
|
531
579
|
}
|
|
532
580
|
|
|
533
581
|
if (!!cacheRecord.appMetadata) {
|
|
534
|
-
this.setAppMetadata(cacheRecord.appMetadata);
|
|
582
|
+
this.setAppMetadata(cacheRecord.appMetadata, correlationId);
|
|
535
583
|
}
|
|
536
584
|
} catch (e: unknown) {
|
|
537
585
|
this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
|
|
538
|
-
if (e instanceof
|
|
539
|
-
|
|
540
|
-
`CacheManager.saveCacheRecord: ${e.message}`,
|
|
541
|
-
correlationId
|
|
542
|
-
);
|
|
543
|
-
|
|
544
|
-
if (
|
|
545
|
-
e.name === "QuotaExceededError" ||
|
|
546
|
-
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
547
|
-
e.message.includes("exceeded the quota")
|
|
548
|
-
) {
|
|
549
|
-
this.commonLogger?.error(
|
|
550
|
-
`CacheManager.saveCacheRecord: exceeded storage quota`,
|
|
551
|
-
correlationId
|
|
552
|
-
);
|
|
553
|
-
throw new CacheError(
|
|
554
|
-
CacheErrorCodes.cacheQuotaExceededErrorCode
|
|
555
|
-
);
|
|
556
|
-
} else {
|
|
557
|
-
throw new CacheError(e.name, e.message);
|
|
558
|
-
}
|
|
586
|
+
if (e instanceof AuthError) {
|
|
587
|
+
throw e;
|
|
559
588
|
} else {
|
|
560
|
-
|
|
561
|
-
`CacheManager.saveCacheRecord: ${e}`,
|
|
562
|
-
correlationId
|
|
563
|
-
);
|
|
564
|
-
throw new CacheError(CacheErrorCodes.cacheUnknownErrorCode);
|
|
589
|
+
throw createCacheError(e);
|
|
565
590
|
}
|
|
566
591
|
}
|
|
567
592
|
}
|
|
@@ -571,7 +596,8 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
571
596
|
* @param credential
|
|
572
597
|
*/
|
|
573
598
|
private async saveAccessToken(
|
|
574
|
-
credential: AccessTokenEntity
|
|
599
|
+
credential: AccessTokenEntity,
|
|
600
|
+
correlationId: string
|
|
575
601
|
): Promise<void> {
|
|
576
602
|
const accessTokenFilter: CredentialFilter = {
|
|
577
603
|
clientId: credential.clientId,
|
|
@@ -586,7 +612,6 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
586
612
|
const tokenKeys = this.getTokenKeys();
|
|
587
613
|
const currentScopes = ScopeSet.fromString(credential.target);
|
|
588
614
|
|
|
589
|
-
const removedAccessTokens: Array<Promise<void>> = [];
|
|
590
615
|
tokenKeys.accessToken.forEach((key) => {
|
|
591
616
|
if (
|
|
592
617
|
!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)
|
|
@@ -594,7 +619,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
594
619
|
return;
|
|
595
620
|
}
|
|
596
621
|
|
|
597
|
-
const tokenEntity = this.getAccessTokenCredential(
|
|
622
|
+
const tokenEntity = this.getAccessTokenCredential(
|
|
623
|
+
key,
|
|
624
|
+
correlationId
|
|
625
|
+
);
|
|
598
626
|
|
|
599
627
|
if (
|
|
600
628
|
tokenEntity &&
|
|
@@ -602,12 +630,11 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
602
630
|
) {
|
|
603
631
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
|
|
604
632
|
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
|
|
605
|
-
|
|
633
|
+
this.removeAccessToken(key, correlationId);
|
|
606
634
|
}
|
|
607
635
|
}
|
|
608
636
|
});
|
|
609
|
-
|
|
610
|
-
this.setAccessTokenCredential(credential);
|
|
637
|
+
this.setAccessTokenCredential(credential, correlationId);
|
|
611
638
|
}
|
|
612
639
|
|
|
613
640
|
/**
|
|
@@ -615,7 +642,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
615
642
|
* Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
|
|
616
643
|
* @param accountFilter - An object containing Account properties to filter by
|
|
617
644
|
*/
|
|
618
|
-
getAccountsFilteredBy(
|
|
645
|
+
getAccountsFilteredBy(
|
|
646
|
+
accountFilter: AccountFilter,
|
|
647
|
+
correlationId: string
|
|
648
|
+
): AccountEntity[] {
|
|
619
649
|
const allAccountKeys = this.getAccountKeys();
|
|
620
650
|
const matchingAccounts: AccountEntity[] = [];
|
|
621
651
|
allAccountKeys.forEach((cacheKey) => {
|
|
@@ -626,6 +656,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
626
656
|
|
|
627
657
|
const entity: AccountEntity | null = this.getAccount(
|
|
628
658
|
cacheKey,
|
|
659
|
+
correlationId,
|
|
629
660
|
this.commonLogger
|
|
630
661
|
);
|
|
631
662
|
|
|
@@ -957,12 +988,12 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
957
988
|
/**
|
|
958
989
|
* Removes all accounts and related tokens from cache.
|
|
959
990
|
*/
|
|
960
|
-
async removeAllAccounts(): Promise<void> {
|
|
991
|
+
async removeAllAccounts(correlationId: string): Promise<void> {
|
|
961
992
|
const allAccountKeys = this.getAccountKeys();
|
|
962
993
|
const removedAccounts: Array<Promise<void>> = [];
|
|
963
994
|
|
|
964
995
|
allAccountKeys.forEach((cacheKey) => {
|
|
965
|
-
removedAccounts.push(this.removeAccount(cacheKey));
|
|
996
|
+
removedAccounts.push(this.removeAccount(cacheKey, correlationId));
|
|
966
997
|
});
|
|
967
998
|
|
|
968
999
|
await Promise.all(removedAccounts);
|
|
@@ -972,43 +1003,56 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
972
1003
|
* Removes the account and related tokens for a given account key
|
|
973
1004
|
* @param account
|
|
974
1005
|
*/
|
|
975
|
-
async removeAccount(
|
|
976
|
-
|
|
1006
|
+
async removeAccount(
|
|
1007
|
+
accountKey: string,
|
|
1008
|
+
correlationId: string
|
|
1009
|
+
): Promise<void> {
|
|
1010
|
+
const account = this.getAccount(
|
|
1011
|
+
accountKey,
|
|
1012
|
+
correlationId,
|
|
1013
|
+
this.commonLogger
|
|
1014
|
+
);
|
|
977
1015
|
if (!account) {
|
|
978
1016
|
return;
|
|
979
1017
|
}
|
|
980
|
-
await this.removeAccountContext(account);
|
|
981
|
-
this.removeItem(accountKey);
|
|
1018
|
+
await this.removeAccountContext(account, correlationId);
|
|
1019
|
+
this.removeItem(accountKey, correlationId);
|
|
982
1020
|
}
|
|
983
1021
|
|
|
984
1022
|
/**
|
|
985
1023
|
* Removes credentials associated with the provided account
|
|
986
1024
|
* @param account
|
|
987
1025
|
*/
|
|
988
|
-
async removeAccountContext(
|
|
1026
|
+
async removeAccountContext(
|
|
1027
|
+
account: AccountEntity,
|
|
1028
|
+
correlationId: string
|
|
1029
|
+
): Promise<void> {
|
|
989
1030
|
const allTokenKeys = this.getTokenKeys();
|
|
990
1031
|
const accountId = account.generateAccountId();
|
|
991
|
-
const removedCredentials: Array<Promise<void>> = [];
|
|
992
1032
|
|
|
993
1033
|
allTokenKeys.idToken.forEach((key) => {
|
|
994
1034
|
if (key.indexOf(accountId) === 0) {
|
|
995
|
-
this.removeIdToken(key);
|
|
1035
|
+
this.removeIdToken(key, correlationId);
|
|
996
1036
|
}
|
|
997
1037
|
});
|
|
998
1038
|
|
|
999
1039
|
allTokenKeys.accessToken.forEach((key) => {
|
|
1000
1040
|
if (key.indexOf(accountId) === 0) {
|
|
1001
|
-
|
|
1041
|
+
this.removeAccessToken(key, correlationId);
|
|
1002
1042
|
}
|
|
1003
1043
|
});
|
|
1004
1044
|
|
|
1005
1045
|
allTokenKeys.refreshToken.forEach((key) => {
|
|
1006
1046
|
if (key.indexOf(accountId) === 0) {
|
|
1007
|
-
this.removeRefreshToken(key);
|
|
1047
|
+
this.removeRefreshToken(key, correlationId);
|
|
1008
1048
|
}
|
|
1009
1049
|
});
|
|
1010
1050
|
|
|
1011
|
-
|
|
1051
|
+
this.getKeys().forEach((key) => {
|
|
1052
|
+
if (key.includes(accountId)) {
|
|
1053
|
+
this.removeItem(key, correlationId);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1012
1056
|
}
|
|
1013
1057
|
|
|
1014
1058
|
/**
|
|
@@ -1022,6 +1066,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1022
1066
|
protected updateOutdatedCachedAccount(
|
|
1023
1067
|
accountKey: string,
|
|
1024
1068
|
accountEntity: AccountEntity | null,
|
|
1069
|
+
correlationId: string,
|
|
1025
1070
|
logger?: Logger
|
|
1026
1071
|
): AccountEntity | null {
|
|
1027
1072
|
// Only update if account entity is defined and has no tenantProfiles object (is outdated)
|
|
@@ -1040,7 +1085,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1040
1085
|
// Get all account entities belonging to user
|
|
1041
1086
|
const accountsToMerge: AccountEntity[] = [];
|
|
1042
1087
|
matchingAccountKeys.forEach((key: string) => {
|
|
1043
|
-
const account = this.getCachedAccountEntity(key);
|
|
1088
|
+
const account = this.getCachedAccountEntity(key, correlationId);
|
|
1044
1089
|
if (account) {
|
|
1045
1090
|
accountsToMerge.push(account);
|
|
1046
1091
|
}
|
|
@@ -1079,12 +1124,12 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1079
1124
|
// Clear cache of legacy account objects that have been collpsed into tenant profiles
|
|
1080
1125
|
matchingAccountKeys.forEach((key: string) => {
|
|
1081
1126
|
if (key !== newAccountKey) {
|
|
1082
|
-
this.removeOutdatedAccount(accountKey);
|
|
1127
|
+
this.removeOutdatedAccount(accountKey, correlationId);
|
|
1083
1128
|
}
|
|
1084
1129
|
});
|
|
1085
1130
|
|
|
1086
1131
|
// Cache updated account object
|
|
1087
|
-
this.setAccount(updatedAccount);
|
|
1132
|
+
this.setAccount(updatedAccount, correlationId);
|
|
1088
1133
|
logger?.verbose("Updated an outdated account entity in the cache");
|
|
1089
1134
|
return updatedAccount;
|
|
1090
1135
|
}
|
|
@@ -1097,45 +1142,37 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1097
1142
|
* returns a boolean if the given credential is removed
|
|
1098
1143
|
* @param credential
|
|
1099
1144
|
*/
|
|
1100
|
-
|
|
1101
|
-
const credential = this.getAccessTokenCredential(key);
|
|
1102
|
-
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1145
|
+
removeAccessToken(key: string, correlationId: string): void {
|
|
1146
|
+
const credential = this.getAccessTokenCredential(key, correlationId);
|
|
1147
|
+
this.removeItem(key, correlationId);
|
|
1105
1148
|
|
|
1106
|
-
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
1107
1149
|
if (
|
|
1108
|
-
credential
|
|
1109
|
-
|
|
1150
|
+
!credential ||
|
|
1151
|
+
credential.credentialType.toLowerCase() !==
|
|
1152
|
+
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase() ||
|
|
1153
|
+
credential.tokenType !== AuthenticationScheme.POP
|
|
1110
1154
|
) {
|
|
1111
|
-
|
|
1112
|
-
const accessTokenWithAuthSchemeEntity =
|
|
1113
|
-
credential as AccessTokenEntity;
|
|
1114
|
-
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
1115
|
-
|
|
1116
|
-
if (kid) {
|
|
1117
|
-
try {
|
|
1118
|
-
await this.cryptoImpl.removeTokenBindingKey(kid);
|
|
1119
|
-
} catch (error) {
|
|
1120
|
-
throw createClientAuthError(
|
|
1121
|
-
ClientAuthErrorCodes.bindingKeyNotRemoved
|
|
1122
|
-
);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1155
|
+
return;
|
|
1126
1156
|
}
|
|
1127
1157
|
|
|
1128
|
-
|
|
1158
|
+
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
1159
|
+
const kid = credential.keyId;
|
|
1160
|
+
|
|
1161
|
+
if (kid) {
|
|
1162
|
+
void this.cryptoImpl.removeTokenBindingKey(kid).catch(() => {
|
|
1163
|
+
this.commonLogger.error("Binding key could not be removed");
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1129
1166
|
}
|
|
1130
1167
|
|
|
1131
1168
|
/**
|
|
1132
1169
|
* Removes all app metadata objects from cache.
|
|
1133
1170
|
*/
|
|
1134
|
-
removeAppMetadata(): boolean {
|
|
1171
|
+
removeAppMetadata(correlationId: string): boolean {
|
|
1135
1172
|
const allCacheKeys = this.getKeys();
|
|
1136
1173
|
allCacheKeys.forEach((cacheKey) => {
|
|
1137
1174
|
if (this.isAppMetadata(cacheKey)) {
|
|
1138
|
-
this.removeItem(cacheKey);
|
|
1175
|
+
this.removeItem(cacheKey, correlationId);
|
|
1139
1176
|
}
|
|
1140
1177
|
});
|
|
1141
1178
|
|
|
@@ -1146,10 +1183,13 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1146
1183
|
* Retrieve AccountEntity from cache
|
|
1147
1184
|
* @param account
|
|
1148
1185
|
*/
|
|
1149
|
-
readAccountFromCache(
|
|
1186
|
+
readAccountFromCache(
|
|
1187
|
+
account: AccountInfo,
|
|
1188
|
+
correlationId: string
|
|
1189
|
+
): AccountEntity | null {
|
|
1150
1190
|
const accountKey: string =
|
|
1151
1191
|
AccountEntity.generateAccountCacheKey(account);
|
|
1152
|
-
return this.getAccount(accountKey, this.commonLogger);
|
|
1192
|
+
return this.getAccount(accountKey, correlationId, this.commonLogger);
|
|
1153
1193
|
}
|
|
1154
1194
|
|
|
1155
1195
|
/**
|
|
@@ -1162,10 +1202,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1162
1202
|
*/
|
|
1163
1203
|
getIdToken(
|
|
1164
1204
|
account: AccountInfo,
|
|
1205
|
+
correlationId: string,
|
|
1165
1206
|
tokenKeys?: TokenKeys,
|
|
1166
1207
|
targetRealm?: string,
|
|
1167
|
-
performanceClient?: IPerformanceClient
|
|
1168
|
-
correlationId?: string
|
|
1208
|
+
performanceClient?: IPerformanceClient
|
|
1169
1209
|
): IdTokenEntity | null {
|
|
1170
1210
|
this.commonLogger.trace("CacheManager - getIdToken called");
|
|
1171
1211
|
const idTokenFilter: CredentialFilter = {
|
|
@@ -1178,6 +1218,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1178
1218
|
|
|
1179
1219
|
const idTokenMap: Map<string, IdTokenEntity> = this.getIdTokensByFilter(
|
|
1180
1220
|
idTokenFilter,
|
|
1221
|
+
correlationId,
|
|
1181
1222
|
tokenKeys
|
|
1182
1223
|
);
|
|
1183
1224
|
|
|
@@ -1220,7 +1261,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1220
1261
|
"CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"
|
|
1221
1262
|
);
|
|
1222
1263
|
tokensToBeRemoved.forEach((idToken, key) => {
|
|
1223
|
-
this.removeIdToken(key);
|
|
1264
|
+
this.removeIdToken(key, correlationId);
|
|
1224
1265
|
});
|
|
1225
1266
|
if (performanceClient && correlationId) {
|
|
1226
1267
|
performanceClient.addFields(
|
|
@@ -1242,6 +1283,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1242
1283
|
*/
|
|
1243
1284
|
getIdTokensByFilter(
|
|
1244
1285
|
filter: CredentialFilter,
|
|
1286
|
+
correlationId: string,
|
|
1245
1287
|
tokenKeys?: TokenKeys
|
|
1246
1288
|
): Map<string, IdTokenEntity> {
|
|
1247
1289
|
const idTokenKeys =
|
|
@@ -1260,7 +1302,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1260
1302
|
) {
|
|
1261
1303
|
return;
|
|
1262
1304
|
}
|
|
1263
|
-
const idToken = this.getIdTokenCredential(key);
|
|
1305
|
+
const idToken = this.getIdTokenCredential(key, correlationId);
|
|
1264
1306
|
if (idToken && this.credentialMatchesFilter(idToken, filter)) {
|
|
1265
1307
|
idTokens.set(key, idToken);
|
|
1266
1308
|
}
|
|
@@ -1301,16 +1343,16 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1301
1343
|
* Removes idToken from the cache
|
|
1302
1344
|
* @param key
|
|
1303
1345
|
*/
|
|
1304
|
-
removeIdToken(key: string): void {
|
|
1305
|
-
this.removeItem(key);
|
|
1346
|
+
removeIdToken(key: string, correlationId: string): void {
|
|
1347
|
+
this.removeItem(key, correlationId);
|
|
1306
1348
|
}
|
|
1307
1349
|
|
|
1308
1350
|
/**
|
|
1309
1351
|
* Removes refresh token from the cache
|
|
1310
1352
|
* @param key
|
|
1311
1353
|
*/
|
|
1312
|
-
removeRefreshToken(key: string): void {
|
|
1313
|
-
this.removeItem(key);
|
|
1354
|
+
removeRefreshToken(key: string, correlationId: string): void {
|
|
1355
|
+
this.removeItem(key, correlationId);
|
|
1314
1356
|
}
|
|
1315
1357
|
|
|
1316
1358
|
/**
|
|
@@ -1326,8 +1368,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1326
1368
|
request: BaseAuthRequest,
|
|
1327
1369
|
tokenKeys?: TokenKeys,
|
|
1328
1370
|
targetRealm?: string,
|
|
1329
|
-
performanceClient?: IPerformanceClient
|
|
1330
|
-
correlationId?: string
|
|
1371
|
+
performanceClient?: IPerformanceClient
|
|
1331
1372
|
): AccessTokenEntity | null {
|
|
1332
1373
|
this.commonLogger.trace("CacheManager - getAccessToken called");
|
|
1333
1374
|
const scopes = ScopeSet.createSearchScopes(request.scopes);
|
|
@@ -1366,7 +1407,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1366
1407
|
if (
|
|
1367
1408
|
this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)
|
|
1368
1409
|
) {
|
|
1369
|
-
const accessToken = this.getAccessTokenCredential(
|
|
1410
|
+
const accessToken = this.getAccessTokenCredential(
|
|
1411
|
+
key,
|
|
1412
|
+
request.correlationId
|
|
1413
|
+
);
|
|
1370
1414
|
|
|
1371
1415
|
// Validate value
|
|
1372
1416
|
if (
|
|
@@ -1389,12 +1433,15 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1389
1433
|
"CacheManager:getAccessToken - Multiple access tokens found, clearing them"
|
|
1390
1434
|
);
|
|
1391
1435
|
accessTokens.forEach((accessToken) => {
|
|
1392
|
-
void this.removeAccessToken(
|
|
1436
|
+
void this.removeAccessToken(
|
|
1437
|
+
generateCredentialKey(accessToken),
|
|
1438
|
+
request.correlationId
|
|
1439
|
+
);
|
|
1393
1440
|
});
|
|
1394
|
-
if (performanceClient && correlationId) {
|
|
1441
|
+
if (performanceClient && request.correlationId) {
|
|
1395
1442
|
performanceClient.addFields(
|
|
1396
1443
|
{ multiMatchedAT: accessTokens.length },
|
|
1397
|
-
correlationId
|
|
1444
|
+
request.correlationId
|
|
1398
1445
|
);
|
|
1399
1446
|
}
|
|
1400
1447
|
return null;
|
|
@@ -1471,7 +1518,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1471
1518
|
* @param filter
|
|
1472
1519
|
* @returns
|
|
1473
1520
|
*/
|
|
1474
|
-
getAccessTokensByFilter(
|
|
1521
|
+
getAccessTokensByFilter(
|
|
1522
|
+
filter: CredentialFilter,
|
|
1523
|
+
correlationId: string
|
|
1524
|
+
): AccessTokenEntity[] {
|
|
1475
1525
|
const tokenKeys = this.getTokenKeys();
|
|
1476
1526
|
|
|
1477
1527
|
const accessTokens: AccessTokenEntity[] = [];
|
|
@@ -1480,7 +1530,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1480
1530
|
return;
|
|
1481
1531
|
}
|
|
1482
1532
|
|
|
1483
|
-
const accessToken = this.getAccessTokenCredential(
|
|
1533
|
+
const accessToken = this.getAccessTokenCredential(
|
|
1534
|
+
key,
|
|
1535
|
+
correlationId
|
|
1536
|
+
);
|
|
1484
1537
|
if (
|
|
1485
1538
|
accessToken &&
|
|
1486
1539
|
this.credentialMatchesFilter(accessToken, filter)
|
|
@@ -1503,9 +1556,9 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1503
1556
|
getRefreshToken(
|
|
1504
1557
|
account: AccountInfo,
|
|
1505
1558
|
familyRT: boolean,
|
|
1559
|
+
correlationId: string,
|
|
1506
1560
|
tokenKeys?: TokenKeys,
|
|
1507
|
-
performanceClient?: IPerformanceClient
|
|
1508
|
-
correlationId?: string
|
|
1561
|
+
performanceClient?: IPerformanceClient
|
|
1509
1562
|
): RefreshTokenEntity | null {
|
|
1510
1563
|
this.commonLogger.trace("CacheManager - getRefreshToken called");
|
|
1511
1564
|
const id = familyRT ? THE_FAMILY_ID : undefined;
|
|
@@ -1525,7 +1578,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1525
1578
|
refreshTokenKeys.forEach((key) => {
|
|
1526
1579
|
// Validate key
|
|
1527
1580
|
if (this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {
|
|
1528
|
-
const refreshToken = this.getRefreshTokenCredential(
|
|
1581
|
+
const refreshToken = this.getRefreshTokenCredential(
|
|
1582
|
+
key,
|
|
1583
|
+
correlationId
|
|
1584
|
+
);
|
|
1529
1585
|
// Validate value
|
|
1530
1586
|
if (
|
|
1531
1587
|
refreshToken &&
|
|
@@ -2005,9 +2061,6 @@ export class DefaultStorageClass extends CacheManager {
|
|
|
2005
2061
|
getTokenKeys(): TokenKeys {
|
|
2006
2062
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
2007
2063
|
}
|
|
2008
|
-
async clear(): Promise<void> {
|
|
2009
|
-
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
2010
|
-
}
|
|
2011
2064
|
updateCredentialCacheKey(): string {
|
|
2012
2065
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
2013
2066
|
}
|