@azure/msal-common 5.0.1 → 6.1.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.
Files changed (186) hide show
  1. package/CHANGELOG.json +1319 -1187
  2. package/CHANGELOG.md +504 -452
  3. package/LICENSE +21 -21
  4. package/README.md +62 -62
  5. package/dist/_virtual/_tslib.js +1 -1
  6. package/dist/account/AuthToken.js +1 -1
  7. package/dist/account/AuthToken.js.map +1 -1
  8. package/dist/account/CcsCredential.js +1 -1
  9. package/dist/account/CcsCredential.js.map +1 -1
  10. package/dist/account/ClientInfo.js +1 -1
  11. package/dist/account/ClientInfo.js.map +1 -1
  12. package/dist/account/TokenClaims.d.ts +1 -0
  13. package/dist/account/TokenClaims.d.ts.map +1 -1
  14. package/dist/authority/Authority.d.ts +9 -1
  15. package/dist/authority/Authority.d.ts.map +1 -1
  16. package/dist/authority/Authority.js +43 -12
  17. package/dist/authority/Authority.js.map +1 -1
  18. package/dist/authority/AuthorityFactory.d.ts +2 -2
  19. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  20. package/dist/authority/AuthorityFactory.js +5 -5
  21. package/dist/authority/AuthorityFactory.js.map +1 -1
  22. package/dist/authority/AuthorityOptions.d.ts +7 -0
  23. package/dist/authority/AuthorityOptions.d.ts.map +1 -1
  24. package/dist/authority/AuthorityOptions.js +22 -0
  25. package/dist/authority/AuthorityOptions.js.map +1 -0
  26. package/dist/authority/AuthorityType.js +1 -1
  27. package/dist/authority/AuthorityType.js.map +1 -1
  28. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  29. package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -1
  30. package/dist/authority/ImdsOptions.d.ts +7 -0
  31. package/dist/authority/ImdsOptions.d.ts.map +1 -0
  32. package/dist/authority/OpenIdConfigResponse.d.ts +1 -1
  33. package/dist/authority/OpenIdConfigResponse.d.ts.map +1 -1
  34. package/dist/authority/OpenIdConfigResponse.js +1 -2
  35. package/dist/authority/OpenIdConfigResponse.js.map +1 -1
  36. package/dist/authority/ProtocolMode.js +1 -1
  37. package/dist/authority/ProtocolMode.js.map +1 -1
  38. package/dist/authority/RegionDiscovery.d.ts +3 -6
  39. package/dist/authority/RegionDiscovery.d.ts.map +1 -1
  40. package/dist/authority/RegionDiscovery.js +19 -11
  41. package/dist/authority/RegionDiscovery.js.map +1 -1
  42. package/dist/cache/CacheManager.d.ts +15 -5
  43. package/dist/cache/CacheManager.d.ts.map +1 -1
  44. package/dist/cache/CacheManager.js +49 -18
  45. package/dist/cache/CacheManager.js.map +1 -1
  46. package/dist/cache/entities/AccessTokenEntity.d.ts +3 -1
  47. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  48. package/dist/cache/entities/AccessTokenEntity.js +23 -10
  49. package/dist/cache/entities/AccessTokenEntity.js.map +1 -1
  50. package/dist/cache/entities/AccountEntity.js +1 -1
  51. package/dist/cache/entities/AccountEntity.js.map +1 -1
  52. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  53. package/dist/cache/entities/AppMetadataEntity.js.map +1 -1
  54. package/dist/cache/entities/AuthorityMetadataEntity.d.ts +1 -1
  55. package/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -1
  56. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -2
  57. package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -1
  58. package/dist/cache/entities/CacheRecord.js +1 -1
  59. package/dist/cache/entities/CacheRecord.js.map +1 -1
  60. package/dist/cache/entities/CredentialEntity.d.ts +13 -2
  61. package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
  62. package/dist/cache/entities/CredentialEntity.js +25 -10
  63. package/dist/cache/entities/CredentialEntity.js.map +1 -1
  64. package/dist/cache/entities/IdTokenEntity.js +1 -1
  65. package/dist/cache/entities/IdTokenEntity.js.map +1 -1
  66. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  67. package/dist/cache/entities/RefreshTokenEntity.js.map +1 -1
  68. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  69. package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -1
  70. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  71. package/dist/cache/entities/ThrottlingEntity.js.map +1 -1
  72. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  73. package/dist/cache/persistence/TokenCacheContext.js.map +1 -1
  74. package/dist/cache/utils/CacheTypes.d.ts +2 -0
  75. package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
  76. package/dist/client/AuthorizationCodeClient.d.ts +1 -0
  77. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  78. package/dist/client/AuthorizationCodeClient.js +49 -10
  79. package/dist/client/AuthorizationCodeClient.js.map +1 -1
  80. package/dist/client/BaseClient.js +2 -2
  81. package/dist/client/BaseClient.js.map +1 -1
  82. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  83. package/dist/client/ClientCredentialClient.js +4 -2
  84. package/dist/client/ClientCredentialClient.js.map +1 -1
  85. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  86. package/dist/client/DeviceCodeClient.js +9 -4
  87. package/dist/client/DeviceCodeClient.js.map +1 -1
  88. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  89. package/dist/client/OnBehalfOfClient.js +4 -2
  90. package/dist/client/OnBehalfOfClient.js.map +1 -1
  91. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  92. package/dist/client/RefreshTokenClient.js +20 -8
  93. package/dist/client/RefreshTokenClient.js.map +1 -1
  94. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  95. package/dist/client/SilentFlowClient.js +14 -18
  96. package/dist/client/SilentFlowClient.js.map +1 -1
  97. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  98. package/dist/client/UsernamePasswordClient.js +4 -2
  99. package/dist/client/UsernamePasswordClient.js.map +1 -1
  100. package/dist/config/ClientConfiguration.d.ts +13 -0
  101. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  102. package/dist/config/ClientConfiguration.js +9 -3
  103. package/dist/config/ClientConfiguration.js.map +1 -1
  104. package/dist/crypto/ICrypto.d.ts +6 -1
  105. package/dist/crypto/ICrypto.d.ts.map +1 -1
  106. package/dist/crypto/ICrypto.js +10 -1
  107. package/dist/crypto/ICrypto.js.map +1 -1
  108. package/dist/crypto/PopTokenGenerator.js +4 -4
  109. package/dist/crypto/PopTokenGenerator.js.map +1 -1
  110. package/dist/error/AuthError.js +1 -1
  111. package/dist/error/AuthError.js.map +1 -1
  112. package/dist/error/ClientAuthError.d.ts +8 -0
  113. package/dist/error/ClientAuthError.d.ts.map +1 -1
  114. package/dist/error/ClientAuthError.js +11 -1
  115. package/dist/error/ClientAuthError.js.map +1 -1
  116. package/dist/error/ClientConfigurationError.d.ts +40 -0
  117. package/dist/error/ClientConfigurationError.d.ts.map +1 -1
  118. package/dist/error/ClientConfigurationError.js +53 -3
  119. package/dist/error/ClientConfigurationError.js.map +1 -1
  120. package/dist/error/InteractionRequiredAuthError.js +1 -1
  121. package/dist/error/InteractionRequiredAuthError.js.map +1 -1
  122. package/dist/error/ServerError.js +1 -1
  123. package/dist/error/ServerError.js.map +1 -1
  124. package/dist/index.cjs.js +445 -115
  125. package/dist/index.cjs.js.map +1 -1
  126. package/dist/index.d.ts +3 -2
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +3 -1
  129. package/dist/index.js.map +1 -1
  130. package/dist/logger/Logger.js +1 -1
  131. package/dist/logger/Logger.js.map +1 -1
  132. package/dist/network/INetworkModule.d.ts +1 -0
  133. package/dist/network/INetworkModule.d.ts.map +1 -1
  134. package/dist/network/INetworkModule.js +1 -1
  135. package/dist/network/INetworkModule.js.map +1 -1
  136. package/dist/network/NetworkManager.js +1 -1
  137. package/dist/network/NetworkManager.js.map +1 -1
  138. package/dist/network/RequestThumbprint.d.ts +2 -0
  139. package/dist/network/RequestThumbprint.d.ts.map +1 -1
  140. package/dist/network/ThrottlingUtils.d.ts.map +1 -1
  141. package/dist/network/ThrottlingUtils.js +4 -2
  142. package/dist/network/ThrottlingUtils.js.map +1 -1
  143. package/dist/packageMetadata.d.ts +1 -1
  144. package/dist/packageMetadata.js +2 -2
  145. package/dist/packageMetadata.js.map +1 -1
  146. package/dist/request/AuthenticationHeaderParser.d.ts +20 -0
  147. package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -0
  148. package/dist/request/AuthenticationHeaderParser.js +64 -0
  149. package/dist/request/AuthenticationHeaderParser.js.map +1 -0
  150. package/dist/request/BaseAuthRequest.d.ts +14 -3
  151. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  152. package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -0
  153. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  154. package/dist/request/CommonEndSessionRequest.d.ts +2 -0
  155. package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
  156. package/dist/request/RequestParameterBuilder.d.ts +8 -0
  157. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  158. package/dist/request/RequestParameterBuilder.js +16 -1
  159. package/dist/request/RequestParameterBuilder.js.map +1 -1
  160. package/dist/request/RequestValidator.js +1 -1
  161. package/dist/request/RequestValidator.js.map +1 -1
  162. package/dist/request/ScopeSet.js +1 -1
  163. package/dist/request/ScopeSet.js.map +1 -1
  164. package/dist/response/AuthenticationResult.d.ts +2 -1
  165. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  166. package/dist/response/ResponseHandler.d.ts +1 -1
  167. package/dist/response/ResponseHandler.d.ts.map +1 -1
  168. package/dist/response/ResponseHandler.js +11 -8
  169. package/dist/response/ResponseHandler.js.map +1 -1
  170. package/dist/response/ServerAuthorizationTokenResponse.d.ts +3 -0
  171. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  172. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  173. package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
  174. package/dist/url/UrlString.js +1 -1
  175. package/dist/url/UrlString.js.map +1 -1
  176. package/dist/utils/Constants.d.ts +9 -3
  177. package/dist/utils/Constants.d.ts.map +1 -1
  178. package/dist/utils/Constants.js +8 -2
  179. package/dist/utils/Constants.js.map +1 -1
  180. package/dist/utils/ProtocolUtils.js +1 -1
  181. package/dist/utils/ProtocolUtils.js.map +1 -1
  182. package/dist/utils/StringUtils.js +1 -1
  183. package/dist/utils/StringUtils.js.map +1 -1
  184. package/dist/utils/TimeUtils.js +1 -1
  185. package/dist/utils/TimeUtils.js.map +1 -1
  186. package/package.json +76 -76
@@ -1,8 +1,6 @@
1
- import { AccountCache, AccountFilter, CredentialFilter, CredentialCache, AppMetadataFilter, AppMetadataCache } from "./utils/CacheTypes";
1
+ import { AccountCache, AccountFilter, CredentialFilter, CredentialCache, ValidCredentialType, AppMetadataFilter, AppMetadataCache } from "./utils/CacheTypes";
2
2
  import { CacheRecord } from "./entities/CacheRecord";
3
- import { AuthenticationScheme } from "../utils/Constants";
4
3
  import { CredentialEntity } from "./entities/CredentialEntity";
5
- import { ScopeSet } from "../request/ScopeSet";
6
4
  import { AccountEntity } from "./entities/AccountEntity";
7
5
  import { AccessTokenEntity } from "./entities/AccessTokenEntity";
8
6
  import { IdTokenEntity } from "./entities/IdTokenEntity";
@@ -14,6 +12,7 @@ import { ServerTelemetryEntity } from "./entities/ServerTelemetryEntity";
14
12
  import { ThrottlingEntity } from "./entities/ThrottlingEntity";
15
13
  import { ICrypto } from "../crypto/ICrypto";
16
14
  import { AuthorityMetadataEntity } from "./entities/AuthorityMetadataEntity";
15
+ import { BaseAuthRequest } from "../request/BaseAuthRequest";
17
16
  /**
18
17
  * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.
19
18
  */
@@ -126,6 +125,10 @@ export declare abstract class CacheManager implements ICacheManager {
126
125
  * Function which clears cache.
127
126
  */
128
127
  abstract clear(): Promise<void>;
128
+ /**
129
+ * Function which updates an outdated credential cache key
130
+ */
131
+ abstract updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
129
132
  /**
130
133
  * Returns all accounts in cache
131
134
  */
@@ -225,7 +228,7 @@ export declare abstract class CacheManager implements ICacheManager {
225
228
  * @param environment
226
229
  * @param authScheme
227
230
  */
228
- readCacheRecord(account: AccountInfo, clientId: string, scopes: ScopeSet, environment: string, authScheme: AuthenticationScheme): CacheRecord;
231
+ readCacheRecord(account: AccountInfo, clientId: string, request: BaseAuthRequest, environment: string): CacheRecord;
229
232
  /**
230
233
  * Retrieve AccountEntity from cache
231
234
  * @param account
@@ -245,7 +248,7 @@ export declare abstract class CacheManager implements ICacheManager {
245
248
  * @param scopes
246
249
  * @param authScheme
247
250
  */
248
- readAccessTokenFromCache(clientId: string, account: AccountInfo, scopes: ScopeSet, authScheme: AuthenticationScheme): AccessTokenEntity | null;
251
+ readAccessTokenFromCache(clientId: string, account: AccountInfo, request: BaseAuthRequest): AccessTokenEntity | null;
249
252
  /**
250
253
  * Helper to retrieve the appropriate refresh token from cache
251
254
  * @param clientId
@@ -317,6 +320,12 @@ export declare abstract class CacheManager implements ICacheManager {
317
320
  * @param tokenType
318
321
  */
319
322
  private matchTokenType;
323
+ /**
324
+ * Returns true if the credential's keyId matches the one in the request, false otherwise
325
+ * @param entity
326
+ * @param tokenType
327
+ */
328
+ private matchKeyId;
320
329
  /**
321
330
  * returns if a given cache entity is of the type appmetadata
322
331
  * @param key
@@ -366,5 +375,6 @@ export declare class DefaultStorageClass extends CacheManager {
366
375
  containsKey(): boolean;
367
376
  getKeys(): string[];
368
377
  clear(): Promise<void>;
378
+ updateCredentialCacheKey(): string;
369
379
  }
370
380
  //# sourceMappingURL=CacheManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CacheManager.d.ts","sourceRoot":"","sources":["../../src/cache/CacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAuB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA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 2022-02-08 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants, CredentialType, AuthenticationScheme, CacheSchemaType, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';
@@ -97,7 +97,8 @@ var CacheManager = /** @class */ (function () {
97
97
  environment: credential.environment,
98
98
  homeAccountId: credential.homeAccountId,
99
99
  realm: credential.realm,
100
- tokenType: credential.tokenType
100
+ tokenType: credential.tokenType,
101
+ requestedClaimsHash: credential.requestedClaimsHash
101
102
  });
102
103
  currentScopes = ScopeSet.fromString(credential.target);
103
104
  currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });
@@ -169,7 +170,7 @@ var CacheManager = /** @class */ (function () {
169
170
  * @param target
170
171
  */
171
172
  CacheManager.prototype.getCredentialsFilteredBy = function (filter) {
172
- return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType);
173
+ return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType, filter.keyId, filter.requestedClaimsHash);
173
174
  };
174
175
  /**
175
176
  * Support function to help match credentials
@@ -182,7 +183,7 @@ var CacheManager = /** @class */ (function () {
182
183
  * @param oboAssertion
183
184
  * @param tokenType
184
185
  */
185
- CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType) {
186
+ CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId, requestedClaimsHash) {
186
187
  var _this = this;
187
188
  var allCacheKeys = this.getKeys();
188
189
  var matchingCredentials = {
@@ -229,27 +230,37 @@ var CacheManager = /** @class */ (function () {
229
230
  if (!!target && !_this.matchTarget(entity, target)) {
230
231
  return;
231
232
  }
233
+ // If request OR cached entity has requested Claims Hash, check if they match
234
+ if (requestedClaimsHash || entity.requestedClaimsHash) {
235
+ // Don't match if either is undefined or they are different
236
+ if (entity.requestedClaimsHash !== requestedClaimsHash) {
237
+ return;
238
+ }
239
+ }
240
+ // Access Token with Auth Scheme specific matching
232
241
  if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
233
242
  if (!!tokenType && !_this.matchTokenType(entity, tokenType)) {
234
243
  return;
235
244
  }
236
- // This check avoids matching outdated POP tokens that don't have the <-scheme> in the cache key
237
- if (cacheKey.indexOf(AuthenticationScheme.POP) === -1) {
238
- // AccessToken_With_AuthScheme that doesn't have pop in the key is outdated
239
- _this.removeItem(cacheKey, CacheSchemaType.CREDENTIAL);
240
- return;
245
+ // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
246
+ if (tokenType === AuthenticationScheme.SSH) {
247
+ if (keyId && !_this.matchKeyId(entity, keyId)) {
248
+ return;
249
+ }
241
250
  }
242
251
  }
252
+ // At this point, the entity matches the request, update cache key if key schema has changed
253
+ var updatedCacheKey = _this.updateCredentialCacheKey(cacheKey, entity);
243
254
  switch (credType) {
244
255
  case CredentialType.ID_TOKEN:
245
- matchingCredentials.idTokens[cacheKey] = entity;
256
+ matchingCredentials.idTokens[updatedCacheKey] = entity;
246
257
  break;
247
258
  case CredentialType.ACCESS_TOKEN:
248
259
  case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
249
- matchingCredentials.accessTokens[cacheKey] = entity;
260
+ matchingCredentials.accessTokens[updatedCacheKey] = entity;
250
261
  break;
251
262
  case CredentialType.REFRESH_TOKEN:
252
- matchingCredentials.refreshTokens[cacheKey] = entity;
263
+ matchingCredentials.refreshTokens[updatedCacheKey] = entity;
253
264
  break;
254
265
  }
255
266
  });
@@ -408,6 +419,7 @@ var CacheManager = /** @class */ (function () {
408
419
  case 0:
409
420
  key = credential.generateCredentialKey();
410
421
  if (!(credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())) return [3 /*break*/, 4];
422
+ if (!(credential.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 4];
411
423
  accessTokenWithAuthSchemeEntity = credential;
412
424
  kid = accessTokenWithAuthSchemeEntity.keyId;
413
425
  if (!kid) return [3 /*break*/, 4];
@@ -447,10 +459,10 @@ var CacheManager = /** @class */ (function () {
447
459
  * @param environment
448
460
  * @param authScheme
449
461
  */
450
- CacheManager.prototype.readCacheRecord = function (account, clientId, scopes, environment, authScheme) {
462
+ CacheManager.prototype.readCacheRecord = function (account, clientId, request, environment) {
451
463
  var cachedAccount = this.readAccountFromCache(account);
452
464
  var cachedIdToken = this.readIdTokenFromCache(clientId, account);
453
- var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, scopes, authScheme);
465
+ var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);
454
466
  var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);
455
467
  var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);
456
468
  if (cachedAccount && cachedIdToken) {
@@ -504,9 +516,14 @@ var CacheManager = /** @class */ (function () {
504
516
  * @param scopes
505
517
  * @param authScheme
506
518
  */
507
- CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, scopes, authScheme) {
508
- // Distinguish between Bearer and PoP token cache types
509
- var credentialType = (authScheme === AuthenticationScheme.POP) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
519
+ CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, request) {
520
+ var scopes = new ScopeSet(request.scopes || []);
521
+ var authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
522
+ /*
523
+ * Distinguish between Bearer and PoP/SSH token cache types
524
+ * Cast to lowercase to handle "bearer" from ADFS
525
+ */
526
+ var credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
510
527
  var accessTokenFilter = {
511
528
  homeAccountId: account.homeAccountId,
512
529
  environment: account.environment,
@@ -514,7 +531,9 @@ var CacheManager = /** @class */ (function () {
514
531
  clientId: clientId,
515
532
  realm: account.tenantId,
516
533
  target: scopes.printScopesLowerCase(),
517
- tokenType: authScheme
534
+ tokenType: authScheme,
535
+ keyId: request.sshKid,
536
+ requestedClaimsHash: request.requestedClaimsHash
518
537
  };
519
538
  var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
520
539
  var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
@@ -667,6 +686,14 @@ var CacheManager = /** @class */ (function () {
667
686
  CacheManager.prototype.matchTokenType = function (entity, tokenType) {
668
687
  return !!(entity.tokenType && entity.tokenType === tokenType);
669
688
  };
689
+ /**
690
+ * Returns true if the credential's keyId matches the one in the request, false otherwise
691
+ * @param entity
692
+ * @param tokenType
693
+ */
694
+ CacheManager.prototype.matchKeyId = function (entity, keyId) {
695
+ return !!(entity.keyId && entity.keyId === keyId);
696
+ };
670
697
  /**
671
698
  * returns if a given cache entity is of the type appmetadata
672
699
  * @param key
@@ -815,6 +842,10 @@ var DefaultStorageClass = /** @class */ (function (_super) {
815
842
  });
816
843
  });
817
844
  };
845
+ DefaultStorageClass.prototype.updateCredentialCacheKey = function () {
846
+ var notImplErr = "Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.";
847
+ throw AuthError.createUnexpectedError(notImplErr);
848
+ };
818
849
  return DefaultStorageClass;
819
850
  }(CacheManager));
820
851
 
@@ -1 +1 @@
1
- {"version":3,"file":"CacheManager.js","sources":["../../src/cache/CacheManager.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountCache, AccountFilter, CredentialFilter, CredentialCache, ValidCredentialType, AppMetadataFilter, AppMetadataCache } from \"./utils/CacheTypes\";\r\nimport { CacheRecord } from \"./entities/CacheRecord\";\r\nimport { CacheSchemaType, CredentialType, Constants, APP_METADATA, THE_FAMILY_ID, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme } from \"../utils/Constants\";\r\nimport { CredentialEntity } from \"./entities/CredentialEntity\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { AccountEntity } from \"./entities/AccountEntity\";\r\nimport { AccessTokenEntity } from \"./entities/AccessTokenEntity\";\r\nimport { IdTokenEntity } from \"./entities/IdTokenEntity\";\r\nimport { RefreshTokenEntity } from \"./entities/RefreshTokenEntity\";\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { ICacheManager } from \"./interface/ICacheManager\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { AccountInfo } from \"../account/AccountInfo\";\r\nimport { AppMetadataEntity } from \"./entities/AppMetadataEntity\";\r\nimport { ServerTelemetryEntity } from \"./entities/ServerTelemetryEntity\";\r\nimport { ThrottlingEntity } from \"./entities/ThrottlingEntity\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { AuthorityMetadataEntity } from \"./entities/AuthorityMetadataEntity\";\r\n\r\n/**\r\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\r\n */\r\nexport abstract class CacheManager implements ICacheManager {\r\n protected clientId: string;\r\n protected cryptoImpl: ICrypto;\r\n\r\n constructor(clientId: string, cryptoImpl: ICrypto) {\r\n this.clientId = clientId;\r\n this.cryptoImpl = cryptoImpl;\r\n }\r\n\r\n /**\r\n * fetch the account entity from the platform cache\r\n * @param accountKey\r\n */\r\n abstract getAccount(accountKey: string): AccountEntity | null;\r\n\r\n /**\r\n * set account entity in the platform cache\r\n * @param account\r\n */\r\n abstract setAccount(account: AccountEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param idTokenKey\r\n */\r\n abstract getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param idToken\r\n */\r\n abstract setIdTokenCredential(idToken: IdTokenEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param accessTokenKey\r\n */\r\n abstract getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param accessToken\r\n */\r\n abstract setAccessTokenCredential(accessToken: AccessTokenEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param refreshTokenKey\r\n */\r\n abstract getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param refreshToken\r\n */\r\n abstract setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;\r\n\r\n /**\r\n * fetch appMetadata entity from the platform cache\r\n * @param appMetadataKey\r\n */\r\n abstract getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;\r\n\r\n /**\r\n * set appMetadata entity to the platform cache\r\n * @param appMetadata\r\n */\r\n abstract setAppMetadata(appMetadata: AppMetadataEntity): void;\r\n\r\n /**\r\n * fetch server telemetry entity from the platform cache\r\n * @param serverTelemetryKey\r\n */\r\n abstract getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;\r\n\r\n /**\r\n * set server telemetry entity to the platform cache\r\n * @param serverTelemetryKey\r\n * @param serverTelemetry\r\n */\r\n abstract setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;\r\n\r\n /**\r\n * fetch cloud discovery metadata entity from the platform cache\r\n * @param key\r\n */\r\n abstract getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;\r\n\r\n /**\r\n * \r\n */\r\n abstract getAuthorityMetadataKeys(): Array<string>;\r\n\r\n /**\r\n * set cloud discovery metadata entity to the platform cache\r\n * @param key\r\n * @param value\r\n */\r\n abstract setAuthorityMetadata(key: string, value: AuthorityMetadataEntity): void;\r\n\r\n /**\r\n * fetch throttling entity from the platform cache\r\n * @param throttlingCacheKey\r\n */\r\n abstract getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;\r\n\r\n /**\r\n * set throttling entity to the platform cache\r\n * @param throttlingCacheKey\r\n * @param throttlingCache\r\n */\r\n abstract setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;;\r\n\r\n /**\r\n * Function to remove an item from cache given its key.\r\n * @param key\r\n */\r\n abstract removeItem(key: string, type?: string): boolean;\r\n\r\n /**\r\n * Function which returns boolean whether cache contains a specific key.\r\n * @param key\r\n */\r\n abstract containsKey(key: string, type?: string): boolean;\r\n\r\n /**\r\n * Function which retrieves all current keys from the cache.\r\n */\r\n abstract getKeys(): string[];\r\n\r\n /**\r\n * Function which clears cache.\r\n */\r\n abstract clear(): Promise<void>;\r\n\r\n /**\r\n * Returns all accounts in cache\r\n */\r\n getAllAccounts(): AccountInfo[] {\r\n const currentAccounts: AccountCache = this.getAccountsFilteredBy();\r\n const accountValues: AccountEntity[] = Object.keys(currentAccounts).map(accountKey => currentAccounts[accountKey]);\r\n const numAccounts = accountValues.length;\r\n if (numAccounts < 1) {\r\n return [];\r\n } else {\r\n const allAccounts = accountValues.map<AccountInfo>((value) => {\r\n const accountEntity = CacheManager.toObject<AccountEntity>(new AccountEntity(), value);\r\n const accountInfo = accountEntity.getAccountInfo();\r\n const idToken = this.readIdTokenFromCache(this.clientId, accountInfo);\r\n if (idToken && !accountInfo.idTokenClaims) {\r\n accountInfo.idTokenClaims = new AuthToken(idToken.secret, this.cryptoImpl).claims;\r\n }\r\n\r\n return accountInfo;\r\n \r\n });\r\n return allAccounts;\r\n }\r\n }\r\n\r\n /**\r\n * saves a cache record\r\n * @param cacheRecord\r\n */\r\n async saveCacheRecord(cacheRecord: CacheRecord): Promise<void> {\r\n if (!cacheRecord) {\r\n throw ClientAuthError.createNullOrUndefinedCacheRecord();\r\n }\r\n\r\n if (!!cacheRecord.account) {\r\n this.setAccount(cacheRecord.account);\r\n }\r\n\r\n if (!!cacheRecord.idToken) {\r\n this.setIdTokenCredential(cacheRecord.idToken);\r\n }\r\n\r\n if (!!cacheRecord.accessToken) {\r\n await this.saveAccessToken(cacheRecord.accessToken);\r\n }\r\n\r\n if (!!cacheRecord.refreshToken) {\r\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\r\n }\r\n\r\n if (!!cacheRecord.appMetadata) {\r\n this.setAppMetadata(cacheRecord.appMetadata);\r\n }\r\n }\r\n\r\n /**\r\n * saves access token credential\r\n * @param credential\r\n */\r\n private async saveAccessToken(credential: AccessTokenEntity): Promise<void> {\r\n const currentTokenCache = this.getCredentialsFilteredBy({\r\n clientId: credential.clientId,\r\n credentialType: credential.credentialType,\r\n environment: credential.environment,\r\n homeAccountId: credential.homeAccountId,\r\n realm: credential.realm,\r\n tokenType: credential.tokenType\r\n });\r\n\r\n const currentScopes = ScopeSet.fromString(credential.target);\r\n const currentAccessTokens: AccessTokenEntity[] = Object.keys(currentTokenCache.accessTokens).map(key => currentTokenCache.accessTokens[key]);\r\n\r\n if (currentAccessTokens) {\r\n const removedAccessTokens: Array<Promise<boolean>> = [];\r\n currentAccessTokens.forEach((tokenEntity) => {\r\n const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\r\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\r\n removedAccessTokens.push(this.removeCredential(tokenEntity));\r\n }\r\n });\r\n await Promise.all(removedAccessTokens);\r\n }\r\n this.setAccessTokenCredential(credential);\r\n }\r\n\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n getAccountsFilteredBy(accountFilter?: AccountFilter): AccountCache {\r\n return this.getAccountsFilteredByInternal(\r\n accountFilter ? accountFilter.homeAccountId : \"\",\r\n accountFilter ? accountFilter.environment : \"\",\r\n accountFilter ? accountFilter.realm : \"\"\r\n );\r\n }\r\n\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n private getAccountsFilteredByInternal(\r\n homeAccountId?: string,\r\n environment?: string,\r\n realm?: string\r\n ): AccountCache {\r\n const allCacheKeys = this.getKeys();\r\n const matchingAccounts: AccountCache = {};\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n const entity: AccountEntity | null = this.getAccount(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!homeAccountId && !this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!realm && !this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n\r\n matchingAccounts[cacheKey] = entity;\r\n });\r\n\r\n return matchingAccounts;\r\n }\r\n\r\n /**\r\n * retrieve credentails matching all provided filters; if no filter is set, get all credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n */\r\n getCredentialsFilteredBy(filter: CredentialFilter): CredentialCache {\r\n return this.getCredentialsFilteredByInternal(\r\n filter.homeAccountId,\r\n filter.environment,\r\n filter.credentialType,\r\n filter.clientId,\r\n filter.familyId,\r\n filter.realm,\r\n filter.target,\r\n filter.oboAssertion,\r\n filter.tokenType\r\n );\r\n }\r\n\r\n /**\r\n * Support function to help match credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n * @param oboAssertion\r\n * @param tokenType\r\n */\r\n private getCredentialsFilteredByInternal(\r\n homeAccountId?: string,\r\n environment?: string,\r\n credentialType?: string,\r\n clientId?: string,\r\n familyId?: string,\r\n realm?: string,\r\n target?: string,\r\n oboAssertion?: string,\r\n tokenType?: AuthenticationScheme\r\n ): CredentialCache {\r\n const allCacheKeys = this.getKeys();\r\n const matchingCredentials: CredentialCache = {\r\n idTokens: {},\r\n accessTokens: {},\r\n refreshTokens: {},\r\n };\r\n \r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-credential type cache entities\r\n const credType = CredentialEntity.getCredentialType(cacheKey);\r\n\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getSpecificCredential(cacheKey, credType);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!oboAssertion && !this.matchOboAssertion(entity, oboAssertion)) {\r\n return;\r\n }\r\n\r\n if (!!homeAccountId && !this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!realm && !this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n\r\n if (!!credentialType && !this.matchCredentialType(entity, credentialType)) {\r\n return;\r\n }\r\n\r\n if (!!clientId && !this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n\r\n if (!!familyId && !this.matchFamilyId(entity, familyId)) {\r\n return;\r\n }\r\n\r\n /*\r\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\r\n * Resource specific refresh tokens case will be added when the support is deemed necessary\r\n */\r\n if (!!target && !this.matchTarget(entity, target)) {\r\n return;\r\n }\r\n\r\n if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {\r\n if(!!tokenType && !this.matchTokenType(entity, tokenType)) {\r\n return;\r\n }\r\n\r\n // This check avoids matching outdated POP tokens that don't have the <-scheme> in the cache key\r\n if(cacheKey.indexOf(AuthenticationScheme.POP) === -1) {\r\n // AccessToken_With_AuthScheme that doesn't have pop in the key is outdated\r\n this.removeItem(cacheKey, CacheSchemaType.CREDENTIAL);\r\n return;\r\n }\r\n }\r\n\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN:\r\n matchingCredentials.idTokens[cacheKey] = entity as IdTokenEntity;\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n matchingCredentials.accessTokens[cacheKey] = entity as AccessTokenEntity;\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n matchingCredentials.refreshTokens[cacheKey] = entity as RefreshTokenEntity;\r\n break;\r\n }\r\n });\r\n\r\n return matchingCredentials;\r\n }\r\n\r\n /**\r\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\r\n * @param filter\r\n */\r\n getAppMetadataFilteredBy(filter: AppMetadataFilter): AppMetadataCache {\r\n return this.getAppMetadataFilteredByInternal(\r\n filter.environment,\r\n filter.clientId,\r\n );\r\n }\r\n\r\n /**\r\n * Support function to help match appMetadata\r\n * @param environment\r\n * @param clientId\r\n */\r\n private getAppMetadataFilteredByInternal(\r\n environment?: string,\r\n clientId?: string\r\n ): AppMetadataCache {\r\n\r\n const allCacheKeys = this.getKeys();\r\n const matchingAppMetadata: AppMetadataCache = {};\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-appMetadata type cache entities\r\n if (!this.isAppMetadata(cacheKey)) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getAppMetadata(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!clientId && !this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n\r\n matchingAppMetadata[cacheKey] = entity;\r\n\r\n });\r\n\r\n return matchingAppMetadata;\r\n }\r\n\r\n /**\r\n * retrieve authorityMetadata that contains a matching alias\r\n * @param filter\r\n */\r\n getAuthorityMetadataByAlias(host: string): AuthorityMetadataEntity | null {\r\n const allCacheKeys = this.getAuthorityMetadataKeys();\r\n let matchedEntity = null;\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-authorityMetadata type cache entities\r\n if (!this.isAuthorityMetadata(cacheKey) || cacheKey.indexOf(this.clientId) === -1) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getAuthorityMetadata(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (entity.aliases.indexOf(host) === -1) {\r\n return;\r\n }\r\n\r\n matchedEntity = entity;\r\n\r\n });\r\n \r\n return matchedEntity;\r\n }\r\n\r\n /**\r\n * Removes all accounts and related tokens from cache.\r\n */\r\n async removeAllAccounts(): Promise<boolean> {\r\n const allCacheKeys = this.getKeys();\r\n const removedAccounts: Array<Promise<boolean>> = [];\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n const entity = this.getAccount(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n removedAccounts.push(this.removeAccount(cacheKey));\r\n });\r\n \r\n await Promise.all(removedAccounts);\r\n return true;\r\n }\r\n\r\n /**\r\n * returns a boolean if the given account is removed\r\n * @param account\r\n */\r\n async removeAccount(accountKey: string): Promise<boolean> {\r\n const account = this.getAccount(accountKey);\r\n if (!account) {\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n return (await this.removeAccountContext(account) && this.removeItem(accountKey, CacheSchemaType.ACCOUNT));\r\n }\r\n\r\n /**\r\n * returns a boolean if the given account is removed\r\n * @param account\r\n */\r\n async removeAccountContext(account: AccountEntity): Promise<boolean> {\r\n const allCacheKeys = this.getKeys();\r\n const accountId = account.generateAccountId();\r\n const removedCredentials: Array<Promise<boolean>> = [];\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-credential type cache entities\r\n const credType = CredentialEntity.getCredentialType(cacheKey);\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n\r\n const cacheEntity = this.getSpecificCredential(cacheKey, credType);\r\n if (!!cacheEntity && accountId === cacheEntity.generateAccountId()) {\r\n removedCredentials.push(this.removeCredential(cacheEntity));\r\n }\r\n });\r\n\r\n await Promise.all(removedCredentials);\r\n return true;\r\n }\r\n\r\n /**\r\n * returns a boolean if the given credential is removed\r\n * @param credential\r\n */\r\n async removeCredential(credential: CredentialEntity): Promise<boolean> {\r\n const key = credential.generateCredentialKey();\r\n\r\n // Remove Token Binding Key from key store for Auth Scheme Credentials\r\n if (credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {\r\n const accessTokenWithAuthSchemeEntity = credential as AccessTokenEntity;\r\n const kid = accessTokenWithAuthSchemeEntity.keyId;\r\n\r\n if (kid) {\r\n try {\r\n await this.cryptoImpl.removeTokenBindingKey(kid);\r\n } catch (error) {\r\n throw ClientAuthError.createBindingKeyNotRemovedError();\r\n }\r\n }\r\n }\r\n\r\n return this.removeItem(key, CacheSchemaType.CREDENTIAL);\r\n }\r\n\r\n /**\r\n * Removes all app metadata objects from cache.\r\n */\r\n removeAppMetadata(): boolean {\r\n const allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach((cacheKey) => {\r\n if (this.isAppMetadata(cacheKey)) {\r\n this.removeItem(cacheKey, CacheSchemaType.APP_METADATA);\r\n }\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Retrieve the cached credentials into a cacherecord\r\n * @param account\r\n * @param clientId\r\n * @param scopes\r\n * @param environment\r\n * @param authScheme\r\n */\r\n readCacheRecord(account: AccountInfo, clientId: string, scopes: ScopeSet, environment: string, authScheme: AuthenticationScheme): CacheRecord {\r\n const cachedAccount = this.readAccountFromCache(account);\r\n const cachedIdToken = this.readIdTokenFromCache(clientId, account);\r\n const cachedAccessToken = this.readAccessTokenFromCache(clientId, account, scopes, authScheme);\r\n const cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);\r\n const cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n\r\n if (cachedAccount && cachedIdToken) {\r\n cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;\r\n }\r\n\r\n return {\r\n account: cachedAccount,\r\n idToken: cachedIdToken,\r\n accessToken: cachedAccessToken,\r\n refreshToken: cachedRefreshToken,\r\n appMetadata: cachedAppMetadata,\r\n };\r\n }\r\n\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param account\r\n */\r\n readAccountFromCache(account: AccountInfo): AccountEntity | null {\r\n const accountKey: string = AccountEntity.generateAccountCacheKey(account);\r\n return this.getAccount(accountKey);\r\n }\r\n\r\n /**\r\n * Retrieve IdTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param inputRealm\r\n */\r\n readIdTokenFromCache(clientId: string, account: AccountInfo): IdTokenEntity | null {\r\n const idTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: clientId,\r\n realm: account.tenantId,\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(idTokenFilter);\r\n const idTokens = Object.keys(credentialCache.idTokens).map((key) => credentialCache.idTokens[key]);\r\n const numIdTokens = idTokens.length;\r\n\r\n if (numIdTokens < 1) {\r\n return null;\r\n } else if (numIdTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n\r\n return idTokens[0] as IdTokenEntity;\r\n }\r\n\r\n /**\r\n * Retrieve AccessTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param scopes\r\n * @param authScheme\r\n */\r\n readAccessTokenFromCache(clientId: string, account: AccountInfo, scopes: ScopeSet, authScheme: AuthenticationScheme): AccessTokenEntity | null {\r\n // Distinguish between Bearer and PoP token cache types\r\n const credentialType = (authScheme === AuthenticationScheme.POP) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\r\n\r\n const accessTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: credentialType,\r\n clientId,\r\n realm: account.tenantId,\r\n target: scopes.printScopesLowerCase(),\r\n tokenType: authScheme\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(accessTokenFilter);\r\n\r\n const accessTokens = Object.keys(credentialCache.accessTokens).map((key) => credentialCache.accessTokens[key]);\r\n \r\n const numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n return null;\r\n } else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n\r\n return accessTokens[0] as AccessTokenEntity;\r\n }\r\n\r\n /**\r\n * Helper to retrieve the appropriate refresh token from cache\r\n * @param clientId\r\n * @param account\r\n * @param familyRT\r\n */\r\n readRefreshTokenFromCache(clientId: string, account: AccountInfo, familyRT: boolean): RefreshTokenEntity | null {\r\n const id = familyRT ? THE_FAMILY_ID : undefined;\r\n const refreshTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n clientId: clientId,\r\n familyId: id\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);\r\n const refreshTokens = Object.keys(credentialCache.refreshTokens).map((key) => credentialCache.refreshTokens[key]);\r\n\r\n const numRefreshTokens = refreshTokens.length;\r\n if (numRefreshTokens < 1) {\r\n return null;\r\n }\r\n // address the else case after remove functions address environment aliases\r\n\r\n return refreshTokens[0] as RefreshTokenEntity;\r\n }\r\n\r\n /**\r\n * Retrieve AppMetadataEntity from cache\r\n */\r\n readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity | null {\r\n const appMetadataFilter: AppMetadataFilter = {\r\n environment,\r\n clientId,\r\n };\r\n\r\n const appMetadata: AppMetadataCache = this.getAppMetadataFilteredBy(appMetadataFilter);\r\n const appMetadataEntries: AppMetadataEntity[] = Object.keys(appMetadata).map((key) => appMetadata[key]);\r\n\r\n const numAppMetadata = appMetadataEntries.length;\r\n if (numAppMetadata < 1) {\r\n return null;\r\n } else if (numAppMetadata > 1) {\r\n throw ClientAuthError.createMultipleMatchingAppMetadataInCacheError();\r\n }\r\n\r\n return appMetadataEntries[0] as AppMetadataEntity;\r\n }\r\n\r\n /**\r\n * Return the family_id value associated with FOCI\r\n * @param environment\r\n * @param clientId\r\n */\r\n isAppMetadataFOCI(environment: string, clientId: string): boolean {\r\n const appMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\r\n }\r\n\r\n /**\r\n * helper to match account ids\r\n * @param value\r\n * @param homeAccountId\r\n */\r\n private matchHomeAccountId(entity: AccountEntity | CredentialEntity, homeAccountId: string): boolean {\r\n return !!(entity.homeAccountId && homeAccountId === entity.homeAccountId);\r\n }\r\n\r\n /**\r\n * helper to match assertion\r\n * @param value\r\n * @param oboAssertion\r\n */\r\n private matchOboAssertion(entity: AccountEntity | CredentialEntity, oboAssertion: string): boolean {\r\n return !!(entity.oboAssertion && oboAssertion === entity.oboAssertion);\r\n }\r\n\r\n /**\r\n * helper to match environment\r\n * @param value\r\n * @param environment\r\n */\r\n private matchEnvironment(entity: AccountEntity | CredentialEntity | AppMetadataEntity, environment: string): boolean {\r\n const cloudMetadata = this.getAuthorityMetadataByAlias(environment);\r\n if (cloudMetadata && cloudMetadata.aliases.indexOf(entity.environment) > -1) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * helper to match credential type\r\n * @param entity\r\n * @param credentialType\r\n */\r\n private matchCredentialType(entity: CredentialEntity, credentialType: string): boolean {\r\n return (entity.credentialType && credentialType.toLowerCase() === entity.credentialType.toLowerCase());\r\n }\r\n\r\n /**\r\n * helper to match client ids\r\n * @param entity\r\n * @param clientId\r\n */\r\n private matchClientId(entity: CredentialEntity | AppMetadataEntity, clientId: string): boolean {\r\n return !!(entity.clientId && clientId === entity.clientId);\r\n }\r\n\r\n /**\r\n * helper to match family ids\r\n * @param entity\r\n * @param familyId\r\n */\r\n private matchFamilyId(entity: CredentialEntity | AppMetadataEntity, familyId: string): boolean {\r\n return !!(entity.familyId && familyId === entity.familyId);\r\n }\r\n\r\n /**\r\n * helper to match realm\r\n * @param entity\r\n * @param realm\r\n */\r\n private matchRealm(entity: AccountEntity | CredentialEntity, realm: string): boolean {\r\n return !!(entity.realm && realm === entity.realm);\r\n }\r\n\r\n /**\r\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\r\n * @param entity\r\n * @param target\r\n */\r\n private matchTarget(entity: CredentialEntity, target: string): boolean {\r\n const isNotAccessTokenCredential = (entity.credentialType !== CredentialType.ACCESS_TOKEN && entity.credentialType !== CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME);\r\n\r\n if ( isNotAccessTokenCredential || !entity.target) {\r\n return false;\r\n }\r\n\r\n const entityScopeSet: ScopeSet = ScopeSet.fromString(entity.target);\r\n const requestTargetScopeSet: ScopeSet = ScopeSet.fromString(target);\r\n\r\n if (!requestTargetScopeSet.containsOnlyOIDCScopes()) {\r\n requestTargetScopeSet.removeOIDCScopes(); // ignore OIDC scopes\r\n } else {\r\n requestTargetScopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);\r\n }\r\n return entityScopeSet.containsScopeSet(requestTargetScopeSet);\r\n }\r\n\r\n /**\r\n * Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise\r\n * @param entity \r\n * @param tokenType \r\n */\r\n private matchTokenType(entity: CredentialEntity, tokenType: AuthenticationScheme): boolean {\r\n return !!(entity.tokenType && entity.tokenType === tokenType);\r\n }\r\n\r\n /**\r\n * returns if a given cache entity is of the type appmetadata\r\n * @param key\r\n */\r\n private isAppMetadata(key: string): boolean {\r\n return key.indexOf(APP_METADATA) !== -1;\r\n }\r\n\r\n /**\r\n * returns if a given cache entity is of the type authoritymetadata\r\n * @param key\r\n */\r\n protected isAuthorityMetadata(key: string): boolean {\r\n return key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) !== -1;\r\n }\r\n\r\n /**\r\n * returns cache key used for cloud instance metadata\r\n */\r\n generateAuthorityMetadataCacheKey(authority: string): string {\r\n return `${AUTHORITY_METADATA_CONSTANTS.CACHE_KEY}-${this.clientId}-${authority}`;\r\n }\r\n\r\n /**\r\n * Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache\r\n * @param key\r\n * @param credType\r\n */\r\n private getSpecificCredential(key: string, credType: string): ValidCredentialType | null {\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN: {\r\n return this.getIdTokenCredential(key);\r\n }\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME: {\r\n return this.getAccessTokenCredential(key);\r\n }\r\n case CredentialType.REFRESH_TOKEN: {\r\n return this.getRefreshTokenCredential(key);\r\n }\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Helper to convert serialized data to object\r\n * @param obj\r\n * @param json\r\n */\r\n static toObject<T>(obj: T, json: object): T {\r\n for (const propertyName in json) {\r\n obj[propertyName] = json[propertyName];\r\n }\r\n return obj;\r\n }\r\n}\r\n\r\nexport class DefaultStorageClass extends CacheManager {\r\n setAccount(): void {\r\n const notImplErr = \"Storage interface - setAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAccount(): AccountEntity {\r\n const notImplErr = \"Storage interface - getAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setIdTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getIdTokenCredential(): IdTokenEntity {\r\n const notImplErr = \"Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAccessTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAccessTokenCredential(): AccessTokenEntity {\r\n const notImplErr = \"Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setRefreshTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getRefreshTokenCredential(): RefreshTokenEntity {\r\n const notImplErr = \"Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAppMetadata(): void {\r\n const notImplErr = \"Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAppMetadata(): AppMetadataEntity {\r\n const notImplErr = \"Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setServerTelemetry(): void {\r\n const notImplErr = \"Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getServerTelemetry(): ServerTelemetryEntity {\r\n const notImplErr = \"Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAuthorityMetadata(): void {\r\n const notImplErr = \"Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAuthorityMetadata(): AuthorityMetadataEntity | null {\r\n const notImplErr = \"Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAuthorityMetadataKeys(): Array<string> {\r\n const notImplErr = \"Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setThrottlingCache(): void {\r\n const notImplErr = \"Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getThrottlingCache(): ThrottlingEntity {\r\n const notImplErr = \"Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n removeItem(): boolean {\r\n const notImplErr = \"Storage interface - removeItem() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n containsKey(): boolean {\r\n const notImplErr = \"Storage interface - containsKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getKeys(): string[] {\r\n const notImplErr = \"Storage interface - getKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n async clear(): Promise<void> {\r\n const notImplErr = \"Storage interface - clear() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;AAyBA;;;;IAOI,sBAAY,QAAgB,EAAE,UAAmB;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAChC;;;;IAmID,qCAAc,GAAd;QAAA,iBAoBC;QAnBG,IAAM,eAAe,GAAiB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACnE,IAAM,aAAa,GAAoB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,UAAA,UAAU,IAAI,OAAA,eAAe,CAAC,UAAU,CAAC,GAAA,CAAC,CAAC;QACnH,IAAM,WAAW,GAAG,aAAa,C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BAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,wCAAU,GAAV;QACI,IAAM,UAAU,GAAG,2FAA2F,CAAC;QAC/G,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,yCAAW,GAAX;QACI,IAAM,UAAU,GAAG,4FAA4F,CAAC;QAChH,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,qCAAO,GAAP;QACI,IAAM,UAAU,GAAG,wFAAwF,CAAC;QAC5G,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACK,mCAAK,GAAX;;;;gBACU,UAAU,GAAG,sFAAsF,CAAC;gBAC1G,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;IACL,0BAAC;AAAD,CArFA,CAAyC,YAAY;;;;"}
1
+ {"version":3,"file":"CacheManager.js","sources":["../../src/cache/CacheManager.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountCache, AccountFilter, CredentialFilter, CredentialCache, ValidCredentialType, AppMetadataFilter, AppMetadataCache } from \"./utils/CacheTypes\";\nimport { CacheRecord } from \"./entities/CacheRecord\";\nimport { CacheSchemaType, CredentialType, Constants, APP_METADATA, THE_FAMILY_ID, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme } from \"../utils/Constants\";\nimport { CredentialEntity } from \"./entities/CredentialEntity\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AccountEntity } from \"./entities/AccountEntity\";\nimport { AccessTokenEntity } from \"./entities/AccessTokenEntity\";\nimport { IdTokenEntity } from \"./entities/IdTokenEntity\";\nimport { RefreshTokenEntity } from \"./entities/RefreshTokenEntity\";\nimport { AuthError } from \"../error/AuthError\";\nimport { ICacheManager } from \"./interface/ICacheManager\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { AccountInfo } from \"../account/AccountInfo\";\nimport { AppMetadataEntity } from \"./entities/AppMetadataEntity\";\nimport { ServerTelemetryEntity } from \"./entities/ServerTelemetryEntity\";\nimport { ThrottlingEntity } from \"./entities/ThrottlingEntity\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { ICrypto } from \"../crypto/ICrypto\";\nimport { AuthorityMetadataEntity } from \"./entities/AuthorityMetadataEntity\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\n\n/**\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\n */\nexport abstract class CacheManager implements ICacheManager {\n protected clientId: string;\n protected cryptoImpl: ICrypto;\n\n constructor(clientId: string, cryptoImpl: ICrypto) {\n this.clientId = clientId;\n this.cryptoImpl = cryptoImpl;\n }\n\n /**\n * fetch the account entity from the platform cache\n * @param accountKey\n */\n abstract getAccount(accountKey: string): AccountEntity | null;\n\n /**\n * set account entity in the platform cache\n * @param account\n */\n abstract setAccount(account: AccountEntity): void;\n\n /**\n * fetch the idToken entity from the platform cache\n * @param idTokenKey\n */\n abstract getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;\n\n /**\n * set idToken entity to the platform cache\n * @param idToken\n */\n abstract setIdTokenCredential(idToken: IdTokenEntity): void;\n\n /**\n * fetch the idToken entity from the platform cache\n * @param accessTokenKey\n */\n abstract getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;\n\n /**\n * set idToken entity to the platform cache\n * @param accessToken\n */\n abstract setAccessTokenCredential(accessToken: AccessTokenEntity): void;\n\n /**\n * fetch the idToken entity from the platform cache\n * @param refreshTokenKey\n */\n abstract getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;\n\n /**\n * set idToken entity to the platform cache\n * @param refreshToken\n */\n abstract setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;\n\n /**\n * fetch appMetadata entity from the platform cache\n * @param appMetadataKey\n */\n abstract getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;\n\n /**\n * set appMetadata entity to the platform cache\n * @param appMetadata\n */\n abstract setAppMetadata(appMetadata: AppMetadataEntity): void;\n\n /**\n * fetch server telemetry entity from the platform cache\n * @param serverTelemetryKey\n */\n abstract getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;\n\n /**\n * set server telemetry entity to the platform cache\n * @param serverTelemetryKey\n * @param serverTelemetry\n */\n abstract setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;\n\n /**\n * fetch cloud discovery metadata entity from the platform cache\n * @param key\n */\n abstract getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;\n\n /**\n * \n */\n abstract getAuthorityMetadataKeys(): Array<string>;\n\n /**\n * set cloud discovery metadata entity to the platform cache\n * @param key\n * @param value\n */\n abstract setAuthorityMetadata(key: string, value: AuthorityMetadataEntity): void;\n\n /**\n * fetch throttling entity from the platform cache\n * @param throttlingCacheKey\n */\n abstract getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;\n\n /**\n * set throttling entity to the platform cache\n * @param throttlingCacheKey\n * @param throttlingCache\n */\n abstract setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;;\n\n /**\n * Function to remove an item from cache given its key.\n * @param key\n */\n abstract removeItem(key: string, type?: string): boolean;\n\n /**\n * Function which returns boolean whether cache contains a specific key.\n * @param key\n */\n abstract containsKey(key: string, type?: string): boolean;\n\n /**\n * Function which retrieves all current keys from the cache.\n */\n abstract getKeys(): string[];\n\n /**\n * Function which clears cache.\n */\n abstract clear(): Promise<void>;\n\n /**\n * Function which updates an outdated credential cache key\n */\n abstract updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;\n\n /**\n * Returns all accounts in cache\n */\n getAllAccounts(): AccountInfo[] {\n const currentAccounts: AccountCache = this.getAccountsFilteredBy();\n const accountValues: AccountEntity[] = Object.keys(currentAccounts).map(accountKey => currentAccounts[accountKey]);\n const numAccounts = accountValues.length;\n if (numAccounts < 1) {\n return [];\n } else {\n const allAccounts = accountValues.map<AccountInfo>((value) => {\n const accountEntity = CacheManager.toObject<AccountEntity>(new AccountEntity(), value);\n const accountInfo = accountEntity.getAccountInfo();\n const idToken = this.readIdTokenFromCache(this.clientId, accountInfo);\n if (idToken && !accountInfo.idTokenClaims) {\n accountInfo.idTokenClaims = new AuthToken(idToken.secret, this.cryptoImpl).claims;\n }\n\n return accountInfo;\n \n });\n return allAccounts;\n }\n }\n\n /**\n * saves a cache record\n * @param cacheRecord\n */\n async saveCacheRecord(cacheRecord: CacheRecord): Promise<void> {\n if (!cacheRecord) {\n throw ClientAuthError.createNullOrUndefinedCacheRecord();\n }\n\n if (!!cacheRecord.account) {\n this.setAccount(cacheRecord.account);\n }\n\n if (!!cacheRecord.idToken) {\n this.setIdTokenCredential(cacheRecord.idToken);\n }\n\n if (!!cacheRecord.accessToken) {\n await this.saveAccessToken(cacheRecord.accessToken);\n }\n\n if (!!cacheRecord.refreshToken) {\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\n }\n\n if (!!cacheRecord.appMetadata) {\n this.setAppMetadata(cacheRecord.appMetadata);\n }\n }\n\n /**\n * saves access token credential\n * @param credential\n */\n private async saveAccessToken(credential: AccessTokenEntity): Promise<void> {\n const currentTokenCache = this.getCredentialsFilteredBy({\n clientId: credential.clientId,\n credentialType: credential.credentialType,\n environment: credential.environment,\n homeAccountId: credential.homeAccountId,\n realm: credential.realm,\n tokenType: credential.tokenType,\n requestedClaimsHash: credential.requestedClaimsHash\n });\n\n const currentScopes = ScopeSet.fromString(credential.target);\n const currentAccessTokens: AccessTokenEntity[] = Object.keys(currentTokenCache.accessTokens).map(key => currentTokenCache.accessTokens[key]);\n\n if (currentAccessTokens) {\n const removedAccessTokens: Array<Promise<boolean>> = [];\n currentAccessTokens.forEach((tokenEntity) => {\n const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\n removedAccessTokens.push(this.removeCredential(tokenEntity));\n }\n });\n await Promise.all(removedAccessTokens);\n }\n this.setAccessTokenCredential(credential);\n }\n\n /**\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\n * @param homeAccountId\n * @param environment\n * @param realm\n */\n getAccountsFilteredBy(accountFilter?: AccountFilter): AccountCache {\n return this.getAccountsFilteredByInternal(\n accountFilter ? accountFilter.homeAccountId : \"\",\n accountFilter ? accountFilter.environment : \"\",\n accountFilter ? accountFilter.realm : \"\"\n );\n }\n\n /**\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\n * @param homeAccountId\n * @param environment\n * @param realm\n */\n private getAccountsFilteredByInternal(\n homeAccountId?: string,\n environment?: string,\n realm?: string\n ): AccountCache {\n const allCacheKeys = this.getKeys();\n const matchingAccounts: AccountCache = {};\n\n allCacheKeys.forEach((cacheKey) => {\n const entity: AccountEntity | null = this.getAccount(cacheKey);\n\n if (!entity) {\n return;\n }\n\n if (!!homeAccountId && !this.matchHomeAccountId(entity, homeAccountId)) {\n return;\n }\n\n if (!!environment && !this.matchEnvironment(entity, environment)) {\n return;\n }\n\n if (!!realm && !this.matchRealm(entity, realm)) {\n return;\n }\n\n matchingAccounts[cacheKey] = entity;\n });\n\n return matchingAccounts;\n }\n\n /**\n * retrieve credentails matching all provided filters; if no filter is set, get all credentials\n * @param homeAccountId\n * @param environment\n * @param credentialType\n * @param clientId\n * @param realm\n * @param target\n */\n getCredentialsFilteredBy(filter: CredentialFilter): CredentialCache {\n return this.getCredentialsFilteredByInternal(\n filter.homeAccountId,\n filter.environment,\n filter.credentialType,\n filter.clientId,\n filter.familyId,\n filter.realm,\n filter.target,\n filter.oboAssertion,\n filter.tokenType,\n filter.keyId,\n filter.requestedClaimsHash\n );\n }\n\n /**\n * Support function to help match credentials\n * @param homeAccountId\n * @param environment\n * @param credentialType\n * @param clientId\n * @param realm\n * @param target\n * @param oboAssertion\n * @param tokenType\n */\n private getCredentialsFilteredByInternal(\n homeAccountId?: string,\n environment?: string,\n credentialType?: string,\n clientId?: string,\n familyId?: string,\n realm?: string,\n target?: string,\n oboAssertion?: string,\n tokenType?: AuthenticationScheme,\n keyId?: string,\n requestedClaimsHash?: string\n ): CredentialCache {\n const allCacheKeys = this.getKeys();\n const matchingCredentials: CredentialCache = {\n idTokens: {},\n accessTokens: {},\n refreshTokens: {},\n };\n \n allCacheKeys.forEach((cacheKey) => {\n // don't parse any non-credential type cache entities\n const credType = CredentialEntity.getCredentialType(cacheKey);\n\n if (credType === Constants.NOT_DEFINED) {\n return;\n }\n\n // Attempt retrieval\n const entity = this.getSpecificCredential(cacheKey, credType);\n\n if (!entity) {\n return;\n }\n\n if (!!oboAssertion && !this.matchOboAssertion(entity, oboAssertion)) {\n return;\n }\n\n if (!!homeAccountId && !this.matchHomeAccountId(entity, homeAccountId)) {\n return;\n }\n\n if (!!environment && !this.matchEnvironment(entity, environment)) {\n return;\n }\n\n if (!!realm && !this.matchRealm(entity, realm)) {\n return;\n }\n\n if (!!credentialType && !this.matchCredentialType(entity, credentialType)) {\n return;\n }\n\n if (!!clientId && !this.matchClientId(entity, clientId)) {\n return;\n }\n\n if (!!familyId && !this.matchFamilyId(entity, familyId)) {\n return;\n }\n\n /*\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\n * Resource specific refresh tokens case will be added when the support is deemed necessary\n */\n if (!!target && !this.matchTarget(entity, target)) {\n return;\n }\n \n // If request OR cached entity has requested Claims Hash, check if they match\n if (requestedClaimsHash || entity.requestedClaimsHash) {\n // Don't match if either is undefined or they are different\n if (entity.requestedClaimsHash !== requestedClaimsHash) {\n return;\n }\n }\n\n // Access Token with Auth Scheme specific matching\n if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {\n if(!!tokenType && !this.matchTokenType(entity, tokenType)) {\n return;\n }\n\n // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key\n if (tokenType === AuthenticationScheme.SSH) {\n if(keyId && !this.matchKeyId(entity, keyId)) {\n return;\n }\n }\n }\n\n // At this point, the entity matches the request, update cache key if key schema has changed\n const updatedCacheKey = this.updateCredentialCacheKey(cacheKey, entity);\n\n switch (credType) {\n case CredentialType.ID_TOKEN:\n matchingCredentials.idTokens[updatedCacheKey] = entity as IdTokenEntity;\n break;\n case CredentialType.ACCESS_TOKEN:\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\n matchingCredentials.accessTokens[updatedCacheKey] = entity as AccessTokenEntity;\n break;\n case CredentialType.REFRESH_TOKEN:\n matchingCredentials.refreshTokens[updatedCacheKey] = entity as RefreshTokenEntity;\n break;\n }\n });\n\n return matchingCredentials;\n }\n\n /**\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\n * @param filter\n */\n getAppMetadataFilteredBy(filter: AppMetadataFilter): AppMetadataCache {\n return this.getAppMetadataFilteredByInternal(\n filter.environment,\n filter.clientId,\n );\n }\n\n /**\n * Support function to help match appMetadata\n * @param environment\n * @param clientId\n */\n private getAppMetadataFilteredByInternal(\n environment?: string,\n clientId?: string\n ): AppMetadataCache {\n\n const allCacheKeys = this.getKeys();\n const matchingAppMetadata: AppMetadataCache = {};\n\n allCacheKeys.forEach((cacheKey) => {\n // don't parse any non-appMetadata type cache entities\n if (!this.isAppMetadata(cacheKey)) {\n return;\n }\n\n // Attempt retrieval\n const entity = this.getAppMetadata(cacheKey);\n\n if (!entity) {\n return;\n }\n\n if (!!environment && !this.matchEnvironment(entity, environment)) {\n return;\n }\n\n if (!!clientId && !this.matchClientId(entity, clientId)) {\n return;\n }\n\n matchingAppMetadata[cacheKey] = entity;\n\n });\n\n return matchingAppMetadata;\n }\n\n /**\n * retrieve authorityMetadata that contains a matching alias\n * @param filter\n */\n getAuthorityMetadataByAlias(host: string): AuthorityMetadataEntity | null {\n const allCacheKeys = this.getAuthorityMetadataKeys();\n let matchedEntity = null;\n\n allCacheKeys.forEach((cacheKey) => {\n // don't parse any non-authorityMetadata type cache entities\n if (!this.isAuthorityMetadata(cacheKey) || cacheKey.indexOf(this.clientId) === -1) {\n return;\n }\n\n // Attempt retrieval\n const entity = this.getAuthorityMetadata(cacheKey);\n\n if (!entity) {\n return;\n }\n\n if (entity.aliases.indexOf(host) === -1) {\n return;\n }\n\n matchedEntity = entity;\n\n });\n \n return matchedEntity;\n }\n\n /**\n * Removes all accounts and related tokens from cache.\n */\n async removeAllAccounts(): Promise<boolean> {\n const allCacheKeys = this.getKeys();\n const removedAccounts: Array<Promise<boolean>> = [];\n\n allCacheKeys.forEach((cacheKey) => {\n const entity = this.getAccount(cacheKey);\n if (!entity) {\n return;\n }\n removedAccounts.push(this.removeAccount(cacheKey));\n });\n \n await Promise.all(removedAccounts);\n return true;\n }\n\n /**\n * returns a boolean if the given account is removed\n * @param account\n */\n async removeAccount(accountKey: string): Promise<boolean> {\n const account = this.getAccount(accountKey);\n if (!account) {\n throw ClientAuthError.createNoAccountFoundError();\n }\n return (await this.removeAccountContext(account) && this.removeItem(accountKey, CacheSchemaType.ACCOUNT));\n }\n\n /**\n * returns a boolean if the given account is removed\n * @param account\n */\n async removeAccountContext(account: AccountEntity): Promise<boolean> {\n const allCacheKeys = this.getKeys();\n const accountId = account.generateAccountId();\n const removedCredentials: Array<Promise<boolean>> = [];\n\n allCacheKeys.forEach((cacheKey) => {\n // don't parse any non-credential type cache entities\n const credType = CredentialEntity.getCredentialType(cacheKey);\n if (credType === Constants.NOT_DEFINED) {\n return;\n }\n\n const cacheEntity = this.getSpecificCredential(cacheKey, credType);\n if (!!cacheEntity && accountId === cacheEntity.generateAccountId()) {\n removedCredentials.push(this.removeCredential(cacheEntity));\n }\n });\n\n await Promise.all(removedCredentials);\n return true;\n }\n\n /**\n * returns a boolean if the given credential is removed\n * @param credential\n */\n async removeCredential(credential: CredentialEntity): Promise<boolean> {\n const key = credential.generateCredentialKey();\n\n // Remove Token Binding Key from key store for PoP Tokens Credentials\n if (credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {\n if(credential.tokenType === AuthenticationScheme.POP) {\n const accessTokenWithAuthSchemeEntity = credential as AccessTokenEntity;\n const kid = accessTokenWithAuthSchemeEntity.keyId;\n \n if (kid) {\n try {\n await this.cryptoImpl.removeTokenBindingKey(kid);\n } catch (error) {\n throw ClientAuthError.createBindingKeyNotRemovedError();\n }\n }\n }\n }\n\n return this.removeItem(key, CacheSchemaType.CREDENTIAL);\n }\n\n /**\n * Removes all app metadata objects from cache.\n */\n removeAppMetadata(): boolean {\n const allCacheKeys = this.getKeys();\n allCacheKeys.forEach((cacheKey) => {\n if (this.isAppMetadata(cacheKey)) {\n this.removeItem(cacheKey, CacheSchemaType.APP_METADATA);\n }\n });\n\n return true;\n }\n\n /**\n * Retrieve the cached credentials into a cacherecord\n * @param account\n * @param clientId\n * @param scopes\n * @param environment\n * @param authScheme\n */\n readCacheRecord(account: AccountInfo, clientId: string, request: BaseAuthRequest, environment: string): CacheRecord {\n\n const cachedAccount = this.readAccountFromCache(account);\n const cachedIdToken = this.readIdTokenFromCache(clientId, account);\n const cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);\n const cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);\n const cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);\n\n if (cachedAccount && cachedIdToken) {\n cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;\n }\n\n return {\n account: cachedAccount,\n idToken: cachedIdToken,\n accessToken: cachedAccessToken,\n refreshToken: cachedRefreshToken,\n appMetadata: cachedAppMetadata,\n };\n }\n\n /**\n * Retrieve AccountEntity from cache\n * @param account\n */\n readAccountFromCache(account: AccountInfo): AccountEntity | null {\n const accountKey: string = AccountEntity.generateAccountCacheKey(account);\n return this.getAccount(accountKey);\n }\n\n /**\n * Retrieve IdTokenEntity from cache\n * @param clientId\n * @param account\n * @param inputRealm\n */\n readIdTokenFromCache(clientId: string, account: AccountInfo): IdTokenEntity | null {\n const idTokenFilter: CredentialFilter = {\n homeAccountId: account.homeAccountId,\n environment: account.environment,\n credentialType: CredentialType.ID_TOKEN,\n clientId: clientId,\n realm: account.tenantId,\n };\n\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(idTokenFilter);\n const idTokens = Object.keys(credentialCache.idTokens).map((key) => credentialCache.idTokens[key]);\n const numIdTokens = idTokens.length;\n\n if (numIdTokens < 1) {\n return null;\n } else if (numIdTokens > 1) {\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\n }\n\n return idTokens[0] as IdTokenEntity;\n }\n\n /**\n * Retrieve AccessTokenEntity from cache\n * @param clientId\n * @param account\n * @param scopes\n * @param authScheme\n */\n readAccessTokenFromCache(clientId: string, account: AccountInfo, request: BaseAuthRequest): AccessTokenEntity | null {\n const scopes = new ScopeSet(request.scopes || []);\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\n /*\n * Distinguish between Bearer and PoP/SSH token cache types\n * Cast to lowercase to handle \"bearer\" from ADFS\n */\n const credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\n\n const accessTokenFilter: CredentialFilter = {\n homeAccountId: account.homeAccountId,\n environment: account.environment,\n credentialType: credentialType,\n clientId,\n realm: account.tenantId,\n target: scopes.printScopesLowerCase(),\n tokenType: authScheme,\n keyId: request.sshKid,\n requestedClaimsHash: request.requestedClaimsHash\n };\n\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(accessTokenFilter);\n \n const accessTokens = Object.keys(credentialCache.accessTokens).map((key) => credentialCache.accessTokens[key]);\n \n const numAccessTokens = accessTokens.length;\n if (numAccessTokens < 1) {\n return null;\n } else if (numAccessTokens > 1) {\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\n }\n\n return accessTokens[0] as AccessTokenEntity;\n }\n\n /**\n * Helper to retrieve the appropriate refresh token from cache\n * @param clientId\n * @param account\n * @param familyRT\n */\n readRefreshTokenFromCache(clientId: string, account: AccountInfo, familyRT: boolean): RefreshTokenEntity | null {\n const id = familyRT ? THE_FAMILY_ID : undefined;\n const refreshTokenFilter: CredentialFilter = {\n homeAccountId: account.homeAccountId,\n environment: account.environment,\n credentialType: CredentialType.REFRESH_TOKEN,\n clientId: clientId,\n familyId: id\n };\n\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);\n const refreshTokens = Object.keys(credentialCache.refreshTokens).map((key) => credentialCache.refreshTokens[key]);\n\n const numRefreshTokens = refreshTokens.length;\n if (numRefreshTokens < 1) {\n return null;\n }\n // address the else case after remove functions address environment aliases\n\n return refreshTokens[0] as RefreshTokenEntity;\n }\n\n /**\n * Retrieve AppMetadataEntity from cache\n */\n readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity | null {\n const appMetadataFilter: AppMetadataFilter = {\n environment,\n clientId,\n };\n\n const appMetadata: AppMetadataCache = this.getAppMetadataFilteredBy(appMetadataFilter);\n const appMetadataEntries: AppMetadataEntity[] = Object.keys(appMetadata).map((key) => appMetadata[key]);\n\n const numAppMetadata = appMetadataEntries.length;\n if (numAppMetadata < 1) {\n return null;\n } else if (numAppMetadata > 1) {\n throw ClientAuthError.createMultipleMatchingAppMetadataInCacheError();\n }\n\n return appMetadataEntries[0] as AppMetadataEntity;\n }\n\n /**\n * Return the family_id value associated with FOCI\n * @param environment\n * @param clientId\n */\n isAppMetadataFOCI(environment: string, clientId: string): boolean {\n const appMetadata = this.readAppMetadataFromCache(environment, clientId);\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\n }\n\n /**\n * helper to match account ids\n * @param value\n * @param homeAccountId\n */\n private matchHomeAccountId(entity: AccountEntity | CredentialEntity, homeAccountId: string): boolean {\n return !!(entity.homeAccountId && homeAccountId === entity.homeAccountId);\n }\n\n /**\n * helper to match assertion\n * @param value\n * @param oboAssertion\n */\n private matchOboAssertion(entity: AccountEntity | CredentialEntity, oboAssertion: string): boolean {\n return !!(entity.oboAssertion && oboAssertion === entity.oboAssertion);\n }\n\n /**\n * helper to match environment\n * @param value\n * @param environment\n */\n private matchEnvironment(entity: AccountEntity | CredentialEntity | AppMetadataEntity, environment: string): boolean {\n const cloudMetadata = this.getAuthorityMetadataByAlias(environment);\n if (cloudMetadata && cloudMetadata.aliases.indexOf(entity.environment) > -1) {\n return true;\n }\n\n return false;\n }\n\n /**\n * helper to match credential type\n * @param entity\n * @param credentialType\n */\n private matchCredentialType(entity: CredentialEntity, credentialType: string): boolean {\n return (entity.credentialType && credentialType.toLowerCase() === entity.credentialType.toLowerCase());\n }\n\n /**\n * helper to match client ids\n * @param entity\n * @param clientId\n */\n private matchClientId(entity: CredentialEntity | AppMetadataEntity, clientId: string): boolean {\n return !!(entity.clientId && clientId === entity.clientId);\n }\n\n /**\n * helper to match family ids\n * @param entity\n * @param familyId\n */\n private matchFamilyId(entity: CredentialEntity | AppMetadataEntity, familyId: string): boolean {\n return !!(entity.familyId && familyId === entity.familyId);\n }\n\n /**\n * helper to match realm\n * @param entity\n * @param realm\n */\n private matchRealm(entity: AccountEntity | CredentialEntity, realm: string): boolean {\n return !!(entity.realm && realm === entity.realm);\n }\n\n /**\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\n * @param entity\n * @param target\n */\n private matchTarget(entity: CredentialEntity, target: string): boolean {\n const isNotAccessTokenCredential = (entity.credentialType !== CredentialType.ACCESS_TOKEN && entity.credentialType !== CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME);\n\n if ( isNotAccessTokenCredential || !entity.target) {\n return false;\n }\n\n const entityScopeSet: ScopeSet = ScopeSet.fromString(entity.target);\n const requestTargetScopeSet: ScopeSet = ScopeSet.fromString(target);\n\n if (!requestTargetScopeSet.containsOnlyOIDCScopes()) {\n requestTargetScopeSet.removeOIDCScopes(); // ignore OIDC scopes\n } else {\n requestTargetScopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);\n }\n return entityScopeSet.containsScopeSet(requestTargetScopeSet);\n }\n\n /**\n * Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise\n * @param entity \n * @param tokenType \n */\n private matchTokenType(entity: CredentialEntity, tokenType: AuthenticationScheme): boolean {\n return !!(entity.tokenType && entity.tokenType === tokenType);\n }\n\n /**\n * Returns true if the credential's keyId matches the one in the request, false otherwise\n * @param entity \n * @param tokenType \n */\n private matchKeyId(entity: CredentialEntity, keyId: string): boolean {\n return !!(entity.keyId && entity.keyId === keyId);\n }\n\n /**\n * returns if a given cache entity is of the type appmetadata\n * @param key\n */\n private isAppMetadata(key: string): boolean {\n return key.indexOf(APP_METADATA) !== -1;\n }\n\n /**\n * returns if a given cache entity is of the type authoritymetadata\n * @param key\n */\n protected isAuthorityMetadata(key: string): boolean {\n return key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) !== -1;\n }\n\n /**\n * returns cache key used for cloud instance metadata\n */\n generateAuthorityMetadataCacheKey(authority: string): string {\n return `${AUTHORITY_METADATA_CONSTANTS.CACHE_KEY}-${this.clientId}-${authority}`;\n }\n\n /**\n * Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache\n * @param key\n * @param credType\n */\n private getSpecificCredential(key: string, credType: string): ValidCredentialType | null {\n switch (credType) {\n case CredentialType.ID_TOKEN: {\n return this.getIdTokenCredential(key);\n }\n case CredentialType.ACCESS_TOKEN:\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME: {\n return this.getAccessTokenCredential(key);\n }\n case CredentialType.REFRESH_TOKEN: {\n return this.getRefreshTokenCredential(key);\n }\n default:\n return null;\n }\n }\n\n /**\n * Helper to convert serialized data to object\n * @param obj\n * @param json\n */\n static toObject<T>(obj: T, json: object): T {\n for (const propertyName in json) {\n obj[propertyName] = json[propertyName];\n }\n return obj;\n }\n}\n\nexport class DefaultStorageClass extends CacheManager {\n setAccount(): void {\n const notImplErr = \"Storage interface - setAccount() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getAccount(): AccountEntity {\n const notImplErr = \"Storage interface - getAccount() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setIdTokenCredential(): void {\n const notImplErr = \"Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getIdTokenCredential(): IdTokenEntity {\n const notImplErr = \"Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setAccessTokenCredential(): void {\n const notImplErr = \"Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getAccessTokenCredential(): AccessTokenEntity {\n const notImplErr = \"Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setRefreshTokenCredential(): void {\n const notImplErr = \"Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getRefreshTokenCredential(): RefreshTokenEntity {\n const notImplErr = \"Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setAppMetadata(): void {\n const notImplErr = \"Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getAppMetadata(): AppMetadataEntity {\n const notImplErr = \"Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setServerTelemetry(): void {\n const notImplErr = \"Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getServerTelemetry(): ServerTelemetryEntity {\n const notImplErr = \"Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setAuthorityMetadata(): void {\n const notImplErr = \"Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getAuthorityMetadata(): AuthorityMetadataEntity | null {\n const notImplErr = \"Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getAuthorityMetadataKeys(): Array<string> {\n const notImplErr = \"Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n setThrottlingCache(): void {\n const notImplErr = \"Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getThrottlingCache(): ThrottlingEntity {\n const notImplErr = \"Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n removeItem(): boolean {\n const notImplErr = \"Storage interface - removeItem() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n containsKey(): boolean {\n const notImplErr = \"Storage interface - containsKey() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n getKeys(): string[] {\n const notImplErr = \"Storage interface - getKeys() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n async clear(): Promise<void> {\n const notImplErr = \"Storage interface - clear() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n updateCredentialCacheKey(): string {\n const notImplErr = \"Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.\";\n throw AuthError.createUnexpectedError(notImplErr);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;AA0BA;;;;IAOI,sBAAY,QAAgB,EAAE,UAAmB;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,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S,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,yCAAW,GAAX;QACI,IAAM,UAAU,GAAG,4FAA4F,CAAC;QAChH,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACD,qCAAO,GAAP;QACI,IAAM,UAAU,GAAG,wFAAwF,CAAC;QAC5G,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACK,mCAAK,GAAX;;;;gBACU,UAAU,GAAG,sFAAsF,CAAC;gBAC1G,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;;;KACrD;IACD,sDAAwB,GAAxB;QACI,IAAM,UAAU,GAAG,yGAAyG,CAAC;QAC7H,MAAM,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACrD;IACL,0BAAC;AAAD,CAzFA,CAAyC,YAAY;;;;"}
@@ -34,6 +34,8 @@ export declare class AccessTokenEntity extends CredentialEntity {
34
34
  refreshOn?: string;
35
35
  keyId?: string;
36
36
  tokenType?: AuthenticationScheme;
37
+ requestedClaims?: string;
38
+ requestedClaimsHash?: string;
37
39
  /**
38
40
  * Create AccessTokenEntity
39
41
  * @param homeAccountId
@@ -45,7 +47,7 @@ export declare class AccessTokenEntity extends CredentialEntity {
45
47
  * @param expiresOn
46
48
  * @param extExpiresOn
47
49
  */
48
- static createAccessTokenEntity(homeAccountId: string, environment: string, accessToken: string, clientId: string, tenantId: string, scopes: string, expiresOn: number, extExpiresOn: number, cryptoUtils: ICrypto, refreshOn?: number, tokenType?: AuthenticationScheme, oboAssertion?: string): AccessTokenEntity;
50
+ static createAccessTokenEntity(homeAccountId: string, environment: string, accessToken: string, clientId: string, tenantId: string, scopes: string, expiresOn: number, extExpiresOn: number, cryptoUtils: ICrypto, refreshOn?: number, tokenType?: AuthenticationScheme, oboAssertion?: string, keyId?: string, requestedClaims?: string, requestedClaimsHash?: string): AccessTokenEntity;
49
51
  /**
50
52
  * Validates an entity: checks for all expected params
51
53
  * @param entity
@@ -1 +1 @@
1
- {"version":3,"file":"AccessTokenEntity.d.ts","sourceRoot":"","sources":["../../../src/cache/entities/AccessTokenEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAkB,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAK/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAEjC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,uBAAuB,CAC1B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,oBAAoB,EAChC,YAAY,CAAC,EAAE,MAAM,GACtB,iBAAiB;IA0CpB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAiBtD"}
1
+ {"version":3,"file":"AccessTokenEntity.d.ts","sourceRoot":"","sources":["../../../src/cache/entities/AccessTokenEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,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../_virtual/_tslib.js';
4
4
  import { CredentialEntity } from './CredentialEntity.js';
@@ -52,8 +52,8 @@ var AccessTokenEntity = /** @class */ (function (_super) {
52
52
  * @param expiresOn
53
53
  * @param extExpiresOn
54
54
  */
55
- AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion) {
56
- var _a;
55
+ AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId, requestedClaims, requestedClaimsHash) {
56
+ var _a, _b;
57
57
  var atEntity = new AccessTokenEntity();
58
58
  atEntity.homeAccountId = homeAccountId;
59
59
  atEntity.credentialType = CredentialType.ACCESS_TOKEN;
@@ -75,15 +75,28 @@ var AccessTokenEntity = /** @class */ (function (_super) {
75
75
  atEntity.target = scopes;
76
76
  atEntity.oboAssertion = oboAssertion;
77
77
  atEntity.tokenType = StringUtils.isEmpty(tokenType) ? AuthenticationScheme.BEARER : tokenType;
78
- // Create Access Token With AuthScheme instead of regular access token
79
- if (atEntity.tokenType === AuthenticationScheme.POP) {
78
+ if (requestedClaims) {
79
+ atEntity.requestedClaims = requestedClaims;
80
+ atEntity.requestedClaimsHash = requestedClaimsHash;
81
+ }
82
+ /*
83
+ * Create Access Token With Auth Scheme instead of regular access token
84
+ * Cast to lower to handle "bearer" from ADFS
85
+ */
86
+ if (((_a = atEntity.tokenType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== AuthenticationScheme.BEARER.toLowerCase()) {
80
87
  atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
81
- // Make sure keyId is present and add it to credential
82
- var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
83
- if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {
84
- throw ClientAuthError.createTokenClaimsRequiredError();
88
+ switch (atEntity.tokenType) {
89
+ case AuthenticationScheme.POP:
90
+ // Make sure keyId is present and add it to credential
91
+ var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
92
+ if (!((_b = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _b === void 0 ? void 0 : _b.kid)) {
93
+ throw ClientAuthError.createTokenClaimsRequiredError();
94
+ }
95
+ atEntity.keyId = tokenClaims.cnf.kid;
96
+ break;
97
+ case AuthenticationScheme.SSH:
98
+ atEntity.keyId = keyId;
85
99
  }
86
- atEntity.keyId = tokenClaims.cnf.kid;
87
100
  }
88
101
  return atEntity;
89
102
  };