@azure/msal-node 1.17.3 → 1.18.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.
@@ -416,7 +416,9 @@ const DEFAULT_AUTH_OPTIONS = {
416
416
  },
417
417
  skipAuthorityMetadataCache: false
418
418
  };
419
- const DEFAULT_CACHE_OPTIONS = {};
419
+ const DEFAULT_CACHE_OPTIONS = {
420
+ claimsBasedCachingEnabled: true
421
+ };
420
422
  const DEFAULT_LOGGER_OPTIONS = {
421
423
  loggerCallback: () => {
422
424
  // allow users to not set logger call back
@@ -1630,7 +1632,7 @@ class TokenCache {
1630
1632
 
1631
1633
  /* eslint-disable header/header */
1632
1634
  const name = "@azure/msal-node";
1633
- const version = "1.17.3";
1635
+ const version = "1.18.0";
1634
1636
 
1635
1637
  /*
1636
1638
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1945,6 +1947,9 @@ class ClientApplication {
1945
1947
  piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled,
1946
1948
  correlationId: requestCorrelationId
1947
1949
  },
1950
+ cacheOptions: {
1951
+ claimsBasedCachingEnabled: this.config.cache.claimsBasedCachingEnabled
1952
+ },
1948
1953
  cryptoInterface: this.cryptoProvider,
1949
1954
  networkInterface: this.config.system.networkClient,
1950
1955
  storageInterface: this.storage,
@@ -1982,8 +1987,10 @@ class ClientApplication {
1982
1987
  this.logger.verbose("Authentication Scheme 'pop' is not supported yet, setting Authentication Scheme to 'Bearer' for request", authRequest.correlationId);
1983
1988
  }
1984
1989
  authRequest.authenticationScheme = AuthenticationScheme.BEARER;
1985
- // Set requested claims hash if claims were requested
1986
- if (authRequest.claims && !StringUtils.isEmpty(authRequest.claims)) {
1990
+ // Set requested claims hash if claims-based caching is enabled and claims were requested
1991
+ if (this.config.cache.claimsBasedCachingEnabled && authRequest.claims &&
1992
+ // Checks for empty stringified object "{}" which doesn't qualify as requested claims
1993
+ !StringUtils.isEmptyObj(authRequest.claims)) {
1987
1994
  authRequest.requestedClaimsHash = await this.cryptoProvider.hashString(authRequest.claims);
1988
1995
  }
1989
1996
  return {