@azure/msal-common 14.0.0-beta.0 → 14.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/account/AuthToken.js +1 -1
  2. package/dist/account/CcsCredential.js +1 -1
  3. package/dist/account/ClientInfo.js +1 -1
  4. package/dist/authority/Authority.d.ts +1 -0
  5. package/dist/authority/Authority.d.ts.map +1 -1
  6. package/dist/authority/Authority.js +15 -27
  7. package/dist/authority/Authority.js.map +1 -1
  8. package/dist/authority/AuthorityFactory.js +1 -1
  9. package/dist/authority/AuthorityMetadata.js +1 -1
  10. package/dist/authority/AuthorityOptions.js +1 -1
  11. package/dist/authority/AuthorityType.js +1 -1
  12. package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +1 -1
  13. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  14. package/dist/authority/OpenIdConfigResponse.js +1 -1
  15. package/dist/authority/ProtocolMode.js +1 -1
  16. package/dist/authority/RegionDiscovery.js +1 -1
  17. package/dist/cache/CacheManager.js +1 -1
  18. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  19. package/dist/cache/entities/AccountEntity.js +1 -1
  20. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  21. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  22. package/dist/cache/entities/CacheRecord.js +1 -1
  23. package/dist/cache/entities/CredentialEntity.js +1 -1
  24. package/dist/cache/entities/IdTokenEntity.js +1 -1
  25. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  26. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  27. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  28. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  29. package/dist/client/AuthorizationCodeClient.js +1 -1
  30. package/dist/client/BaseClient.js +1 -1
  31. package/dist/client/RefreshTokenClient.js +1 -1
  32. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  33. package/dist/client/SilentFlowClient.js +8 -1
  34. package/dist/client/SilentFlowClient.js.map +1 -1
  35. package/dist/config/ClientConfiguration.d.ts +11 -1
  36. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  37. package/dist/config/ClientConfiguration.js +6 -2
  38. package/dist/config/ClientConfiguration.js.map +1 -1
  39. package/dist/crypto/ICrypto.js +1 -1
  40. package/dist/crypto/JoseHeader.js +1 -1
  41. package/dist/crypto/PopTokenGenerator.js +1 -1
  42. package/dist/error/AuthError.js +1 -1
  43. package/dist/error/ClientAuthError.js +1 -1
  44. package/dist/error/ClientConfigurationError.js +1 -1
  45. package/dist/error/InteractionRequiredAuthError.js +1 -1
  46. package/dist/error/JoseHeaderError.js +1 -1
  47. package/dist/error/ServerError.js +1 -1
  48. package/dist/index.cjs.js +27 -29
  49. package/dist/index.cjs.js.map +1 -1
  50. package/dist/index.d.ts +1 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/logger/Logger.js +1 -1
  54. package/dist/network/INetworkModule.js +1 -1
  55. package/dist/network/NetworkManager.js +1 -1
  56. package/dist/network/ThrottlingUtils.js +1 -1
  57. package/dist/packageMetadata.d.ts +1 -1
  58. package/dist/packageMetadata.js +2 -2
  59. package/dist/request/AuthenticationHeaderParser.js +1 -1
  60. package/dist/request/RequestParameterBuilder.js +1 -1
  61. package/dist/request/RequestValidator.js +1 -1
  62. package/dist/request/ScopeSet.js +1 -1
  63. package/dist/response/ResponseHandler.js +1 -1
  64. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  65. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  66. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  67. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  68. package/dist/url/UrlString.js +1 -1
  69. package/dist/utils/Constants.js +1 -1
  70. package/dist/utils/ProtocolUtils.js +1 -1
  71. package/dist/utils/StringUtils.js +1 -1
  72. package/dist/utils/TimeUtils.js +1 -1
  73. package/package.json +7 -7
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
1
+ /*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
2
2
  'use strict';
3
3
  import { AuthError } from './AuthError.js';
4
4
 
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
1
+ /*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -1296,7 +1296,7 @@ class Logger {
1296
1296
 
1297
1297
  /* eslint-disable header/header */
1298
1298
  const name = "@azure/msal-common";
1299
- const version = "14.0.0-beta.0";
1299
+ const version = "14.0.0-beta.1";
1300
1300
 
1301
1301
  /*
1302
1302
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3155,6 +3155,9 @@ const DEFAULT_LOGGER_IMPLEMENTATION = {
3155
3155
  logLevel: exports.LogLevel.Info,
3156
3156
  correlationId: Constants.EMPTY_STRING,
3157
3157
  };
3158
+ const DEFAULT_CACHE_OPTIONS = {
3159
+ claimsBasedCachingEnabled: false,
3160
+ };
3158
3161
  const DEFAULT_NETWORK_IMPLEMENTATION = {
3159
3162
  async sendGetRequestAsync() {
3160
3163
  const notImplErr = "Network interface - sendGetRequestAsync() has not been implemented";
@@ -3192,7 +3195,7 @@ const DEFAULT_TELEMETRY_OPTIONS = {
3192
3195
  *
3193
3196
  * @returns Configuration
3194
3197
  */
3195
- function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
3198
+ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
3196
3199
  const loggerOptions = {
3197
3200
  ...DEFAULT_LOGGER_IMPLEMENTATION,
3198
3201
  ...userLoggerOption,
@@ -3201,6 +3204,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
3201
3204
  authOptions: buildAuthOptions(userAuthOptions),
3202
3205
  systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
3203
3206
  loggerOptions: loggerOptions,
3207
+ cacheOptions: { ...DEFAULT_CACHE_OPTIONS, ...userCacheOptions },
3204
3208
  storageInterface: storageImplementation ||
3205
3209
  new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),
3206
3210
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
@@ -6170,6 +6174,12 @@ class SilentFlowClient extends BaseClient {
6170
6174
  this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
6171
6175
  throw ClientAuthError.createRefreshRequiredError();
6172
6176
  }
6177
+ else if (!this.config.cacheOptions.claimsBasedCachingEnabled &&
6178
+ !StringUtils.isEmptyObj(request.claims)) {
6179
+ // Must refresh due to request parameters.
6180
+ this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested.");
6181
+ throw ClientAuthError.createRefreshRequiredError();
6182
+ }
6173
6183
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
6174
6184
  if (!request.account) {
6175
6185
  throw ClientAuthError.createNoAccountInSilentRequestError();
@@ -7697,37 +7707,25 @@ class Authority {
7697
7707
  }
7698
7708
  /**
7699
7709
  * Update the retrieved metadata with regional information.
7710
+ * User selected Azure region will be used if configured.
7700
7711
  */
7701
7712
  async updateMetadataWithRegionalInformation(metadata) {
7702
7713
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7703
- this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7704
- const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
7705
- const azureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion ===
7706
- Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
7707
- ? autodetectedRegionName
7708
- : this.authorityOptions.azureRegionConfiguration?.azureRegion;
7709
- if (this.authorityOptions.azureRegionConfiguration?.azureRegion ===
7710
- Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
7711
- this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName
7712
- ? RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL
7713
- : RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
7714
- }
7715
- else {
7716
- if (autodetectedRegionName) {
7717
- this.regionDiscoveryMetadata.region_outcome =
7718
- this.authorityOptions.azureRegionConfiguration
7719
- ?.azureRegion === autodetectedRegionName
7720
- ? RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED
7721
- : RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
7714
+ const userConfiguredAzureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion;
7715
+ if (userConfiguredAzureRegion) {
7716
+ if (userConfiguredAzureRegion !== Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
7717
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
7718
+ this.regionDiscoveryMetadata.region_used = userConfiguredAzureRegion;
7719
+ return Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion);
7722
7720
  }
7723
- else {
7724
- this.regionDiscoveryMetadata.region_outcome =
7725
- RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
7721
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7722
+ const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
7723
+ if (autodetectedRegionName) {
7724
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
7725
+ this.regionDiscoveryMetadata.region_used = autodetectedRegionName;
7726
+ return Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName);
7726
7727
  }
7727
- }
7728
- if (azureRegion) {
7729
- this.regionDiscoveryMetadata.region_used = azureRegion;
7730
- return Authority.replaceWithRegionalInformation(metadata, azureRegion);
7728
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
7731
7729
  }
7732
7730
  return metadata;
7733
7731
  }