@azure/msal-common 8.0.0 → 9.0.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 (77) hide show
  1. package/dist/_virtual/_tslib.js +1 -1
  2. package/dist/account/AuthToken.js +1 -1
  3. package/dist/account/CcsCredential.js +1 -1
  4. package/dist/account/ClientInfo.js +1 -1
  5. package/dist/authority/Authority.d.ts +3 -1
  6. package/dist/authority/Authority.d.ts.map +1 -1
  7. package/dist/authority/Authority.js +34 -10
  8. package/dist/authority/Authority.js.map +1 -1
  9. package/dist/authority/AuthorityFactory.d.ts +3 -2
  10. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  11. package/dist/authority/AuthorityFactory.js +5 -5
  12. package/dist/authority/AuthorityFactory.js.map +1 -1
  13. package/dist/authority/AuthorityMetadata.js +1 -1
  14. package/dist/authority/AuthorityOptions.js +1 -1
  15. package/dist/authority/AuthorityType.js +1 -1
  16. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  17. package/dist/authority/OpenIdConfigResponse.js +1 -1
  18. package/dist/authority/ProtocolMode.js +1 -1
  19. package/dist/authority/RegionDiscovery.js +1 -1
  20. package/dist/cache/CacheManager.js +1 -1
  21. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  22. package/dist/cache/entities/AccountEntity.js +1 -1
  23. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  24. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  25. package/dist/cache/entities/CacheRecord.js +1 -1
  26. package/dist/cache/entities/CredentialEntity.js +1 -1
  27. package/dist/cache/entities/IdTokenEntity.js +1 -1
  28. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  29. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  30. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  31. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  32. package/dist/client/AuthorizationCodeClient.js +1 -1
  33. package/dist/client/BaseClient.js +1 -1
  34. package/dist/client/ClientCredentialClient.js +1 -1
  35. package/dist/client/DeviceCodeClient.js +1 -1
  36. package/dist/client/OnBehalfOfClient.js +1 -1
  37. package/dist/client/RefreshTokenClient.js +1 -1
  38. package/dist/client/SilentFlowClient.js +1 -1
  39. package/dist/client/UsernamePasswordClient.js +1 -1
  40. package/dist/config/ClientConfiguration.js +1 -1
  41. package/dist/crypto/ICrypto.js +1 -1
  42. package/dist/crypto/JoseHeader.js +1 -1
  43. package/dist/crypto/PopTokenGenerator.js +1 -1
  44. package/dist/error/AuthError.js +1 -1
  45. package/dist/error/ClientAuthError.js +1 -1
  46. package/dist/error/ClientConfigurationError.js +1 -1
  47. package/dist/error/InteractionRequiredAuthError.js +1 -1
  48. package/dist/error/JoseHeaderError.js +1 -1
  49. package/dist/error/ServerError.js +1 -1
  50. package/dist/index.cjs.js +40 -15
  51. package/dist/index.cjs.js.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/packageMetadata.js.map +1 -1
  60. package/dist/request/AuthenticationHeaderParser.js +1 -1
  61. package/dist/request/RequestParameterBuilder.js +1 -1
  62. package/dist/request/RequestValidator.js +1 -1
  63. package/dist/request/ScopeSet.js +1 -1
  64. package/dist/response/ResponseHandler.js +1 -1
  65. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  66. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  67. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  68. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  69. package/dist/url/UrlString.js +1 -1
  70. package/dist/utils/Constants.d.ts +1 -0
  71. package/dist/utils/Constants.d.ts.map +1 -1
  72. package/dist/utils/Constants.js +2 -1
  73. package/dist/utils/Constants.js.map +1 -1
  74. package/dist/utils/ProtocolUtils.js +1 -1
  75. package/dist/utils/StringUtils.js +1 -1
  76. package/dist/utils/TimeUtils.js +1 -1
  77. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../../_virtual/_tslib.js';
4
4
  import { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { ThrottlingConstants } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { buildClientConfiguration } from '../config/ClientConfiguration.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from '../error/AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { JoseHeaderError } from '../error/JoseHeaderError.js';
4
4
  import { JsonTypes } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { TimeUtils } from '../utils/TimeUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { ClientAuthError } from './ClientAuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.0 2022-11-22 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -131,6 +131,7 @@ var Constants = {
131
131
  AUTHORIZATION_PENDING: "authorization_pending",
132
132
  NOT_DEFINED: "not_defined",
133
133
  EMPTY_STRING: "",
134
+ NOT_APPLICABLE: "N/A",
134
135
  FORWARD_SLASH: "/",
135
136
  IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
136
137
  IMDS_VERSION: "2020-06-01",
@@ -1409,7 +1410,7 @@ var Logger = /** @class */ (function () {
1409
1410
 
1410
1411
  /* eslint-disable header/header */
1411
1412
  var name = "@azure/msal-common";
1412
- var version = "8.0.0";
1413
+ var version = "9.0.0";
1413
1414
 
1414
1415
  /*
1415
1416
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7152,7 +7153,7 @@ var RegionDiscovery = /** @class */ (function () {
7152
7153
  * endpoint. It will store the pertinent config data in this object for use during token calls.
7153
7154
  */
7154
7155
  var Authority = /** @class */ (function () {
7155
- function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
7156
+ function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
7156
7157
  this.canonicalAuthority = authority;
7157
7158
  this._canonicalAuthority.validateAsUri();
7158
7159
  this.networkInterface = networkInterface;
@@ -7161,6 +7162,7 @@ var Authority = /** @class */ (function () {
7161
7162
  this.regionDiscovery = new RegionDiscovery(networkInterface);
7162
7163
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
7163
7164
  this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
7165
+ this.logger = logger;
7164
7166
  }
7165
7167
  Object.defineProperty(Authority.prototype, "authorityType", {
7166
7168
  // See above for AuthorityType
@@ -7587,36 +7589,50 @@ var Authority = /** @class */ (function () {
7587
7589
  */
7588
7590
  Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
7589
7591
  return __awaiter(this, void 0, void 0, function () {
7590
- var metadata, harcodedMetadata;
7592
+ var metadata, metadataEntityExpired, harcodedMetadata;
7591
7593
  return __generator(this, function (_a) {
7592
7594
  switch (_a.label) {
7593
7595
  case 0:
7596
+ this.logger.verbose("Attempting to get cloud discovery metadata in the config");
7597
+ this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
7598
+ this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
7599
+ this.logger.verbosePii("Canonical Authority: " + (metadataEntity.canonical_authority || Constants.NOT_APPLICABLE));
7594
7600
  metadata = this.getCloudDiscoveryMetadataFromConfig();
7595
7601
  if (metadata) {
7602
+ this.logger.verbose("Found cloud discovery metadata in the config.");
7596
7603
  metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
7597
7604
  return [2 /*return*/, AuthorityMetadataSource.CONFIG];
7598
7605
  }
7599
- // If The cached metadata came from config but that config was not passed to this instance, we must go to the network
7600
- if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntity.isExpired()) {
7606
+ // If the cached metadata came from config but that config was not passed to this instance, we must go to the network
7607
+ this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.");
7608
+ metadataEntityExpired = metadataEntity.isExpired();
7609
+ if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {
7610
+ this.logger.verbose("Found metadata in the cache.");
7601
7611
  // No need to update
7602
7612
  return [2 /*return*/, AuthorityMetadataSource.CACHE];
7603
7613
  }
7604
- harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
7614
+ else if (metadataEntityExpired) {
7615
+ this.logger.verbose("The metadata entity is expired.");
7616
+ }
7617
+ this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
7605
7618
  return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
7606
7619
  case 1:
7607
7620
  metadata = _a.sent();
7608
7621
  if (metadata) {
7622
+ this.logger.verbose("Found cloud discovery metadata from the network.");
7609
7623
  metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
7610
7624
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
7611
7625
  }
7626
+ this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.");
7627
+ harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
7612
7628
  if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
7629
+ this.logger.verbose("Found cloud discovery metadata from hardcoded values.");
7613
7630
  metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
7614
7631
  return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
7615
7632
  }
7616
- else {
7617
- // Metadata could not be obtained from config, cache or network
7618
- throw ClientConfigurationError.createUntrustedAuthorityError();
7619
- }
7633
+ // Metadata could not be obtained from config, cache or network
7634
+ this.logger.verbose("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded value. Throwing Untrusted Authority Error.");
7635
+ throw ClientConfigurationError.createUntrustedAuthorityError();
7620
7636
  }
7621
7637
  });
7622
7638
  });
@@ -7627,19 +7643,28 @@ var Authority = /** @class */ (function () {
7627
7643
  Authority.prototype.getCloudDiscoveryMetadataFromConfig = function () {
7628
7644
  // Check if network response was provided in config
7629
7645
  if (this.authorityOptions.cloudDiscoveryMetadata) {
7646
+ this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");
7630
7647
  try {
7648
+ this.logger.verbose("Attempting to parse the cloud discovery metadata.");
7631
7649
  var parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata);
7632
7650
  var metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(parsedResponse.metadata, this.hostnameAndPort);
7651
+ this.logger.verbose("Parsed the cloud discovery metadata.");
7633
7652
  if (metadata) {
7653
+ this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata.");
7634
7654
  return metadata;
7635
7655
  }
7656
+ else {
7657
+ this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.");
7658
+ }
7636
7659
  }
7637
7660
  catch (e) {
7661
+ this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.");
7638
7662
  throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();
7639
7663
  }
7640
7664
  }
7641
7665
  // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities
7642
7666
  if (this.isInKnownAuthorities()) {
7667
+ this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.");
7643
7668
  return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
7644
7669
  }
7645
7670
  return null;
@@ -7830,13 +7855,13 @@ var AuthorityFactory = /** @class */ (function () {
7830
7855
  * @param networkClient
7831
7856
  * @param protocolMode
7832
7857
  */
7833
- AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
7858
+ AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl) {
7834
7859
  return __awaiter(this, void 0, void 0, function () {
7835
7860
  var acquireTokenAuthority, e_1;
7836
7861
  return __generator(this, function (_a) {
7837
7862
  switch (_a.label) {
7838
7863
  case 0:
7839
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
7864
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl);
7840
7865
  _a.label = 1;
7841
7866
  case 1:
7842
7867
  _a.trys.push([1, 3, , 4]);
@@ -7862,12 +7887,12 @@ var AuthorityFactory = /** @class */ (function () {
7862
7887
  * @param networkInterface
7863
7888
  * @param protocolMode
7864
7889
  */
7865
- AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
7890
+ AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
7866
7891
  // Throw error if authority url is empty
7867
7892
  if (StringUtils.isEmpty(authorityUrl)) {
7868
7893
  throw ClientConfigurationError.createUrlEmptyError();
7869
7894
  }
7870
- return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
7895
+ return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl);
7871
7896
  };
7872
7897
  return AuthorityFactory;
7873
7898
  }());