@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
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.
3
+ */
4
+ export declare type CloudInstanceDiscoveryErrorResponse = {
5
+ error: String;
6
+ error_description: String;
7
+ error_codes?: Array<Number>;
8
+ timestamp?: String;
9
+ trace_id?: String;
10
+ correlation_id?: String;
11
+ error_uri?: String;
12
+ };
13
+ export declare function isCloudInstanceDiscoveryErrorResponse(response: object): boolean;
14
+ //# sourceMappingURL=CloudInstanceDiscoveryErrorResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudInstanceDiscoveryErrorResponse.d.ts","sourceRoot":"","sources":["../../src/authority/CloudInstanceDiscoveryErrorResponse.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,mCAAmC,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,qCAAqC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK/E"}
@@ -0,0 +1,13 @@
1
+ /*! @azure/msal-common v9.0.1 2022-12-07 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ function isCloudInstanceDiscoveryErrorResponse(response) {
8
+ return (response.hasOwnProperty("error") &&
9
+ response.hasOwnProperty("error_description"));
10
+ }
11
+
12
+ export { isCloudInstanceDiscoveryErrorResponse };
13
+ //# sourceMappingURL=CloudInstanceDiscoveryErrorResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudInstanceDiscoveryErrorResponse.js","sources":["../../src/authority/CloudInstanceDiscoveryErrorResponse.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.\n */\nexport type CloudInstanceDiscoveryErrorResponse = {\n error: String;\n error_description: String;\n error_codes?: Array<Number>;\n timestamp?: String;\n trace_id?: String;\n correlation_id?: String;\n error_uri?: String;\n};\n\nexport function isCloudInstanceDiscoveryErrorResponse(response: object): boolean {\n return (\n response.hasOwnProperty(\"error\") &&\n response.hasOwnProperty(\"error_description\")\n );\n}\n"],"names":[],"mappings":";;AAAA;;;AAGG;AAeG,SAAU,qCAAqC,CAAC,QAAgB,EAAA;AAClE,IAAA,QACI,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC;AAChC,QAAA,QAAQ,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAC9C;AACN;;;;"}
@@ -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.
@@ -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 { RegionDiscoverySources, ResponseCodes, 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.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants, CredentialType, AuthenticationScheme, CacheSchemaType, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';
@@ -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 { __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.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { Separators, CacheAccountType, CacheType, Constants } from '../../utils/Constants.js';
4
4
  import { buildClientInfo } from '../../account/ClientInfo.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
  import { Separators, APP_METADATA } 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.1 2022-12-07 */
2
2
  'use strict';
3
3
  import { AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.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.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 { CredentialType, CacheType, Constants, Separators, AuthenticationScheme } from '../../utils/Constants.js';
4
4
  import { ClientAuthError } from '../../error/ClientAuthError.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
  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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.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 { __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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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.1 2022-12-07 */
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",
@@ -141,7 +142,8 @@ var Constants = {
141
142
  KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
142
143
  TOKEN_RESPONSE_TYPE: "token",
143
144
  ID_TOKEN_RESPONSE_TYPE: "id_token",
144
- SHR_NONCE_VALIDITY: 240
145
+ SHR_NONCE_VALIDITY: 240,
146
+ INVALID_INSTANCE: "invalid_instance",
145
147
  };
146
148
  var OIDC_DEFAULT_SCOPES = [
147
149
  Constants.OPENID_SCOPE,
@@ -1409,7 +1411,7 @@ var Logger = /** @class */ (function () {
1409
1411
 
1410
1412
  /* eslint-disable header/header */
1411
1413
  var name = "@azure/msal-common";
1412
- var version = "8.0.0";
1414
+ var version = "9.0.1";
1413
1415
 
1414
1416
  /*
1415
1417
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7023,6 +7025,15 @@ function isCloudInstanceDiscoveryResponse(response) {
7023
7025
  response.hasOwnProperty("metadata"));
7024
7026
  }
7025
7027
 
7028
+ /*
7029
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7030
+ * Licensed under the MIT License.
7031
+ */
7032
+ function isCloudInstanceDiscoveryErrorResponse(response) {
7033
+ return (response.hasOwnProperty("error") &&
7034
+ response.hasOwnProperty("error_description"));
7035
+ }
7036
+
7026
7037
  /*
7027
7038
  * Copyright (c) Microsoft Corporation. All rights reserved.
7028
7039
  * Licensed under the MIT License.
@@ -7152,7 +7163,7 @@ var RegionDiscovery = /** @class */ (function () {
7152
7163
  * endpoint. It will store the pertinent config data in this object for use during token calls.
7153
7164
  */
7154
7165
  var Authority = /** @class */ (function () {
7155
- function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
7166
+ function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
7156
7167
  this.canonicalAuthority = authority;
7157
7168
  this._canonicalAuthority.validateAsUri();
7158
7169
  this.networkInterface = networkInterface;
@@ -7161,6 +7172,7 @@ var Authority = /** @class */ (function () {
7161
7172
  this.regionDiscovery = new RegionDiscovery(networkInterface);
7162
7173
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
7163
7174
  this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
7175
+ this.logger = logger;
7164
7176
  }
7165
7177
  Object.defineProperty(Authority.prototype, "authorityType", {
7166
7178
  // See above for AuthorityType
@@ -7587,36 +7599,50 @@ var Authority = /** @class */ (function () {
7587
7599
  */
7588
7600
  Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
7589
7601
  return __awaiter(this, void 0, void 0, function () {
7590
- var metadata, harcodedMetadata;
7602
+ var metadata, metadataEntityExpired, harcodedMetadata;
7591
7603
  return __generator(this, function (_a) {
7592
7604
  switch (_a.label) {
7593
7605
  case 0:
7606
+ this.logger.verbose("Attempting to get cloud discovery metadata in the config");
7607
+ this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
7608
+ this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
7609
+ this.logger.verbosePii("Canonical Authority: " + (metadataEntity.canonical_authority || Constants.NOT_APPLICABLE));
7594
7610
  metadata = this.getCloudDiscoveryMetadataFromConfig();
7595
7611
  if (metadata) {
7612
+ this.logger.verbose("Found cloud discovery metadata in the config.");
7596
7613
  metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
7597
7614
  return [2 /*return*/, AuthorityMetadataSource.CONFIG];
7598
7615
  }
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()) {
7616
+ // If the cached metadata came from config but that config was not passed to this instance, we must go to the network
7617
+ this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.");
7618
+ metadataEntityExpired = metadataEntity.isExpired();
7619
+ if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {
7620
+ this.logger.verbose("Found metadata in the cache.");
7601
7621
  // No need to update
7602
7622
  return [2 /*return*/, AuthorityMetadataSource.CACHE];
7603
7623
  }
7604
- harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
7624
+ else if (metadataEntityExpired) {
7625
+ this.logger.verbose("The metadata entity is expired.");
7626
+ }
7627
+ this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
7605
7628
  return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
7606
7629
  case 1:
7607
7630
  metadata = _a.sent();
7608
7631
  if (metadata) {
7632
+ this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
7609
7633
  metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
7610
7634
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
7611
7635
  }
7636
+ this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.");
7637
+ harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
7612
7638
  if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
7639
+ this.logger.verbose("Found cloud discovery metadata from hardcoded values.");
7613
7640
  metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
7614
7641
  return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
7615
7642
  }
7616
- else {
7617
- // Metadata could not be obtained from config, cache or network
7618
- throw ClientConfigurationError.createUntrustedAuthorityError();
7619
- }
7643
+ // Metadata could not be obtained from the config, cache, network or hardcoded values
7644
+ 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.");
7645
+ throw ClientConfigurationError.createUntrustedAuthorityError();
7620
7646
  }
7621
7647
  });
7622
7648
  });
@@ -7627,19 +7653,28 @@ var Authority = /** @class */ (function () {
7627
7653
  Authority.prototype.getCloudDiscoveryMetadataFromConfig = function () {
7628
7654
  // Check if network response was provided in config
7629
7655
  if (this.authorityOptions.cloudDiscoveryMetadata) {
7656
+ this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");
7630
7657
  try {
7658
+ this.logger.verbose("Attempting to parse the cloud discovery metadata.");
7631
7659
  var parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata);
7632
7660
  var metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(parsedResponse.metadata, this.hostnameAndPort);
7661
+ this.logger.verbose("Parsed the cloud discovery metadata.");
7633
7662
  if (metadata) {
7663
+ this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata.");
7634
7664
  return metadata;
7635
7665
  }
7666
+ else {
7667
+ this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.");
7668
+ }
7636
7669
  }
7637
7670
  catch (e) {
7671
+ this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.");
7638
7672
  throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();
7639
7673
  }
7640
7674
  }
7641
7675
  // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities
7642
7676
  if (this.isInKnownAuthorities()) {
7677
+ this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.");
7643
7678
  return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
7644
7679
  }
7645
7680
  return null;
@@ -7651,7 +7686,7 @@ var Authority = /** @class */ (function () {
7651
7686
  */
7652
7687
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
7653
7688
  return __awaiter(this, void 0, void 0, function () {
7654
- var instanceDiscoveryEndpoint, options, match, response, metadata;
7689
+ var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;
7655
7690
  return __generator(this, function (_a) {
7656
7691
  switch (_a.label) {
7657
7692
  case 0:
@@ -7667,21 +7702,47 @@ var Authority = /** @class */ (function () {
7667
7702
  return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
7668
7703
  case 2:
7669
7704
  response = _a.sent();
7670
- metadata = isCloudInstanceDiscoveryResponse(response.body)
7671
- ? response.body.metadata
7672
- : [];
7673
- if (metadata.length === 0) {
7674
- // If no metadata is returned, authority is untrusted
7705
+ typedResponseBody = void 0;
7706
+ metadata = void 0;
7707
+ if (isCloudInstanceDiscoveryResponse(response.body)) {
7708
+ typedResponseBody = response.body;
7709
+ metadata = typedResponseBody.metadata;
7710
+ this.logger.verbosePii("tenant_discovery_endpoint is: " + typedResponseBody.tenant_discovery_endpoint);
7711
+ }
7712
+ else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {
7713
+ this.logger.warning("A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: " + response.status);
7714
+ typedResponseBody = response.body;
7715
+ if (typedResponseBody.error === Constants.INVALID_INSTANCE) {
7716
+ this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance.");
7717
+ return [2 /*return*/, null];
7718
+ }
7719
+ this.logger.warning("The CloudInstanceDiscoveryErrorResponse error is " + typedResponseBody.error);
7720
+ this.logger.warning("The CloudInstanceDiscoveryErrorResponse error description is " + typedResponseBody.error_description);
7721
+ this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []");
7722
+ metadata = [];
7723
+ }
7724
+ else {
7725
+ this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse");
7675
7726
  return [2 /*return*/, null];
7676
7727
  }
7728
+ this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.");
7677
7729
  match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
7678
7730
  return [3 /*break*/, 4];
7679
7731
  case 3:
7680
- _a.sent();
7732
+ error_1 = _a.sent();
7733
+ if (error_1 instanceof AuthError) {
7734
+ 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);
7735
+ }
7736
+ else {
7737
+ typedError = error_1;
7738
+ 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);
7739
+ }
7681
7740
  return [2 /*return*/, null];
7682
7741
  case 4:
7742
+ // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
7683
7743
  if (!match) {
7684
- // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
7744
+ this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.");
7745
+ this.logger.verbose("Creating custom Authority for custom domain scenario.");
7685
7746
  match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
7686
7747
  }
7687
7748
  return [2 /*return*/, match];
@@ -7830,13 +7891,13 @@ var AuthorityFactory = /** @class */ (function () {
7830
7891
  * @param networkClient
7831
7892
  * @param protocolMode
7832
7893
  */
7833
- AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
7894
+ AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl) {
7834
7895
  return __awaiter(this, void 0, void 0, function () {
7835
7896
  var acquireTokenAuthority, e_1;
7836
7897
  return __generator(this, function (_a) {
7837
7898
  switch (_a.label) {
7838
7899
  case 0:
7839
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
7900
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, proxyUrl);
7840
7901
  _a.label = 1;
7841
7902
  case 1:
7842
7903
  _a.trys.push([1, 3, , 4]);
@@ -7862,12 +7923,12 @@ var AuthorityFactory = /** @class */ (function () {
7862
7923
  * @param networkInterface
7863
7924
  * @param protocolMode
7864
7925
  */
7865
- AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
7926
+ AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl) {
7866
7927
  // Throw error if authority url is empty
7867
7928
  if (StringUtils.isEmpty(authorityUrl)) {
7868
7929
  throw ClientConfigurationError.createUrlEmptyError();
7869
7930
  }
7870
- return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
7931
+ return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl);
7871
7932
  };
7872
7933
  return AuthorityFactory;
7873
7934
  }());