@azure/msal-common 8.0.0 → 9.0.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 (81) 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 +70 -18
  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/CloudInstanceDiscoveryErrorResponse.d.ts +14 -0
  17. package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -0
  18. package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +13 -0
  19. package/dist/authority/CloudInstanceDiscoveryErrorResponse.js.map +1 -0
  20. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  21. package/dist/authority/OpenIdConfigResponse.js +1 -1
  22. package/dist/authority/ProtocolMode.js +1 -1
  23. package/dist/authority/RegionDiscovery.js +1 -1
  24. package/dist/cache/CacheManager.js +1 -1
  25. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  26. package/dist/cache/entities/AccountEntity.js +1 -1
  27. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  28. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  29. package/dist/cache/entities/CacheRecord.js +1 -1
  30. package/dist/cache/entities/CredentialEntity.js +1 -1
  31. package/dist/cache/entities/IdTokenEntity.js +1 -1
  32. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  33. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  34. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  35. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  36. package/dist/client/AuthorizationCodeClient.js +1 -1
  37. package/dist/client/BaseClient.js +1 -1
  38. package/dist/client/ClientCredentialClient.js +1 -1
  39. package/dist/client/DeviceCodeClient.js +1 -1
  40. package/dist/client/OnBehalfOfClient.js +1 -1
  41. package/dist/client/RefreshTokenClient.js +1 -1
  42. package/dist/client/SilentFlowClient.js +1 -1
  43. package/dist/client/UsernamePasswordClient.js +1 -1
  44. package/dist/config/ClientConfiguration.js +1 -1
  45. package/dist/crypto/ICrypto.js +1 -1
  46. package/dist/crypto/JoseHeader.js +1 -1
  47. package/dist/crypto/PopTokenGenerator.js +1 -1
  48. package/dist/error/AuthError.js +1 -1
  49. package/dist/error/ClientAuthError.js +1 -1
  50. package/dist/error/ClientConfigurationError.js +1 -1
  51. package/dist/error/InteractionRequiredAuthError.js +1 -1
  52. package/dist/error/JoseHeaderError.js +1 -1
  53. package/dist/error/ServerError.js +1 -1
  54. package/dist/index.cjs.js +85 -24
  55. package/dist/index.cjs.js.map +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/logger/Logger.js +1 -1
  58. package/dist/network/INetworkModule.js +1 -1
  59. package/dist/network/NetworkManager.js +1 -1
  60. package/dist/network/ThrottlingUtils.js +1 -1
  61. package/dist/packageMetadata.d.ts +1 -1
  62. package/dist/packageMetadata.js +2 -2
  63. package/dist/packageMetadata.js.map +1 -1
  64. package/dist/request/AuthenticationHeaderParser.js +1 -1
  65. package/dist/request/RequestParameterBuilder.js +1 -1
  66. package/dist/request/RequestValidator.js +1 -1
  67. package/dist/request/ScopeSet.js +1 -1
  68. package/dist/response/ResponseHandler.js +1 -1
  69. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  70. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  71. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  72. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  73. package/dist/url/UrlString.js +1 -1
  74. package/dist/utils/Constants.d.ts +2 -0
  75. package/dist/utils/Constants.d.ts.map +1 -1
  76. package/dist/utils/Constants.js +4 -2
  77. package/dist/utils/Constants.js.map +1 -1
  78. package/dist/utils/ProtocolUtils.js +1 -1
  79. package/dist/utils/StringUtils.js +1 -1
  80. package/dist/utils/TimeUtils.js +1 -1
  81. 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.1 2022-12-07 */
2
2
  'use strict';
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { ClientAuthError } from '../error/ClientAuthError.js';
4
4
  import { StringUtils } from '../utils/StringUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
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.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { ClientAuthError } from '../error/ClientAuthError.js';
4
4
  import { StringUtils } from '../utils/StringUtils.js';
@@ -8,6 +8,7 @@ import { AuthorityOptions } from "./AuthorityOptions";
8
8
  import { CloudDiscoveryMetadata } from "./CloudDiscoveryMetadata";
9
9
  import { RegionDiscoveryMetadata } from "./RegionDiscoveryMetadata";
10
10
  import { AzureCloudOptions } from "../config/ClientConfiguration";
11
+ import { Logger } from "../logger/Logger";
11
12
  /**
12
13
  * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the
13
14
  * endpoint. It will store the pertinent config data in this object for use during token calls.
@@ -22,7 +23,8 @@ export declare class Authority {
22
23
  private regionDiscovery;
23
24
  regionDiscoveryMetadata: RegionDiscoveryMetadata;
24
25
  private proxyUrl;
25
- constructor(authority: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, proxyUrl?: string);
26
+ private logger;
27
+ constructor(authority: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, logger: Logger, proxyUrl?: string);
26
28
  get authorityType(): AuthorityType;
27
29
  /**
28
30
  * ProtocolMode enum representing the way endpoints are constructed.
@@ -1 +1 @@
1
- {"version":3,"file":"Authority.d.ts","sourceRoot":"","sources":["../../src/authority/Authority.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAA0B,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;GAGG;AACH,qBAAa,SAAS;IAGlB,OAAO,CAAC,mBAAmB,CAAY;IAEvC,OAAO,CAAC,gCAAgC,CAAc;IAEtD,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC;IAE3C,SAAS,CAAC,YAAY,EAAE,aAAa,CAAC;IAEtC,OAAO,CAAC,gBAAgB,CAAm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AAiB,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAWhG;;;OAGG;IACH,MAAM,CAAC,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB;IAQjF;;;;OAIG;IACH,MAAM,CAAC,4CAA4C,CAC/C,QAAQ,EAAE,sBAAsB,EAAE,EAClC,SAAS,EAAE,MAAM,GAClB,sBAAsB,GAAG,IAAI;IAWhC;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAQ3B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpD;;;;;OAKG;IACH,MAAM,CAAC,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;IAyB/F;;;;;OAKG;IACH,MAAM,CAAC,8BAA8B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,GAAG,oBAAoB;CAanH"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { AuthorityType } from './AuthorityType.js';
@@ -12,7 +12,9 @@ import { ProtocolMode } from './ProtocolMode.js';
12
12
  import { AuthorityMetadataEntity } from '../cache/entities/AuthorityMetadataEntity.js';
13
13
  import { AzureCloudInstance } from './AuthorityOptions.js';
14
14
  import { isCloudInstanceDiscoveryResponse } from './CloudInstanceDiscoveryResponse.js';
15
+ import { isCloudInstanceDiscoveryErrorResponse } from './CloudInstanceDiscoveryErrorResponse.js';
15
16
  import { RegionDiscovery } from './RegionDiscovery.js';
17
+ import { AuthError } from '../error/AuthError.js';
16
18
 
17
19
  /*
18
20
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23,7 +25,7 @@ import { RegionDiscovery } from './RegionDiscovery.js';
23
25
  * endpoint. It will store the pertinent config data in this object for use during token calls.
24
26
  */
25
27
  var Authority = /** @class */ (function () {
26
- function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
28
+ function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
27
29
  this.canonicalAuthority = authority;
28
30
  this._canonicalAuthority.validateAsUri();
29
31
  this.networkInterface = networkInterface;
@@ -32,6 +34,7 @@ var Authority = /** @class */ (function () {
32
34
  this.regionDiscovery = new RegionDiscovery(networkInterface);
33
35
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
34
36
  this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
37
+ this.logger = logger;
35
38
  }
36
39
  Object.defineProperty(Authority.prototype, "authorityType", {
37
40
  // See above for AuthorityType
@@ -458,36 +461,50 @@ var Authority = /** @class */ (function () {
458
461
  */
459
462
  Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
460
463
  return __awaiter(this, void 0, void 0, function () {
461
- var metadata, harcodedMetadata;
464
+ var metadata, metadataEntityExpired, harcodedMetadata;
462
465
  return __generator(this, function (_a) {
463
466
  switch (_a.label) {
464
467
  case 0:
468
+ this.logger.verbose("Attempting to get cloud discovery metadata in the config");
469
+ this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
470
+ this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
471
+ this.logger.verbosePii("Canonical Authority: " + (metadataEntity.canonical_authority || Constants.NOT_APPLICABLE));
465
472
  metadata = this.getCloudDiscoveryMetadataFromConfig();
466
473
  if (metadata) {
474
+ this.logger.verbose("Found cloud discovery metadata in the config.");
467
475
  metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
468
476
  return [2 /*return*/, AuthorityMetadataSource.CONFIG];
469
477
  }
470
- // If The cached metadata came from config but that config was not passed to this instance, we must go to the network
471
- if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntity.isExpired()) {
478
+ // If the cached metadata came from config but that config was not passed to this instance, we must go to the network
479
+ this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.");
480
+ metadataEntityExpired = metadataEntity.isExpired();
481
+ if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {
482
+ this.logger.verbose("Found metadata in the cache.");
472
483
  // No need to update
473
484
  return [2 /*return*/, AuthorityMetadataSource.CACHE];
474
485
  }
475
- harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
486
+ else if (metadataEntityExpired) {
487
+ this.logger.verbose("The metadata entity is expired.");
488
+ }
489
+ this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
476
490
  return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
477
491
  case 1:
478
492
  metadata = _a.sent();
479
493
  if (metadata) {
494
+ this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
480
495
  metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
481
496
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
482
497
  }
498
+ this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.");
499
+ harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
483
500
  if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
501
+ this.logger.verbose("Found cloud discovery metadata from hardcoded values.");
484
502
  metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
485
503
  return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
486
504
  }
487
- else {
488
- // Metadata could not be obtained from config, cache or network
489
- throw ClientConfigurationError.createUntrustedAuthorityError();
490
- }
505
+ // Metadata could not be obtained from the config, cache, network or hardcoded values
506
+ this.logger.error("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.");
507
+ throw ClientConfigurationError.createUntrustedAuthorityError();
491
508
  }
492
509
  });
493
510
  });
@@ -498,19 +515,28 @@ var Authority = /** @class */ (function () {
498
515
  Authority.prototype.getCloudDiscoveryMetadataFromConfig = function () {
499
516
  // Check if network response was provided in config
500
517
  if (this.authorityOptions.cloudDiscoveryMetadata) {
518
+ this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");
501
519
  try {
520
+ this.logger.verbose("Attempting to parse the cloud discovery metadata.");
502
521
  var parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata);
503
522
  var metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(parsedResponse.metadata, this.hostnameAndPort);
523
+ this.logger.verbose("Parsed the cloud discovery metadata.");
504
524
  if (metadata) {
525
+ this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata.");
505
526
  return metadata;
506
527
  }
528
+ else {
529
+ this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.");
530
+ }
507
531
  }
508
532
  catch (e) {
533
+ this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.");
509
534
  throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();
510
535
  }
511
536
  }
512
537
  // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities
513
538
  if (this.isInKnownAuthorities()) {
539
+ this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.");
514
540
  return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
515
541
  }
516
542
  return null;
@@ -522,7 +548,7 @@ var Authority = /** @class */ (function () {
522
548
  */
523
549
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
524
550
  return __awaiter(this, void 0, void 0, function () {
525
- var instanceDiscoveryEndpoint, options, match, response, metadata;
551
+ var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;
526
552
  return __generator(this, function (_a) {
527
553
  switch (_a.label) {
528
554
  case 0:
@@ -538,21 +564,47 @@ var Authority = /** @class */ (function () {
538
564
  return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
539
565
  case 2:
540
566
  response = _a.sent();
541
- metadata = isCloudInstanceDiscoveryResponse(response.body)
542
- ? response.body.metadata
543
- : [];
544
- if (metadata.length === 0) {
545
- // If no metadata is returned, authority is untrusted
567
+ typedResponseBody = void 0;
568
+ metadata = void 0;
569
+ if (isCloudInstanceDiscoveryResponse(response.body)) {
570
+ typedResponseBody = response.body;
571
+ metadata = typedResponseBody.metadata;
572
+ this.logger.verbosePii("tenant_discovery_endpoint is: " + typedResponseBody.tenant_discovery_endpoint);
573
+ }
574
+ else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {
575
+ this.logger.warning("A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: " + response.status);
576
+ typedResponseBody = response.body;
577
+ if (typedResponseBody.error === Constants.INVALID_INSTANCE) {
578
+ this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance.");
579
+ return [2 /*return*/, null];
580
+ }
581
+ this.logger.warning("The CloudInstanceDiscoveryErrorResponse error is " + typedResponseBody.error);
582
+ this.logger.warning("The CloudInstanceDiscoveryErrorResponse error description is " + typedResponseBody.error_description);
583
+ this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []");
584
+ metadata = [];
585
+ }
586
+ else {
587
+ this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse");
546
588
  return [2 /*return*/, null];
547
589
  }
590
+ this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.");
548
591
  match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
549
592
  return [3 /*break*/, 4];
550
593
  case 3:
551
- _a.sent();
594
+ error_1 = _a.sent();
595
+ if (error_1 instanceof AuthError) {
596
+ this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: " + error_1.errorCode + "\nError Description: " + error_1.errorMessage);
597
+ }
598
+ else {
599
+ typedError = error_1;
600
+ this.logger.error("A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: " + typedError.name + "\nError Description: " + typedError.message);
601
+ }
552
602
  return [2 /*return*/, null];
553
603
  case 4:
604
+ // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
554
605
  if (!match) {
555
- // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
606
+ this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.");
607
+ this.logger.verbose("Creating custom Authority for custom domain scenario.");
556
608
  match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
557
609
  }
558
610
  return [2 /*return*/, match];
@@ -1 +1 @@
1
- {"version":3,"file":"Authority.js","sources":["../../src/authority/Authority.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthorityType } from \"./AuthorityType\";\nimport { isOpenIdConfigResponse, OpenIdConfigResponse } from \"./OpenIdConfigResponse\";\nimport { UrlString } from \"../url/UrlString\";\nimport { IUri } from \"../url/IUri\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { INetworkModule } from \"../network/INetworkModule\";\nimport { AuthorityMetadataSource, Constants, RegionDiscoveryOutcomes } from \"../utils/Constants\";\nimport { EndpointMetadata, InstanceDiscoveryMetadata } from \"./AuthorityMetadata\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ProtocolMode } from \"./ProtocolMode\";\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\nimport { AuthorityMetadataEntity } from \"../cache/entities/AuthorityMetadataEntity\";\nimport { AuthorityOptions , AzureCloudInstance } from \"./AuthorityOptions\";\nimport { CloudInstanceDiscoveryResponse, isCloudInstanceDiscoveryResponse } from \"./CloudInstanceDiscoveryResponse\";\nimport { CloudDiscoveryMetadata } from \"./CloudDiscoveryMetadata\";\nimport { RegionDiscovery } from \"./RegionDiscovery\";\nimport { RegionDiscoveryMetadata } from \"./RegionDiscoveryMetadata\";\nimport { ImdsOptions } from \"./ImdsOptions\";\nimport { AzureCloudOptions } from \"../config/ClientConfiguration\";\n\n/**\n * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the\n * endpoint. It will store the pertinent config data in this object for use during token calls.\n */\nexport class Authority {\n\n // Canonical authority url string\n private _canonicalAuthority: UrlString;\n // Canonicaly authority url components\n private _canonicalAuthorityUrlComponents: IUri | null;\n // Network interface to make requests with.\n protected networkInterface: INetworkModule;\n // Cache Manager to cache network responses\n protected cacheManager: ICacheManager;\n // Protocol mode to construct endpoints\n private authorityOptions: AuthorityOptions;\n // Authority metadata\n private metadata: AuthorityMetadataEntity;\n // Region discovery service\n private regionDiscovery: RegionDiscovery;\n // Region discovery metadata\n public regionDiscoveryMetadata: RegionDiscoveryMetadata;\n // Proxy url string\n private proxyUrl: string;\n\n constructor(\n authority: string,\n networkInterface: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n proxyUrl?: string) {\n this.canonicalAuthority = authority;\n this._canonicalAuthority.validateAsUri();\n this.networkInterface = networkInterface;\n this.cacheManager = cacheManager;\n this.authorityOptions = authorityOptions;\n this.regionDiscovery = new RegionDiscovery(networkInterface);\n this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };\n this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;\n }\n\n // See above for AuthorityType\n public get authorityType(): AuthorityType {\n const pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;\n if (pathSegments.length) {\n switch(pathSegments[0].toLowerCase()) {\n case Constants.ADFS:\n return AuthorityType.Adfs;\n case Constants.DSTS:\n return AuthorityType.Dsts;\n default:\n break;\n }\n }\n return AuthorityType.Default;\n }\n\n /**\n * ProtocolMode enum representing the way endpoints are constructed.\n */\n public get protocolMode(): ProtocolMode {\n return this.authorityOptions.protocolMode;\n }\n\n /**\n * Returns authorityOptions which can be used to reinstantiate a new authority instance\n */\n public get options(): AuthorityOptions {\n return this.authorityOptions;\n }\n\n /**\n * A URL that is the authority set by the developer\n */\n public get canonicalAuthority(): string {\n return this._canonicalAuthority.urlString;\n }\n\n /**\n * Sets canonical authority.\n */\n public set canonicalAuthority(url: string) {\n this._canonicalAuthority = new UrlString(url);\n this._canonicalAuthority.validateAsUri();\n this._canonicalAuthorityUrlComponents = null;\n }\n\n /**\n * Get authority components.\n */\n public get canonicalAuthorityUrlComponents(): IUri {\n if (!this._canonicalAuthorityUrlComponents) {\n this._canonicalAuthorityUrlComponents = this._canonicalAuthority.getUrlComponents();\n }\n\n return this._canonicalAuthorityUrlComponents;\n }\n\n /**\n * Get hostname and port i.e. login.microsoftonline.com\n */\n public get hostnameAndPort(): string {\n return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase();\n }\n\n /**\n * Get tenant for authority.\n */\n public get tenant(): string {\n return this.canonicalAuthorityUrlComponents.PathSegments[0];\n }\n\n /**\n * OAuth /authorize endpoint for requests\n */\n public get authorizationEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.authorization_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth /token endpoint for requests\n */\n public get tokenEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.token_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n public get deviceCodeEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.token_endpoint.replace(\"/token\", \"/devicecode\"));\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth logout endpoint for requests\n */\n public get endSessionEndpoint(): string {\n if(this.discoveryComplete()) {\n // ROPC policies may not have end_session_endpoint set\n if (!this.metadata.end_session_endpoint) {\n throw ClientAuthError.createLogoutNotSupportedError();\n }\n const endpoint = this.replacePath(this.metadata.end_session_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth issuer for requests\n */\n public get selfSignedJwtAudience(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.issuer);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Jwks_uri for token signing keys\n */\n public get jwksUri(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.jwks_uri);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Replaces tenant in url path with current tenant. Defaults to common.\n * @param urlString\n */\n private replaceTenant(urlString: string): string {\n return urlString.replace(/{tenant}|{tenantid}/g, this.tenant);\n }\n\n /**\n * Replaces path such as tenant or policy with the current tenant or policy.\n * @param urlString\n */\n private replacePath(urlString: string): string {\n let endpoint = urlString;\n const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);\n const cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\n const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;\n\n currentAuthorityParts.forEach((currentPart, index) => {\n const cachedPart = cachedAuthorityParts[index];\n if (currentPart !== cachedPart) {\n endpoint = endpoint.replace(`/${cachedPart}/`, `/${currentPart}/`);\n }\n });\n\n return endpoint;\n }\n\n /**\n * The default open id configuration endpoint for any canonical authority.\n */\n protected get defaultOpenIdConfigurationEndpoint(): string {\n if (\n this.authorityType === AuthorityType.Adfs ||\n this.authorityType === AuthorityType.Dsts ||\n this.protocolMode === ProtocolMode.OIDC\n ) {\n return `${this.canonicalAuthority}.well-known/openid-configuration`;\n }\n return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;\n }\n\n /**\n * Boolean that returns whethr or not tenant discovery has been completed.\n */\n discoveryComplete(): boolean {\n return !!this.metadata;\n }\n\n /**\n * Perform endpoint discovery to discover aliases, preferred_cache, preferred_network\n * and the /authorize, /token and logout endpoints.\n */\n public async resolveEndpointsAsync(): Promise<void> {\n let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);\n if (!metadataEntity) {\n metadataEntity = new AuthorityMetadataEntity();\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\n }\n\n const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);\n this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);\n const endpointSource = await this.updateEndpointMetadata(metadataEntity);\n\n if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {\n // Reset the expiration time unless both values came from a successful cache lookup\n metadataEntity.resetExpiresAt();\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\n }\n\n const cacheKey = this.cacheManager.generateAuthorityMetadataCacheKey(metadataEntity.preferred_cache);\n this.cacheManager.setAuthorityMetadata(cacheKey, metadataEntity);\n this.metadata = metadataEntity;\n }\n\n /**\n * Update AuthorityMetadataEntity with new endpoints and return where the information came from\n * @param metadataEntity\n */\n private async updateEndpointMetadata(metadataEntity: AuthorityMetadataEntity): Promise<AuthorityMetadataSource> {\n let metadata = this.getEndpointMetadataFromConfig();\n if (metadata) {\n metadataEntity.updateEndpointMetadata(metadata, false);\n return AuthorityMetadataSource.CONFIG;\n }\n\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.endpointsFromNetwork && !metadataEntity.isExpired()) {\n // No need to update\n return AuthorityMetadataSource.CACHE;\n }\n\n let harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();\n metadata = await this.getEndpointMetadataFromNetwork();\n if (metadata) {\n // If the user prefers to use an azure region replace the global endpoints with regional information.\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\n metadata = await this.updateMetadataWithRegionalInformation(metadata);\n }\n\n metadataEntity.updateEndpointMetadata(metadata, true);\n return AuthorityMetadataSource.NETWORK;\n } \n\n if (harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache) {\n // If the user prefers to use an azure region replace the global endpoints with regional information.\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\n harcodedMetadata = await this.updateMetadataWithRegionalInformation(\n harcodedMetadata\n );\n }\n\n metadataEntity.updateEndpointMetadata(harcodedMetadata, false);\n return AuthorityMetadataSource.HARDCODED_VALUES;\n } else {\n throw ClientAuthError.createUnableToGetOpenidConfigError(\n this.defaultOpenIdConfigurationEndpoint\n );\n }\n }\n\n /**\n * Compares the number of url components after the domain to determine if the cached \n * authority metadata can be used for the requested authority. Protects against same domain different \n * authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy\n * @param metadataEntity\n */\n private isAuthoritySameType(metadataEntity: AuthorityMetadataEntity): boolean {\n const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);\n const cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\n\n return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;\n }\n\n /**\n * Parse authorityMetadata config option\n */\n private getEndpointMetadataFromConfig(): OpenIdConfigResponse | null {\n if (this.authorityOptions.authorityMetadata) {\n try {\n return JSON.parse(this.authorityOptions.authorityMetadata) as OpenIdConfigResponse;\n } catch (e) {\n throw ClientConfigurationError.createInvalidAuthorityMetadataError();\n }\n }\n\n return null;\n }\n\n /**\n * Gets OAuth endpoints from the given OpenID configuration endpoint.\n * \n * @param hasHardcodedMetadata boolean\n */\n private async getEndpointMetadataFromNetwork(): Promise<OpenIdConfigResponse | null> {\n const options: ImdsOptions = {};\n if (this.proxyUrl) {\n options.proxyUrl = this.proxyUrl;\n }\n\n /*\n * TODO: Add a timeout if the authority exists in our library's \n * hardcoded list of metadata\n */\n\n try {\n const response = await this.networkInterface.\n sendGetRequestAsync<OpenIdConfigResponse>(this.defaultOpenIdConfigurationEndpoint, options);\n return isOpenIdConfigResponse(response.body) ? response.body : null;\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Get OAuth endpoints for common authorities.\n */\n private getEndpointMetadataFromHardcodedValues(): OpenIdConfigResponse | null {\n if (this.canonicalAuthority in EndpointMetadata) {\n return EndpointMetadata[this.canonicalAuthority];\n }\n\n return null;\n }\n\n /**\n * Update the retrieved metadata with regional information.\n */\n private async updateMetadataWithRegionalInformation(metadata: OpenIdConfigResponse): Promise<OpenIdConfigResponse> {\n const autodetectedRegionName = await this.regionDiscovery.detectRegion(\n this.authorityOptions.azureRegionConfiguration?.environmentRegion,\n this.regionDiscoveryMetadata,\n this.proxyUrl\n );\n\n const azureRegion = \n this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG\n ? autodetectedRegionName\n : this.authorityOptions.azureRegionConfiguration?.azureRegion;\n\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {\n this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;\n } else {\n if (autodetectedRegionName) {\n this.regionDiscoveryMetadata.region_outcome = (\n this.authorityOptions.azureRegionConfiguration?.azureRegion === autodetectedRegionName\n ) ?\n RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :\n RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;\n } else {\n this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;\n }\n }\n\n if (azureRegion) {\n this.regionDiscoveryMetadata.region_used = azureRegion;\n return Authority.replaceWithRegionalInformation(metadata, azureRegion);\n }\n\n return metadata;\n }\n\n /**\n * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache\n * and returns where the information was retrieved from\n * @param cachedMetadata\n * @param newMetadata\n */\n private async updateCloudDiscoveryMetadata(metadataEntity: AuthorityMetadataEntity): Promise<AuthorityMetadataSource> {\n let metadata = this.getCloudDiscoveryMetadataFromConfig();\n if (metadata) {\n metadataEntity.updateCloudDiscoveryMetadata(metadata, false);\n return AuthorityMetadataSource.CONFIG;\n }\n\n // If The cached metadata came from config but that config was not passed to this instance, we must go to the network\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntity.isExpired()) {\n // No need to update\n return AuthorityMetadataSource.CACHE;\n }\n\n const harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();\n\n metadata = await this.getCloudDiscoveryMetadataFromNetwork();\n if (metadata) {\n metadataEntity.updateCloudDiscoveryMetadata(metadata, true);\n return AuthorityMetadataSource.NETWORK;\n }\n \n if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {\n metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);\n return AuthorityMetadataSource.HARDCODED_VALUES;\n } else {\n // Metadata could not be obtained from config, cache or network\n throw ClientConfigurationError.createUntrustedAuthorityError();\n }\n }\n\n /**\n * Parse cloudDiscoveryMetadata config or check knownAuthorities\n */\n private getCloudDiscoveryMetadataFromConfig(): CloudDiscoveryMetadata | null {\n // Check if network response was provided in config\n if (this.authorityOptions.cloudDiscoveryMetadata) {\n try {\n const parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata) as CloudInstanceDiscoveryResponse;\n const metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\n parsedResponse.metadata,\n this.hostnameAndPort\n );\n if (metadata) {\n return metadata;\n }\n } catch (e) {\n throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();\n }\n }\n // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities\n if (this.isInKnownAuthorities()) {\n return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\n }\n\n return null;\n }\n\n /**\n * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config\n * \n * @param hasHardcodedMetadata boolean\n */\n private async getCloudDiscoveryMetadataFromNetwork(): Promise<CloudDiscoveryMetadata | null> {\n const instanceDiscoveryEndpoint =\n `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;\n const options: ImdsOptions = {};\n if (this.proxyUrl) {\n options.proxyUrl = this.proxyUrl;\n }\n\n /*\n * TODO: Add a timeout if the authority exists in our library's\n * hardcoded list of metadata\n */\n\n let match = null;\n try {\n const response =\n await this.networkInterface.sendGetRequestAsync<CloudInstanceDiscoveryResponse>(\n instanceDiscoveryEndpoint,\n options\n );\n const metadata = isCloudInstanceDiscoveryResponse(response.body)\n ? response.body.metadata\n : [];\n if (metadata.length === 0) {\n // If no metadata is returned, authority is untrusted\n return null;\n }\n match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\n metadata,\n this.hostnameAndPort\n );\n } catch (e) {\n return null;\n }\n\n if (!match) {\n // Custom Domain scenario, host is trusted because Instance Discovery call succeeded\n match = Authority.createCloudDiscoveryMetadataFromHost(\n this.hostnameAndPort\n );\n }\n return match;\n }\n\n /**\n * Get cloud discovery metadata for common authorities \n */\n private getCloudDiscoveryMetadataFromHarcodedValues(): CloudDiscoveryMetadata | null {\n if (this.canonicalAuthority in InstanceDiscoveryMetadata) {\n return InstanceDiscoveryMetadata[this.canonicalAuthority];\n }\n\n return null;\n }\n\n /**\n * Helper function to determine if this host is included in the knownAuthorities config option\n */\n private isInKnownAuthorities(): boolean {\n const matches = this.authorityOptions.knownAuthorities.filter((authority) => {\n return UrlString.getDomainFromUrl(authority).toLowerCase() === this.hostnameAndPort;\n });\n\n return matches.length > 0;\n }\n\n /**\n * helper function to populate the authority based on azureCloudOptions\n * @param authorityString\n * @param azureCloudOptions\n */\n static generateAuthority(authorityString: string, azureCloudOptions?: AzureCloudOptions): string {\n let authorityAzureCloudInstance;\n\n if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {\n const tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;\n authorityAzureCloudInstance = `${azureCloudOptions.azureCloudInstance}/${tenant}/`;\n }\n\n return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;\n }\n\n /**\n * Creates cloud discovery metadata object from a given host\n * @param host\n */\n static createCloudDiscoveryMetadataFromHost(host: string): CloudDiscoveryMetadata {\n return {\n preferred_network: host,\n preferred_cache: host,\n aliases: [host]\n };\n }\n\n /**\n * Searches instance discovery network response for the entry that contains the host in the aliases list\n * @param response\n * @param authority\n */\n static getCloudDiscoveryMetadataFromNetworkResponse(\n response: CloudDiscoveryMetadata[],\n authority: string\n ): CloudDiscoveryMetadata | null {\n for (let i = 0; i < response.length; i++) {\n const metadata = response[i];\n if (metadata.aliases.indexOf(authority) > -1) {\n return metadata;\n }\n }\n\n return null;\n }\n\n /**\n * helper function to generate environment from authority object\n */\n getPreferredCache(): string {\n if(this.discoveryComplete()) {\n return this.metadata.preferred_cache;\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Returns whether or not the provided host is an alias of this authority instance\n * @param host\n */\n isAlias(host: string): boolean {\n return this.metadata.aliases.indexOf(host) > -1;\n }\n\n /**\n * Checks whether the provided host is that of a public cloud authority\n *\n * @param authority string\n * @returns bool\n */\n static isPublicCloudAuthority(host: string): boolean {\n return Constants.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;\n }\n\n /**\n * Rebuild the authority string with the region\n *\n * @param host string\n * @param region string\n */\n static buildRegionalAuthorityString(host: string, region: string, queryString?: string): string {\n // Create and validate a Url string object with the initial authority string\n const authorityUrlInstance = new UrlString(host);\n authorityUrlInstance.validateAsUri();\n\n const authorityUrlParts = authorityUrlInstance.getUrlComponents();\n\n let hostNameAndPort= `${region}.${authorityUrlParts.HostNameAndPort}`;\n\n if (this.isPublicCloudAuthority(authorityUrlParts.HostNameAndPort)) {\n hostNameAndPort = `${region}.${Constants.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`;\n }\n\n // Include the query string portion of the url\n const url = UrlString.constructAuthorityUriFromObject({\n ...authorityUrlInstance.getUrlComponents(),\n HostNameAndPort: hostNameAndPort\n }).urlString;\n\n // Add the query string if a query string was provided\n if (queryString) return `${url}?${queryString}`;\n\n return url;\n }\n\n /**\n * Replace the endpoints in the metadata object with their regional equivalents.\n *\n * @param metadata OpenIdConfigResponse\n * @param azureRegion string\n */\n static replaceWithRegionalInformation(metadata: OpenIdConfigResponse, azureRegion: string): OpenIdConfigResponse {\n metadata.authorization_endpoint = Authority.buildRegionalAuthorityString(metadata.authorization_endpoint, azureRegion);\n // TODO: Enquire on whether we should leave the query string or remove it before releasing the feature\n metadata.token_endpoint = Authority.buildRegionalAuthorityString(\n metadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING\n );\n\n if (metadata.end_session_endpoint) {\n metadata.end_session_endpoint = Authority.buildRegionalAuthorityString(metadata.end_session_endpoint, azureRegion);\n }\n\n return metadata;\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;AAGG;AAsBH;;;AAGG;AACH,IAAA,SAAA,kBAAA,YAAA;IAqBI,SACI,SAAA,CAAA,SAAiB,EACjB,gBAAgC,EAChC,YAA2B,EAC3B,gBAAkC,EAClC,QAAiB,EAAA;AACjB,QAAA,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;AACpC,QAAA,IAAI,CAAC,mBAAmB,CAAC,aAAa,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B,GAAG,SAAS,CAAC,4BAA4B,CAAC,QAAQ,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;;AAEvH,QAAA,QAAQ,CAAC,cAAc,GAAG,SAAS,CAAC,4BAA4B,CAC5D,QAAQ,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,CAAC,kCAAkC,CACrF,CAAC;QAEF,IAAI,QAAQ,CAAC,oBAAoB,EAAE;AAC/B,YAAA,QAAQ,CAAC,oBAAoB,GAAG,SAAS,CAAC,4BAA4B,CAAC,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AACtH,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB,CAAA;IACL,OAAC,SAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"Authority.js","sources":["../../src/authority/Authority.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthorityType } from \"./AuthorityType\";\nimport { isOpenIdConfigResponse, OpenIdConfigResponse } from \"./OpenIdConfigResponse\";\nimport { UrlString } from \"../url/UrlString\";\nimport { IUri } from \"../url/IUri\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { INetworkModule } from \"../network/INetworkModule\";\nimport { AuthorityMetadataSource, Constants, RegionDiscoveryOutcomes } from \"../utils/Constants\";\nimport { EndpointMetadata, InstanceDiscoveryMetadata } from \"./AuthorityMetadata\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ProtocolMode } from \"./ProtocolMode\";\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\nimport { AuthorityMetadataEntity } from \"../cache/entities/AuthorityMetadataEntity\";\nimport { AuthorityOptions , AzureCloudInstance } from \"./AuthorityOptions\";\nimport { CloudInstanceDiscoveryResponse, isCloudInstanceDiscoveryResponse } from \"./CloudInstanceDiscoveryResponse\";\nimport { CloudInstanceDiscoveryErrorResponse, isCloudInstanceDiscoveryErrorResponse } from \"./CloudInstanceDiscoveryErrorResponse\";\nimport { CloudDiscoveryMetadata } from \"./CloudDiscoveryMetadata\";\nimport { RegionDiscovery } from \"./RegionDiscovery\";\nimport { RegionDiscoveryMetadata } from \"./RegionDiscoveryMetadata\";\nimport { ImdsOptions } from \"./ImdsOptions\";\nimport { AzureCloudOptions } from \"../config/ClientConfiguration\";\nimport { Logger } from \"../logger/Logger\";\nimport { AuthError } from \"../error/AuthError\";\n\n/**\n * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the\n * endpoint. It will store the pertinent config data in this object for use during token calls.\n */\nexport class Authority {\n // Canonical authority url string\n private _canonicalAuthority: UrlString;\n // Canonicaly authority url components\n private _canonicalAuthorityUrlComponents: IUri | null;\n // Network interface to make requests with.\n protected networkInterface: INetworkModule;\n // Cache Manager to cache network responses\n protected cacheManager: ICacheManager;\n // Protocol mode to construct endpoints\n private authorityOptions: AuthorityOptions;\n // Authority metadata\n private metadata: AuthorityMetadataEntity;\n // Region discovery service\n private regionDiscovery: RegionDiscovery;\n // Region discovery metadata\n public regionDiscoveryMetadata: RegionDiscoveryMetadata;\n // Proxy url string\n private proxyUrl: string;\n // Logger object\n private logger: Logger;\n\n constructor(\n authority: string,\n networkInterface: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n logger: Logger,\n proxyUrl?: string\n ) {\n this.canonicalAuthority = authority;\n this._canonicalAuthority.validateAsUri();\n this.networkInterface = networkInterface;\n this.cacheManager = cacheManager;\n this.authorityOptions = authorityOptions;\n this.regionDiscovery = new RegionDiscovery(networkInterface);\n this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };\n this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;\n this.logger = logger;\n }\n\n // See above for AuthorityType\n public get authorityType(): AuthorityType {\n const pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;\n if (pathSegments.length) {\n switch(pathSegments[0].toLowerCase()) {\n case Constants.ADFS:\n return AuthorityType.Adfs;\n case Constants.DSTS:\n return AuthorityType.Dsts;\n default:\n break;\n }\n }\n return AuthorityType.Default;\n }\n\n /**\n * ProtocolMode enum representing the way endpoints are constructed.\n */\n public get protocolMode(): ProtocolMode {\n return this.authorityOptions.protocolMode;\n }\n\n /**\n * Returns authorityOptions which can be used to reinstantiate a new authority instance\n */\n public get options(): AuthorityOptions {\n return this.authorityOptions;\n }\n\n /**\n * A URL that is the authority set by the developer\n */\n public get canonicalAuthority(): string {\n return this._canonicalAuthority.urlString;\n }\n\n /**\n * Sets canonical authority.\n */\n public set canonicalAuthority(url: string) {\n this._canonicalAuthority = new UrlString(url);\n this._canonicalAuthority.validateAsUri();\n this._canonicalAuthorityUrlComponents = null;\n }\n\n /**\n * Get authority components.\n */\n public get canonicalAuthorityUrlComponents(): IUri {\n if (!this._canonicalAuthorityUrlComponents) {\n this._canonicalAuthorityUrlComponents = this._canonicalAuthority.getUrlComponents();\n }\n\n return this._canonicalAuthorityUrlComponents;\n }\n\n /**\n * Get hostname and port i.e. login.microsoftonline.com\n */\n public get hostnameAndPort(): string {\n return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase();\n }\n\n /**\n * Get tenant for authority.\n */\n public get tenant(): string {\n return this.canonicalAuthorityUrlComponents.PathSegments[0];\n }\n\n /**\n * OAuth /authorize endpoint for requests\n */\n public get authorizationEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.authorization_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth /token endpoint for requests\n */\n public get tokenEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.token_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n public get deviceCodeEndpoint(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.token_endpoint.replace(\"/token\", \"/devicecode\"));\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth logout endpoint for requests\n */\n public get endSessionEndpoint(): string {\n if(this.discoveryComplete()) {\n // ROPC policies may not have end_session_endpoint set\n if (!this.metadata.end_session_endpoint) {\n throw ClientAuthError.createLogoutNotSupportedError();\n }\n const endpoint = this.replacePath(this.metadata.end_session_endpoint);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * OAuth issuer for requests\n */\n public get selfSignedJwtAudience(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.issuer);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Jwks_uri for token signing keys\n */\n public get jwksUri(): string {\n if(this.discoveryComplete()) {\n const endpoint = this.replacePath(this.metadata.jwks_uri);\n return this.replaceTenant(endpoint);\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Replaces tenant in url path with current tenant. Defaults to common.\n * @param urlString\n */\n private replaceTenant(urlString: string): string {\n return urlString.replace(/{tenant}|{tenantid}/g, this.tenant);\n }\n\n /**\n * Replaces path such as tenant or policy with the current tenant or policy.\n * @param urlString\n */\n private replacePath(urlString: string): string {\n let endpoint = urlString;\n const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);\n const cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\n const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;\n\n currentAuthorityParts.forEach((currentPart, index) => {\n const cachedPart = cachedAuthorityParts[index];\n if (currentPart !== cachedPart) {\n endpoint = endpoint.replace(`/${cachedPart}/`, `/${currentPart}/`);\n }\n });\n\n return endpoint;\n }\n\n /**\n * The default open id configuration endpoint for any canonical authority.\n */\n protected get defaultOpenIdConfigurationEndpoint(): string {\n if (\n this.authorityType === AuthorityType.Adfs ||\n this.authorityType === AuthorityType.Dsts ||\n this.protocolMode === ProtocolMode.OIDC\n ) {\n return `${this.canonicalAuthority}.well-known/openid-configuration`;\n }\n return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;\n }\n\n /**\n * Boolean that returns whethr or not tenant discovery has been completed.\n */\n discoveryComplete(): boolean {\n return !!this.metadata;\n }\n\n /**\n * Perform endpoint discovery to discover aliases, preferred_cache, preferred_network\n * and the /authorize, /token and logout endpoints.\n */\n public async resolveEndpointsAsync(): Promise<void> {\n let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);\n if (!metadataEntity) {\n metadataEntity = new AuthorityMetadataEntity();\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\n }\n\n const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);\n this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);\n const endpointSource = await this.updateEndpointMetadata(metadataEntity);\n\n if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {\n // Reset the expiration time unless both values came from a successful cache lookup\n metadataEntity.resetExpiresAt();\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\n }\n\n const cacheKey = this.cacheManager.generateAuthorityMetadataCacheKey(metadataEntity.preferred_cache);\n this.cacheManager.setAuthorityMetadata(cacheKey, metadataEntity);\n this.metadata = metadataEntity;\n }\n\n /**\n * Update AuthorityMetadataEntity with new endpoints and return where the information came from\n * @param metadataEntity\n */\n private async updateEndpointMetadata(metadataEntity: AuthorityMetadataEntity): Promise<AuthorityMetadataSource> {\n let metadata = this.getEndpointMetadataFromConfig();\n if (metadata) {\n metadataEntity.updateEndpointMetadata(metadata, false);\n return AuthorityMetadataSource.CONFIG;\n }\n\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.endpointsFromNetwork && !metadataEntity.isExpired()) {\n // No need to update\n return AuthorityMetadataSource.CACHE;\n }\n\n let harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();\n metadata = await this.getEndpointMetadataFromNetwork();\n if (metadata) {\n // If the user prefers to use an azure region replace the global endpoints with regional information.\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\n metadata = await this.updateMetadataWithRegionalInformation(metadata);\n }\n\n metadataEntity.updateEndpointMetadata(metadata, true);\n return AuthorityMetadataSource.NETWORK;\n } \n\n if (harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache) {\n // If the user prefers to use an azure region replace the global endpoints with regional information.\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\n harcodedMetadata = await this.updateMetadataWithRegionalInformation(\n harcodedMetadata\n );\n }\n\n metadataEntity.updateEndpointMetadata(harcodedMetadata, false);\n return AuthorityMetadataSource.HARDCODED_VALUES;\n } else {\n throw ClientAuthError.createUnableToGetOpenidConfigError(\n this.defaultOpenIdConfigurationEndpoint\n );\n }\n }\n\n /**\n * Compares the number of url components after the domain to determine if the cached \n * authority metadata can be used for the requested authority. Protects against same domain different \n * authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy\n * @param metadataEntity\n */\n private isAuthoritySameType(metadataEntity: AuthorityMetadataEntity): boolean {\n const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);\n const cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\n\n return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;\n }\n\n /**\n * Parse authorityMetadata config option\n */\n private getEndpointMetadataFromConfig(): OpenIdConfigResponse | null {\n if (this.authorityOptions.authorityMetadata) {\n try {\n return JSON.parse(this.authorityOptions.authorityMetadata) as OpenIdConfigResponse;\n } catch (e) {\n throw ClientConfigurationError.createInvalidAuthorityMetadataError();\n }\n }\n\n return null;\n }\n\n /**\n * Gets OAuth endpoints from the given OpenID configuration endpoint.\n * \n * @param hasHardcodedMetadata boolean\n */\n private async getEndpointMetadataFromNetwork(): Promise<OpenIdConfigResponse | null> {\n const options: ImdsOptions = {};\n if (this.proxyUrl) {\n options.proxyUrl = this.proxyUrl;\n }\n\n /*\n * TODO: Add a timeout if the authority exists in our library's \n * hardcoded list of metadata\n */\n\n try {\n const response = await this.networkInterface.\n sendGetRequestAsync<OpenIdConfigResponse>(this.defaultOpenIdConfigurationEndpoint, options);\n return isOpenIdConfigResponse(response.body) ? response.body : null;\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Get OAuth endpoints for common authorities.\n */\n private getEndpointMetadataFromHardcodedValues(): OpenIdConfigResponse | null {\n if (this.canonicalAuthority in EndpointMetadata) {\n return EndpointMetadata[this.canonicalAuthority];\n }\n\n return null;\n }\n\n /**\n * Update the retrieved metadata with regional information.\n */\n private async updateMetadataWithRegionalInformation(metadata: OpenIdConfigResponse): Promise<OpenIdConfigResponse> {\n const autodetectedRegionName = await this.regionDiscovery.detectRegion(\n this.authorityOptions.azureRegionConfiguration?.environmentRegion,\n this.regionDiscoveryMetadata,\n this.proxyUrl\n );\n\n const azureRegion = \n this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG\n ? autodetectedRegionName\n : this.authorityOptions.azureRegionConfiguration?.azureRegion;\n\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {\n this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;\n } else {\n if (autodetectedRegionName) {\n this.regionDiscoveryMetadata.region_outcome = (\n this.authorityOptions.azureRegionConfiguration?.azureRegion === autodetectedRegionName\n ) ?\n RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :\n RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;\n } else {\n this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;\n }\n }\n\n if (azureRegion) {\n this.regionDiscoveryMetadata.region_used = azureRegion;\n return Authority.replaceWithRegionalInformation(metadata, azureRegion);\n }\n\n return metadata;\n }\n\n /**\n * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache\n * and returns where the information was retrieved from\n * @param cachedMetadata\n * @param newMetadata\n */\n private async updateCloudDiscoveryMetadata(metadataEntity: AuthorityMetadataEntity): Promise<AuthorityMetadataSource> {\n this.logger.verbose(\"Attempting to get cloud discovery metadata in the config\");\n this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE}`);\n this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE}`);\n this.logger.verbosePii(`Canonical Authority: ${metadataEntity.canonical_authority || Constants.NOT_APPLICABLE}`);\n let metadata = this.getCloudDiscoveryMetadataFromConfig();\n if (metadata) {\n this.logger.verbose(\"Found cloud discovery metadata in the config.\");\n metadataEntity.updateCloudDiscoveryMetadata(metadata, false);\n return AuthorityMetadataSource.CONFIG;\n }\n\n // If the cached metadata came from config but that config was not passed to this instance, we must go to the network\n this.logger.verbose(\"Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.\");\n const metadataEntityExpired = metadataEntity.isExpired();\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {\n this.logger.verbose(\"Found metadata in the cache.\");\n // No need to update\n return AuthorityMetadataSource.CACHE;\n } else if (metadataEntityExpired) {\n this.logger.verbose(\"The metadata entity is expired.\");\n }\n\n this.logger.verbose(\"Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.\");\n metadata = await this.getCloudDiscoveryMetadataFromNetwork();\n if (metadata) {\n this.logger.verbose(\"cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()\");\n metadataEntity.updateCloudDiscoveryMetadata(metadata, true);\n return AuthorityMetadataSource.NETWORK;\n }\n \n this.logger.verbose(\"Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.\");\n const harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();\n if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {\n this.logger.verbose(\"Found cloud discovery metadata from hardcoded values.\");\n metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);\n return AuthorityMetadataSource.HARDCODED_VALUES;\n }\n \n // Metadata could not be obtained from the config, cache, network or hardcoded values\n this.logger.error(\"Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.\");\n throw ClientConfigurationError.createUntrustedAuthorityError();\n }\n\n /**\n * Parse cloudDiscoveryMetadata config or check knownAuthorities\n */\n private getCloudDiscoveryMetadataFromConfig(): CloudDiscoveryMetadata | null {\n // Check if network response was provided in config\n if (this.authorityOptions.cloudDiscoveryMetadata) {\n this.logger.verbose(\"The cloud discovery metadata has been provided as a network response, in the config.\");\n try {\n this.logger.verbose(\"Attempting to parse the cloud discovery metadata.\");\n const parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata) as CloudInstanceDiscoveryResponse;\n const metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\n parsedResponse.metadata,\n this.hostnameAndPort\n );\n this.logger.verbose(\"Parsed the cloud discovery metadata.\");\n if (metadata) {\n this.logger.verbose(\"There is returnable metadata attached to the parsed cloud discovery metadata.\");\n return metadata;\n } else {\n this.logger.verbose(\"There is no metadata attached to the parsed cloud discovery metadata.\");\n }\n } catch (e) {\n this.logger.verbose(\"Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.\");\n throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();\n }\n }\n\n // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities\n if (this.isInKnownAuthorities()) {\n this.logger.verbose(\"The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.\");\n return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\n }\n\n return null;\n }\n\n /**\n * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config\n * \n * @param hasHardcodedMetadata boolean\n */\n private async getCloudDiscoveryMetadataFromNetwork(): Promise<CloudDiscoveryMetadata | null> {\n const instanceDiscoveryEndpoint =\n `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;\n const options: ImdsOptions = {};\n if (this.proxyUrl) {\n options.proxyUrl = this.proxyUrl;\n }\n\n /*\n * TODO: Add a timeout if the authority exists in our library's\n * hardcoded list of metadata\n */\n\n let match = null;\n try {\n const response =\n await this.networkInterface.sendGetRequestAsync<CloudInstanceDiscoveryResponse | CloudInstanceDiscoveryErrorResponse>(\n instanceDiscoveryEndpoint,\n options\n );\n \n let typedResponseBody: CloudInstanceDiscoveryResponse | CloudInstanceDiscoveryErrorResponse;\n let metadata: Array<CloudDiscoveryMetadata>;\n if (isCloudInstanceDiscoveryResponse(response.body)) {\n typedResponseBody = response.body as CloudInstanceDiscoveryResponse;\n metadata = typedResponseBody.metadata;\n\n this.logger.verbosePii(`tenant_discovery_endpoint is: ${typedResponseBody.tenant_discovery_endpoint}`);\n } else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {\n this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${response.status}`);\n\n typedResponseBody = response.body as CloudInstanceDiscoveryErrorResponse;\n if (typedResponseBody.error === Constants.INVALID_INSTANCE) {\n this.logger.error(\"The CloudInstanceDiscoveryErrorResponse error is invalid_instance.\");\n return null;\n }\n\n this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${typedResponseBody.error}`);\n this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${typedResponseBody.error_description}`);\n \n this.logger.warning(\"Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []\");\n metadata = [];\n } else {\n this.logger.error(\"AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse\");\n return null;\n }\n\n this.logger.verbose(\"Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.\");\n match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\n metadata,\n this.hostnameAndPort\n );\n } catch (error) {\n if (error instanceof AuthError) {\n this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\\nError: ${error.errorCode}\\nError Description: ${error.errorMessage}`);\n } else {\n const typedError = error as Error;\n this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\\nError: ${typedError.name}\\nError Description: ${typedError.message}`);\n }\n \n return null;\n }\n\n // Custom Domain scenario, host is trusted because Instance Discovery call succeeded\n if (!match) {\n this.logger.warning(\"The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.\");\n this.logger.verbose(\"Creating custom Authority for custom domain scenario.\");\n\n match = Authority.createCloudDiscoveryMetadataFromHost(\n this.hostnameAndPort\n );\n }\n return match;\n }\n\n /**\n * Get cloud discovery metadata for common authorities \n */\n private getCloudDiscoveryMetadataFromHarcodedValues(): CloudDiscoveryMetadata | null {\n if (this.canonicalAuthority in InstanceDiscoveryMetadata) {\n return InstanceDiscoveryMetadata[this.canonicalAuthority];\n }\n\n return null;\n }\n\n /**\n * Helper function to determine if this host is included in the knownAuthorities config option\n */\n private isInKnownAuthorities(): boolean {\n const matches = this.authorityOptions.knownAuthorities.filter((authority) => {\n return UrlString.getDomainFromUrl(authority).toLowerCase() === this.hostnameAndPort;\n });\n\n return matches.length > 0;\n }\n\n /**\n * helper function to populate the authority based on azureCloudOptions\n * @param authorityString\n * @param azureCloudOptions\n */\n static generateAuthority(authorityString: string, azureCloudOptions?: AzureCloudOptions): string {\n let authorityAzureCloudInstance;\n\n if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {\n const tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;\n authorityAzureCloudInstance = `${azureCloudOptions.azureCloudInstance}/${tenant}/`;\n }\n\n return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;\n }\n\n /**\n * Creates cloud discovery metadata object from a given host\n * @param host\n */\n static createCloudDiscoveryMetadataFromHost(host: string): CloudDiscoveryMetadata {\n return {\n preferred_network: host,\n preferred_cache: host,\n aliases: [host]\n };\n }\n\n /**\n * Searches instance discovery network response for the entry that contains the host in the aliases list\n * @param response\n * @param authority\n */\n static getCloudDiscoveryMetadataFromNetworkResponse(\n response: CloudDiscoveryMetadata[],\n authority: string\n ): CloudDiscoveryMetadata | null {\n for (let i = 0; i < response.length; i++) {\n const metadata = response[i];\n if (metadata.aliases.indexOf(authority) > -1) {\n return metadata;\n }\n }\n\n return null;\n }\n\n /**\n * helper function to generate environment from authority object\n */\n getPreferredCache(): string {\n if(this.discoveryComplete()) {\n return this.metadata.preferred_cache;\n } else {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\n }\n }\n\n /**\n * Returns whether or not the provided host is an alias of this authority instance\n * @param host\n */\n isAlias(host: string): boolean {\n return this.metadata.aliases.indexOf(host) > -1;\n }\n\n /**\n * Checks whether the provided host is that of a public cloud authority\n *\n * @param authority string\n * @returns bool\n */\n static isPublicCloudAuthority(host: string): boolean {\n return Constants.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;\n }\n\n /**\n * Rebuild the authority string with the region\n *\n * @param host string\n * @param region string\n */\n static buildRegionalAuthorityString(host: string, region: string, queryString?: string): string {\n // Create and validate a Url string object with the initial authority string\n const authorityUrlInstance = new UrlString(host);\n authorityUrlInstance.validateAsUri();\n\n const authorityUrlParts = authorityUrlInstance.getUrlComponents();\n\n let hostNameAndPort= `${region}.${authorityUrlParts.HostNameAndPort}`;\n\n if (this.isPublicCloudAuthority(authorityUrlParts.HostNameAndPort)) {\n hostNameAndPort = `${region}.${Constants.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`;\n }\n\n // Include the query string portion of the url\n const url = UrlString.constructAuthorityUriFromObject({\n ...authorityUrlInstance.getUrlComponents(),\n HostNameAndPort: hostNameAndPort\n }).urlString;\n\n // Add the query string if a query string was provided\n if (queryString) return `${url}?${queryString}`;\n\n return url;\n }\n\n /**\n * Replace the endpoints in the metadata object with their regional equivalents.\n *\n * @param metadata OpenIdConfigResponse\n * @param azureRegion string\n */\n static replaceWithRegionalInformation(metadata: OpenIdConfigResponse, azureRegion: string): OpenIdConfigResponse {\n metadata.authorization_endpoint = Authority.buildRegionalAuthorityString(metadata.authorization_endpoint, azureRegion);\n // TODO: Enquire on whether we should leave the query string or remove it before releasing the feature\n metadata.token_endpoint = Authority.buildRegionalAuthorityString(\n metadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING\n );\n\n if (metadata.end_session_endpoint) {\n metadata.end_session_endpoint = Authority.buildRegionalAuthorityString(metadata.end_session_endpoint, azureRegion);\n }\n\n return metadata;\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;AAGG;AAyBH;;;AAGG;AACH,IAAA,SAAA,kBAAA,YAAA;IAsBI,SACI,SAAA,CAAA,SAAiB,EACjB,gBAAgC,EAChC,YAA2B,EAC3B,gBAAkC,EAClC,MAAc,EACd,QAAiB,EAAA;AAEjB,QAAA,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;AACpC,QAAA,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,CAAC;AACzC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,eAAe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I,eAAe,GAAK,MAAM,SAAI,iBAAiB,CAAC,eAAiB,CAAC;QAEtE,IAAI,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE;AAChE,YAAA,eAAe,GAAM,MAAM,GAAA,GAAA,GAAI,SAAS,CAAC,iCAAmC,CAAC;AAChF,SAAA;;AAGD,QAAA,IAAM,GAAG,GAAG,SAAS,CAAC,+BAA+B,uBAC9C,oBAAoB,CAAC,gBAAgB,EAAE,KAC1C,eAAe,EAAE,eAAe,EAClC,CAAA,CAAA,CAAC,SAAS,CAAC;;AAGb,QAAA,IAAI,WAAW;YAAE,OAAU,GAAG,GAAI,GAAA,GAAA,WAAa,CAAC;AAEhD,QAAA,OAAO,GAAG,CAAC;KACd,CAAA;AAED;;;;;AAKG;AACI,IAAA,SAAA,CAAA,8BAA8B,GAArC,UAAsC,QAA8B,EAAE,WAAmB,EAAA;AACrF,QAAA,QAAQ,CAAC,sBAAsB,GAAG,SAAS,CAAC,4BAA4B,CAAC,QAAQ,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;;AAEvH,QAAA,QAAQ,CAAC,cAAc,GAAG,SAAS,CAAC,4BAA4B,CAC5D,QAAQ,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,CAAC,kCAAkC,CACrF,CAAC;QAEF,IAAI,QAAQ,CAAC,oBAAoB,EAAE;AAC/B,YAAA,QAAQ,CAAC,oBAAoB,GAAG,SAAS,CAAC,4BAA4B,CAAC,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AACtH,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB,CAAA;IACL,OAAC,SAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -2,6 +2,7 @@ import { Authority } from "./Authority";
2
2
  import { INetworkModule } from "../network/INetworkModule";
3
3
  import { ICacheManager } from "../cache/interface/ICacheManager";
4
4
  import { AuthorityOptions } from "./AuthorityOptions";
5
+ import { Logger } from "../logger/Logger";
5
6
  export declare class AuthorityFactory {
6
7
  /**
7
8
  * Create an authority object of the correct type based on the url
@@ -13,7 +14,7 @@ export declare class AuthorityFactory {
13
14
  * @param networkClient
14
15
  * @param protocolMode
15
16
  */
16
- static createDiscoveredInstance(authorityUri: string, networkClient: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, proxyUrl?: string): Promise<Authority>;
17
+ static createDiscoveredInstance(authorityUri: string, networkClient: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, logger: Logger, proxyUrl?: string): Promise<Authority>;
17
18
  /**
18
19
  * Create an authority object of the correct type based on the url
19
20
  * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
@@ -24,6 +25,6 @@ export declare class AuthorityFactory {
24
25
  * @param networkInterface
25
26
  * @param protocolMode
26
27
  */
27
- static createInstance(authorityUrl: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, proxyUrl?: string): Authority;
28
+ static createInstance(authorityUrl: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, logger: Logger, proxyUrl?: string): Authority;
28
29
  }
29
30
  //# sourceMappingURL=AuthorityFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorityFactory.d.ts","sourceRoot":"","sources":["../../src/authority/AuthorityFactory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,gBAAgB;IAEzB;;;;;;;;;OASG;WACU,wBAAwB,CACjC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,cAAc,EAC7B,YAAY,EAAE,aAAa,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,CAAC;IAkBrB;;;;;;;;;OASG;IACH,MAAM,CAAC,cAAc,CACjB,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,cAAc,EAChC,YAAY,EAAE,aAAa,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,CAAC,EAAE,MAAM,GAClB,SAAS;CAQf"}
1
+ {"version":3,"file":"AuthorityFactory.d.ts","sourceRoot":"","sources":["../../src/authority/AuthorityFactory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,qBAAa,gBAAgB;IAEzB;;;;;;;;;OASG;WACU,wBAAwB,CACjC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,cAAc,EAC7B,YAAY,EAAE,aAAa,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,CAAC;IAmBrB;;;;;;;;;OASG;IACH,MAAM,CAAC,cAAc,CACjB,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,cAAc,EAChC,YAAY,EAAE,aAAa,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAClB,SAAS;CAQf"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { Authority } from './Authority.js';
@@ -23,13 +23,13 @@ var AuthorityFactory = /** @class */ (function () {
23
23
  * @param networkClient
24
24
  * @param protocolMode
25
25
  */
26
- AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
26
+ AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl) {
27
27
  return __awaiter(this, void 0, void 0, function () {
28
28
  var acquireTokenAuthority, e_1;
29
29
  return __generator(this, function (_a) {
30
30
  switch (_a.label) {
31
31
  case 0:
32
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
32
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl);
33
33
  _a.label = 1;
34
34
  case 1:
35
35
  _a.trys.push([1, 3, , 4]);
@@ -55,12 +55,12 @@ var AuthorityFactory = /** @class */ (function () {
55
55
  * @param networkInterface
56
56
  * @param protocolMode
57
57
  */
58
- AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
58
+ AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
59
59
  // Throw error if authority url is empty
60
60
  if (StringUtils.isEmpty(authorityUrl)) {
61
61
  throw ClientConfigurationError.createUrlEmptyError();
62
62
  }
63
- return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
63
+ return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl);
64
64
  };
65
65
  return AuthorityFactory;
66
66
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorityFactory.js","sources":["../../src/authority/AuthorityFactory.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Authority } from \"./Authority\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { INetworkModule } from \"../network/INetworkModule\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\nimport { AuthorityOptions } from \"./AuthorityOptions\";\n\nexport class AuthorityFactory {\n\n /**\n * Create an authority object of the correct type based on the url\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\n *\n * Also performs endpoint discovery.\n *\n * @param authorityUri\n * @param networkClient\n * @param protocolMode\n */\n static async createDiscoveredInstance(\n authorityUri: string,\n networkClient: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n proxyUrl?: string\n ): Promise<Authority> {\n // Initialize authority and perform discovery endpoint check.\n const acquireTokenAuthority: Authority = AuthorityFactory.createInstance(\n authorityUri,\n networkClient,\n cacheManager,\n authorityOptions,\n proxyUrl\n );\n\n try {\n await acquireTokenAuthority.resolveEndpointsAsync();\n return acquireTokenAuthority;\n } catch (e) {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(e);\n }\n }\n\n /**\n * Create an authority object of the correct type based on the url\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\n *\n * Does not perform endpoint discovery.\n *\n * @param authorityUrl\n * @param networkInterface\n * @param protocolMode\n */\n static createInstance(\n authorityUrl: string,\n networkInterface: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n proxyUrl?: string\n ): Authority {\n // Throw error if authority url is empty\n if (StringUtils.isEmpty(authorityUrl)) {\n throw ClientConfigurationError.createUrlEmptyError();\n }\n\n return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAUH,IAAA,gBAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,gBAAA,GAAA;KA4DC;AA1DG;;;;;;;;;AASG;IACU,gBAAwB,CAAA,wBAAA,GAArC,UACI,YAAoB,EACpB,aAA6B,EAC7B,YAA2B,EAC3B,gBAAkC,EAClC,QAAiB,EAAA;;;;;;AAGX,wBAAA,qBAAqB,GAAc,gBAAgB,CAAC,cAAc,CACpE,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,QAAQ,CACX,CAAC;;;;AAGE,wBAAA,OAAA,CAAA,CAAA,YAAM,qBAAqB,CAAC,qBAAqB,EAAE,CAAA,CAAA;;AAAnD,wBAAA,EAAA,CAAA,IAAA,EAAmD,CAAC;AACpD,wBAAA,OAAA,CAAA,CAAA,aAAO,qBAAqB,CAAC,CAAA;;;AAE7B,wBAAA,MAAM,eAAe,CAAC,sCAAsC,CAAC,GAAC,CAAC,CAAC;;;;;AAEvE,KAAA,CAAA;AAED;;;;;;;;;AASG;IACI,gBAAc,CAAA,cAAA,GAArB,UACI,YAAoB,EACpB,gBAAgC,EAChC,YAA2B,EAC3B,gBAAkC,EAClC,QAAiB,EAAA;;AAGjB,QAAA,IAAI,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACnC,YAAA,MAAM,wBAAwB,CAAC,mBAAmB,EAAE,CAAC;AACxD,SAAA;AAED,QAAA,OAAO,IAAI,SAAS,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;KAClG,CAAA;IACL,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"AuthorityFactory.js","sources":["../../src/authority/AuthorityFactory.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Authority } from \"./Authority\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { INetworkModule } from \"../network/INetworkModule\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\nimport { AuthorityOptions } from \"./AuthorityOptions\";\nimport { Logger } from \"../logger/Logger\";\n\nexport class AuthorityFactory {\n\n /**\n * Create an authority object of the correct type based on the url\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\n *\n * Also performs endpoint discovery.\n *\n * @param authorityUri\n * @param networkClient\n * @param protocolMode\n */\n static async createDiscoveredInstance(\n authorityUri: string,\n networkClient: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n logger: Logger,\n proxyUrl?: string\n ): Promise<Authority> {\n // Initialize authority and perform discovery endpoint check.\n const acquireTokenAuthority: Authority = AuthorityFactory.createInstance(\n authorityUri,\n networkClient,\n cacheManager,\n authorityOptions,\n logger,\n proxyUrl\n );\n\n try {\n await acquireTokenAuthority.resolveEndpointsAsync();\n return acquireTokenAuthority;\n } catch (e) {\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(e);\n }\n }\n\n /**\n * Create an authority object of the correct type based on the url\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\n *\n * Does not perform endpoint discovery.\n *\n * @param authorityUrl\n * @param networkInterface\n * @param protocolMode\n */\n static createInstance(\n authorityUrl: string,\n networkInterface: INetworkModule,\n cacheManager: ICacheManager,\n authorityOptions: AuthorityOptions,\n logger: Logger,\n proxyUrl?: string\n ): Authority {\n // Throw error if authority url is empty\n if (StringUtils.isEmpty(authorityUrl)) {\n throw ClientConfigurationError.createUrlEmptyError();\n }\n\n return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAWH,IAAA,gBAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,gBAAA,GAAA;KA+DC;AA7DG;;;;;;;;;AASG;AACU,IAAA,gBAAA,CAAA,wBAAwB,GAArC,UACI,YAAoB,EACpB,aAA6B,EAC7B,YAA2B,EAC3B,gBAAkC,EAClC,MAAc,EACd,QAAiB,EAAA;;;;;;AAGX,wBAAA,qBAAqB,GAAc,gBAAgB,CAAC,cAAc,CACpE,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,QAAQ,CACX,CAAC;;;;AAGE,wBAAA,OAAA,CAAA,CAAA,YAAM,qBAAqB,CAAC,qBAAqB,EAAE,CAAA,CAAA;;AAAnD,wBAAA,EAAA,CAAA,IAAA,EAAmD,CAAC;AACpD,wBAAA,OAAA,CAAA,CAAA,aAAO,qBAAqB,CAAC,CAAA;;;AAE7B,wBAAA,MAAM,eAAe,CAAC,sCAAsC,CAAC,GAAC,CAAC,CAAC;;;;;AAEvE,KAAA,CAAA;AAED;;;;;;;;;AASG;AACI,IAAA,gBAAA,CAAA,cAAc,GAArB,UACI,YAAoB,EACpB,gBAAgC,EAChC,YAA2B,EAC3B,gBAAkC,EAClC,MAAc,EACd,QAAiB,EAAA;;AAGjB,QAAA,IAAI,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACnC,YAAA,MAAM,wBAAwB,CAAC,mBAAmB,EAAE,CAAC;AACxD,SAAA;AAED,QAAA,OAAO,IAAI,SAAS,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC1G,CAAA;IACL,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v8.0.0 2022-11-07 */
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.