@azure/msal-node 3.8.1 → 3.8.2

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 (60) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.mjs +1 -1
  3. package/dist/cache/TokenCache.mjs +1 -1
  4. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  5. package/dist/cache/serializer/Deserializer.mjs +1 -1
  6. package/dist/cache/serializer/Serializer.mjs +1 -1
  7. package/dist/client/ClientApplication.mjs +1 -1
  8. package/dist/client/ClientAssertion.mjs +1 -1
  9. package/dist/client/ClientCredentialClient.mjs +1 -1
  10. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  11. package/dist/client/DeviceCodeClient.mjs +1 -1
  12. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  13. package/dist/client/ManagedIdentityClient.mjs +1 -1
  14. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  15. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  21. package/dist/client/OnBehalfOfClient.mjs +1 -1
  22. package/dist/client/PublicClientApplication.mjs +1 -1
  23. package/dist/client/UsernamePasswordClient.mjs +1 -1
  24. package/dist/config/Configuration.mjs +1 -1
  25. package/dist/config/ManagedIdentityId.mjs +1 -1
  26. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  27. package/dist/crypto/CryptoProvider.mjs +1 -1
  28. package/dist/crypto/GuidGenerator.mjs +1 -1
  29. package/dist/crypto/HashUtils.mjs +1 -1
  30. package/dist/crypto/PkceGenerator.mjs +1 -1
  31. package/dist/error/ManagedIdentityError.mjs +1 -1
  32. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  33. package/dist/error/NodeAuthError.mjs +1 -1
  34. package/dist/index.mjs +1 -1
  35. package/dist/internals.mjs +1 -1
  36. package/dist/network/HttpClient.d.ts +29 -2
  37. package/dist/network/HttpClient.d.ts.map +1 -1
  38. package/dist/network/HttpClient.mjs +296 -250
  39. package/dist/network/HttpClient.mjs.map +1 -1
  40. package/dist/network/HttpClientWithRetries.mjs +1 -1
  41. package/dist/network/LoopbackClient.mjs +1 -1
  42. package/dist/packageMetadata.d.ts +1 -1
  43. package/dist/packageMetadata.mjs +2 -2
  44. package/dist/protocol/Authorize.mjs +1 -1
  45. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  46. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  47. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  48. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  49. package/dist/utils/Constants.mjs +1 -1
  50. package/dist/utils/EncodingUtils.mjs +1 -1
  51. package/dist/utils/NetworkUtils.mjs +1 -1
  52. package/dist/utils/TimeUtils.mjs +1 -1
  53. package/lib/msal-node.cjs +356 -311
  54. package/lib/msal-node.cjs.map +1 -1
  55. package/lib/types/network/HttpClient.d.ts +29 -2
  56. package/lib/types/network/HttpClient.d.ts.map +1 -1
  57. package/lib/types/packageMetadata.d.ts +1 -1
  58. package/package.json +1 -1
  59. package/src/network/HttpClient.ts +399 -314
  60. package/src/packageMetadata.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v3.8.1 2025-10-29 */
1
+ /*! @azure/msal-node v3.8.2 2025-11-11 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -153,7 +153,7 @@ class Serializer {
153
153
  }
154
154
  }
155
155
 
156
- /*! @azure/msal-common v15.13.1 2025-10-29 */
156
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
157
157
  /*
158
158
  * Copyright (c) Microsoft Corporation. All rights reserved.
159
159
  * Licensed under the MIT License.
@@ -433,7 +433,7 @@ const EncodingTypes = {
433
433
  UTF8: "utf-8",
434
434
  };
435
435
 
436
- /*! @azure/msal-common v15.13.1 2025-10-29 */
436
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
437
437
  /*
438
438
  * Copyright (c) Microsoft Corporation. All rights reserved.
439
439
  * Licensed under the MIT License.
@@ -450,7 +450,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
450
450
  unexpectedError: unexpectedError
451
451
  });
452
452
 
453
- /*! @azure/msal-common v15.13.1 2025-10-29 */
453
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
454
454
 
455
455
  /*
456
456
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -499,7 +499,7 @@ function createAuthError(code, additionalMessage) {
499
499
  : AuthErrorMessages[code]);
500
500
  }
501
501
 
502
- /*! @azure/msal-common v15.13.1 2025-10-29 */
502
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
503
503
  /*
504
504
  * Copyright (c) Microsoft Corporation. All rights reserved.
505
505
  * Licensed under the MIT License.
@@ -597,7 +597,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
597
597
  userTimeoutReached: userTimeoutReached
598
598
  });
599
599
 
600
- /*! @azure/msal-common v15.13.1 2025-10-29 */
600
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
601
601
 
602
602
  /*
603
603
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -849,7 +849,7 @@ function createClientAuthError(errorCode, additionalMessage) {
849
849
  return new ClientAuthError(errorCode, additionalMessage);
850
850
  }
851
851
 
852
- /*! @azure/msal-common v15.13.1 2025-10-29 */
852
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
853
853
 
854
854
  /*
855
855
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -888,7 +888,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
888
888
  },
889
889
  };
890
890
 
891
- /*! @azure/msal-common v15.13.1 2025-10-29 */
891
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
892
892
 
893
893
  /*
894
894
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1079,12 +1079,12 @@ class Logger {
1079
1079
  }
1080
1080
  }
1081
1081
 
1082
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1082
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1083
1083
  /* eslint-disable header/header */
1084
1084
  const name$1 = "@azure/msal-common";
1085
1085
  const version$1 = "15.13.1";
1086
1086
 
1087
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1087
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1088
1088
  /*
1089
1089
  * Copyright (c) Microsoft Corporation. All rights reserved.
1090
1090
  * Licensed under the MIT License.
@@ -1104,7 +1104,7 @@ const AzureCloudInstance = {
1104
1104
  AzureUsGovernment: "https://login.microsoftonline.us",
1105
1105
  };
1106
1106
 
1107
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1107
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1108
1108
  /*
1109
1109
  * Copyright (c) Microsoft Corporation. All rights reserved.
1110
1110
  * Licensed under the MIT License.
@@ -1160,7 +1160,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1160
1160
  urlParseError: urlParseError
1161
1161
  });
1162
1162
 
1163
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1163
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1164
1164
 
1165
1165
  /*
1166
1166
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1303,7 +1303,7 @@ function createClientConfigurationError(errorCode) {
1303
1303
  return new ClientConfigurationError(errorCode);
1304
1304
  }
1305
1305
 
1306
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1306
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1307
1307
  /*
1308
1308
  * Copyright (c) Microsoft Corporation. All rights reserved.
1309
1309
  * Licensed under the MIT License.
@@ -1400,7 +1400,7 @@ class StringUtils {
1400
1400
  }
1401
1401
  }
1402
1402
 
1403
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1403
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1404
1404
 
1405
1405
  /*
1406
1406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1595,7 +1595,7 @@ class ScopeSet {
1595
1595
  }
1596
1596
  }
1597
1597
 
1598
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1598
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1599
1599
 
1600
1600
  /*
1601
1601
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1635,7 +1635,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
1635
1635
  };
1636
1636
  }
1637
1637
 
1638
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1638
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1639
1639
  /*
1640
1640
  * Copyright (c) Microsoft Corporation. All rights reserved.
1641
1641
  * Licensed under the MIT License.
@@ -1717,7 +1717,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1717
1717
  return updatedAccountInfo;
1718
1718
  }
1719
1719
 
1720
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1720
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1721
1721
  /*
1722
1722
  * Copyright (c) Microsoft Corporation. All rights reserved.
1723
1723
  * Licensed under the MIT License.
@@ -1732,7 +1732,7 @@ const AuthorityType = {
1732
1732
  Ciam: 3,
1733
1733
  };
1734
1734
 
1735
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1735
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1736
1736
  /*
1737
1737
  * Copyright (c) Microsoft Corporation. All rights reserved.
1738
1738
  * Licensed under the MIT License.
@@ -1754,7 +1754,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
1754
1754
  return null;
1755
1755
  }
1756
1756
 
1757
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1757
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1758
1758
  /*
1759
1759
  * Copyright (c) Microsoft Corporation. All rights reserved.
1760
1760
  * Licensed under the MIT License.
@@ -1778,7 +1778,7 @@ const ProtocolMode = {
1778
1778
  EAR: "EAR",
1779
1779
  };
1780
1780
 
1781
- /*! @azure/msal-common v15.13.1 2025-10-29 */
1781
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
1782
1782
 
1783
1783
  /*
1784
1784
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1999,7 +1999,7 @@ class AccountEntity {
1999
1999
  }
2000
2000
  }
2001
2001
 
2002
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2002
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2003
2003
 
2004
2004
  /*
2005
2005
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2080,7 +2080,7 @@ function checkMaxAge(authTime, maxAge) {
2080
2080
  }
2081
2081
  }
2082
2082
 
2083
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2083
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2084
2084
  /**
2085
2085
  * Parses hash string from given string. Returns empty string if no hash symbol is found.
2086
2086
  * @param hashString
@@ -2140,7 +2140,7 @@ function mapToQueryString(parameters, encodeExtraParams = true, extraQueryParame
2140
2140
  return queryParameterArray.join("&");
2141
2141
  }
2142
2142
 
2143
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2143
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2144
2144
 
2145
2145
  /*
2146
2146
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2304,7 +2304,7 @@ class UrlString {
2304
2304
  }
2305
2305
  }
2306
2306
 
2307
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2307
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2308
2308
 
2309
2309
  /*
2310
2310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2443,7 +2443,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2443
2443
  return null;
2444
2444
  }
2445
2445
 
2446
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2446
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2447
2447
  /*
2448
2448
  * Copyright (c) Microsoft Corporation. All rights reserved.
2449
2449
  * Licensed under the MIT License.
@@ -2451,7 +2451,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2451
2451
  const cacheQuotaExceeded = "cache_quota_exceeded";
2452
2452
  const cacheErrorUnknown = "cache_error_unknown";
2453
2453
 
2454
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2454
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2455
2455
 
2456
2456
  /*
2457
2457
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2496,7 +2496,7 @@ function createCacheError(e) {
2496
2496
  }
2497
2497
  }
2498
2498
 
2499
- /*! @azure/msal-common v15.13.1 2025-10-29 */
2499
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
2500
2500
 
2501
2501
  /*
2502
2502
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3605,7 +3605,7 @@ class DefaultStorageClass extends CacheManager {
3605
3605
  }
3606
3606
  }
3607
3607
 
3608
- /*! @azure/msal-common v15.13.1 2025-10-29 */
3608
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
3609
3609
  /*
3610
3610
  * Copyright (c) Microsoft Corporation. All rights reserved.
3611
3611
  * Licensed under the MIT License.
@@ -3872,7 +3872,7 @@ const PerformanceEvents = {
3872
3872
  const PerformanceEventStatus = {
3873
3873
  InProgress: 1};
3874
3874
 
3875
- /*! @azure/msal-common v15.13.1 2025-10-29 */
3875
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
3876
3876
 
3877
3877
  /*
3878
3878
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3951,7 +3951,7 @@ class StubPerformanceClient {
3951
3951
  }
3952
3952
  }
3953
3953
 
3954
- /*! @azure/msal-common v15.13.1 2025-10-29 */
3954
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
3955
3955
 
3956
3956
  /*
3957
3957
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4051,7 +4051,7 @@ function isOidcProtocolMode(config) {
4051
4051
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4052
4052
  }
4053
4053
 
4054
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4054
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4055
4055
  /*
4056
4056
  * Copyright (c) Microsoft Corporation. All rights reserved.
4057
4057
  * Licensed under the MIT License.
@@ -4061,7 +4061,7 @@ const CcsCredentialType = {
4061
4061
  UPN: "UPN",
4062
4062
  };
4063
4063
 
4064
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4064
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4065
4065
  /*
4066
4066
  * Copyright (c) Microsoft Corporation. All rights reserved.
4067
4067
  * Licensed under the MIT License.
@@ -4112,7 +4112,7 @@ const BROKER_CLIENT_ID = "brk_client_id";
4112
4112
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4113
4113
  const INSTANCE_AWARE = "instance_aware";
4114
4114
 
4115
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4115
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4116
4116
 
4117
4117
  /*
4118
4118
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4498,7 +4498,7 @@ function addBrokerParameters(parameters, brokerClientId, brokerRedirectUri) {
4498
4498
  }
4499
4499
  }
4500
4500
 
4501
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4501
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4502
4502
  /*
4503
4503
  * Copyright (c) Microsoft Corporation. All rights reserved.
4504
4504
  * Licensed under the MIT License.
@@ -4510,7 +4510,7 @@ function isOpenIdConfigResponse(response) {
4510
4510
  response.hasOwnProperty("jwks_uri"));
4511
4511
  }
4512
4512
 
4513
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4513
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4514
4514
  /*
4515
4515
  * Copyright (c) Microsoft Corporation. All rights reserved.
4516
4516
  * Licensed under the MIT License.
@@ -4520,7 +4520,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4520
4520
  response.hasOwnProperty("metadata"));
4521
4521
  }
4522
4522
 
4523
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4523
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4524
4524
  /*
4525
4525
  * Copyright (c) Microsoft Corporation. All rights reserved.
4526
4526
  * Licensed under the MIT License.
@@ -4530,7 +4530,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4530
4530
  response.hasOwnProperty("error_description"));
4531
4531
  }
4532
4532
 
4533
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4533
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4534
4534
  /*
4535
4535
  * Copyright (c) Microsoft Corporation. All rights reserved.
4536
4536
  * Licensed under the MIT License.
@@ -4626,7 +4626,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4626
4626
  };
4627
4627
  };
4628
4628
 
4629
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4629
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4630
4630
 
4631
4631
  /*
4632
4632
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4732,7 +4732,7 @@ RegionDiscovery.IMDS_OPTIONS = {
4732
4732
  },
4733
4733
  };
4734
4734
 
4735
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4735
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4736
4736
  /*
4737
4737
  * Copyright (c) Microsoft Corporation. All rights reserved.
4738
4738
  * Licensed under the MIT License.
@@ -4787,7 +4787,7 @@ function delay(t, value) {
4787
4787
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
4788
4788
  }
4789
4789
 
4790
- /*! @azure/msal-common v15.13.1 2025-10-29 */
4790
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
4791
4791
 
4792
4792
  /*
4793
4793
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5049,7 +5049,7 @@ function isAuthorityMetadataExpired(metadata) {
5049
5049
  return metadata.expiresAt <= nowSeconds();
5050
5050
  }
5051
5051
 
5052
- /*! @azure/msal-common v15.13.1 2025-10-29 */
5052
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
5053
5053
 
5054
5054
  /*
5055
5055
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5888,7 +5888,7 @@ function buildStaticAuthorityOptions(authOptions) {
5888
5888
  };
5889
5889
  }
5890
5890
 
5891
- /*! @azure/msal-common v15.13.1 2025-10-29 */
5891
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
5892
5892
 
5893
5893
  /*
5894
5894
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5919,7 +5919,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
5919
5919
  }
5920
5920
  }
5921
5921
 
5922
- /*! @azure/msal-common v15.13.1 2025-10-29 */
5922
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
5923
5923
 
5924
5924
  /*
5925
5925
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5938,7 +5938,7 @@ class ServerError extends AuthError {
5938
5938
  }
5939
5939
  }
5940
5940
 
5941
- /*! @azure/msal-common v15.13.1 2025-10-29 */
5941
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
5942
5942
  /*
5943
5943
  * Copyright (c) Microsoft Corporation. All rights reserved.
5944
5944
  * Licensed under the MIT License.
@@ -5959,7 +5959,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
5959
5959
  };
5960
5960
  }
5961
5961
 
5962
- /*! @azure/msal-common v15.13.1 2025-10-29 */
5962
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
5963
5963
 
5964
5964
  /*
5965
5965
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6046,7 +6046,7 @@ class ThrottlingUtils {
6046
6046
  }
6047
6047
  }
6048
6048
 
6049
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6049
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6050
6050
 
6051
6051
  /*
6052
6052
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6066,7 +6066,7 @@ class NetworkError extends AuthError {
6066
6066
  }
6067
6067
  }
6068
6068
 
6069
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6069
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6070
6070
 
6071
6071
  /*
6072
6072
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6214,7 +6214,7 @@ class BaseClient {
6214
6214
  }
6215
6215
  }
6216
6216
 
6217
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6217
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6218
6218
  /*
6219
6219
  * Copyright (c) Microsoft Corporation. All rights reserved.
6220
6220
  * Licensed under the MIT License.
@@ -6242,7 +6242,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6242
6242
  uxNotAllowed: uxNotAllowed
6243
6243
  });
6244
6244
 
6245
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6245
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6246
6246
 
6247
6247
  /*
6248
6248
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6332,7 +6332,7 @@ function createInteractionRequiredAuthError(errorCode) {
6332
6332
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6333
6333
  }
6334
6334
 
6335
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6335
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6336
6336
 
6337
6337
  /*
6338
6338
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6404,7 +6404,7 @@ class ProtocolUtils {
6404
6404
  }
6405
6405
  }
6406
6406
 
6407
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6407
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6408
6408
 
6409
6409
  /*
6410
6410
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6486,7 +6486,7 @@ class PopTokenGenerator {
6486
6486
  }
6487
6487
  }
6488
6488
 
6489
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6489
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6490
6490
  /*
6491
6491
  * Copyright (c) Microsoft Corporation. All rights reserved.
6492
6492
  * Licensed under the MIT License.
@@ -6513,7 +6513,7 @@ class PopTokenGenerator {
6513
6513
  }
6514
6514
  }
6515
6515
 
6516
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6516
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6517
6517
 
6518
6518
  /*
6519
6519
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6844,7 +6844,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6844
6844
  return baseAccount;
6845
6845
  }
6846
6846
 
6847
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6847
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6848
6848
  /*
6849
6849
  * Copyright (c) Microsoft Corporation. All rights reserved.
6850
6850
  * Licensed under the MIT License.
@@ -6862,7 +6862,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
6862
6862
  }
6863
6863
  }
6864
6864
 
6865
- /*! @azure/msal-common v15.13.1 2025-10-29 */
6865
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
6866
6866
 
6867
6867
  /*
6868
6868
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7097,7 +7097,7 @@ class AuthorizationCodeClient extends BaseClient {
7097
7097
  }
7098
7098
  }
7099
7099
 
7100
- /*! @azure/msal-common v15.13.1 2025-10-29 */
7100
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
7101
7101
 
7102
7102
  /*
7103
7103
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7306,7 +7306,7 @@ class RefreshTokenClient extends BaseClient {
7306
7306
  }
7307
7307
  }
7308
7308
 
7309
- /*! @azure/msal-common v15.13.1 2025-10-29 */
7309
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
7310
7310
 
7311
7311
  /*
7312
7312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7404,7 +7404,7 @@ class SilentFlowClient extends BaseClient {
7404
7404
  }
7405
7405
  }
7406
7406
 
7407
- /*! @azure/msal-common v15.13.1 2025-10-29 */
7407
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
7408
7408
 
7409
7409
  /*
7410
7410
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7554,7 +7554,7 @@ function extractLoginHint(account) {
7554
7554
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7555
7555
  }
7556
7556
 
7557
- /*! @azure/msal-common v15.13.1 2025-10-29 */
7557
+ /*! @azure/msal-common v15.13.1 2025-11-11 */
7558
7558
 
7559
7559
  /*
7560
7560
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8191,6 +8191,10 @@ class NetworkUtils {
8191
8191
  }
8192
8192
  }
8193
8193
 
8194
+ /* eslint-disable header/header */
8195
+ const name = "@azure/msal-node";
8196
+ const version = "3.8.2";
8197
+
8194
8198
  /*
8195
8199
  * Copyright (c) Microsoft Corporation. All rights reserved.
8196
8200
  * Licensed under the MIT License.
@@ -8199,9 +8203,296 @@ class NetworkUtils {
8199
8203
  * This class implements the API for network requests.
8200
8204
  */
8201
8205
  class HttpClient {
8202
- constructor(proxyUrl, customAgentOptions) {
8206
+ constructor(proxyUrl, customAgentOptions, loggerOptions) {
8207
+ this.networkRequestViaProxy = (httpMethod, destinationUrlString, options, timeout) => {
8208
+ const destinationUrl = new URL(destinationUrlString);
8209
+ const proxyUrl = new URL(this.proxyUrl);
8210
+ // "method: connect" must be used to establish a connection to the proxy
8211
+ const headers = options?.headers || {};
8212
+ const tunnelRequestOptions = {
8213
+ host: proxyUrl.hostname,
8214
+ port: proxyUrl.port,
8215
+ method: "CONNECT",
8216
+ path: destinationUrl.hostname,
8217
+ headers: headers,
8218
+ };
8219
+ if (this.customAgentOptions &&
8220
+ Object.keys(this.customAgentOptions).length) {
8221
+ tunnelRequestOptions.agent = new http.Agent(this.customAgentOptions);
8222
+ }
8223
+ // compose a request string for the socket
8224
+ let postRequestStringContent = "";
8225
+ if (httpMethod === HttpMethod.POST) {
8226
+ const body = options?.body || "";
8227
+ postRequestStringContent =
8228
+ "Content-Type: application/x-www-form-urlencoded\r\n" +
8229
+ `Content-Length: ${body.length}\r\n` +
8230
+ `\r\n${body}`;
8231
+ }
8232
+ else {
8233
+ // optional timeout is only for get requests (regionDiscovery, for example)
8234
+ if (timeout) {
8235
+ tunnelRequestOptions.timeout = timeout;
8236
+ }
8237
+ }
8238
+ const outgoingRequestString = `${httpMethod.toUpperCase()} ${destinationUrl.href} HTTP/1.1\r\n` +
8239
+ `Host: ${destinationUrl.host}\r\n` +
8240
+ "Connection: close\r\n" +
8241
+ postRequestStringContent +
8242
+ "\r\n";
8243
+ return new Promise((resolve, reject) => {
8244
+ const request = http.request(tunnelRequestOptions);
8245
+ if (timeout) {
8246
+ request.on("timeout", () => {
8247
+ this.logUrlWithPiiAwareness(`Request timeout after ${timeout}ms for URL`, destinationUrlString);
8248
+ request.destroy();
8249
+ reject(new Error(`Request time out after ${timeout}ms`));
8250
+ });
8251
+ }
8252
+ request.end();
8253
+ // establish connection to the proxy
8254
+ request.on("connect", (response, socket) => {
8255
+ const proxyStatusCode = response?.statusCode || ProxyStatus.SERVER_ERROR;
8256
+ if (proxyStatusCode < ProxyStatus.SUCCESS_RANGE_START ||
8257
+ proxyStatusCode > ProxyStatus.SUCCESS_RANGE_END) {
8258
+ request.destroy();
8259
+ socket.destroy();
8260
+ reject(new Error(`Error connecting to proxy. Http status code: ${response.statusCode}. Http status message: ${response?.statusMessage || "Unknown"}`));
8261
+ }
8262
+ // make a request over an HTTP tunnel
8263
+ socket.write(outgoingRequestString);
8264
+ const data = [];
8265
+ socket.on("data", (chunk) => {
8266
+ data.push(chunk);
8267
+ });
8268
+ socket.on("end", () => {
8269
+ // combine all received buffer streams into one buffer, and then into a string
8270
+ const dataString = Buffer.concat([...data]).toString();
8271
+ // separate each line into it's own entry in an arry
8272
+ const dataStringArray = dataString.split("\r\n");
8273
+ // the first entry will contain the statusCode and statusMessage
8274
+ const httpStatusCode = parseInt(dataStringArray[0].split(" ")[1]);
8275
+ // remove "HTTP/1.1" and the status code to get the status message
8276
+ const statusMessage = dataStringArray[0]
8277
+ .split(" ")
8278
+ .slice(2)
8279
+ .join(" ");
8280
+ // the last entry will contain the body
8281
+ const body = dataStringArray[dataStringArray.length - 1];
8282
+ // everything in between the first and last entries are the headers
8283
+ const headersArray = dataStringArray.slice(1, dataStringArray.length - 2);
8284
+ // build an object out of all the headers
8285
+ const entries = new Map();
8286
+ headersArray.forEach((header) => {
8287
+ /**
8288
+ * the header might look like "Content-Length: 1531", but that is just a string
8289
+ * it needs to be converted to a key/value pair
8290
+ * split the string at the first instance of ":"
8291
+ * there may be more than one ":" if the value of the header is supposed to be a JSON object
8292
+ */
8293
+ const headerKeyValue = header.split(new RegExp(/:\s(.*)/s));
8294
+ const headerKey = headerKeyValue[0];
8295
+ let headerValue = headerKeyValue[1];
8296
+ // check if the value of the header is supposed to be a JSON object
8297
+ try {
8298
+ const object = JSON.parse(headerValue);
8299
+ // if it is, then convert it from a string to a JSON object
8300
+ if (object && typeof object === "object") {
8301
+ headerValue = object;
8302
+ }
8303
+ }
8304
+ catch (e) {
8305
+ // otherwise, leave it as a string
8306
+ }
8307
+ entries.set(headerKey, headerValue);
8308
+ });
8309
+ const headers = Object.fromEntries(entries);
8310
+ const parsedHeaders = headers;
8311
+ const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, this.parseBody(httpStatusCode, statusMessage, parsedHeaders, body), httpStatusCode);
8312
+ if (this.shouldDestroyRequest(httpStatusCode, networkResponse)) {
8313
+ request.destroy();
8314
+ }
8315
+ resolve(networkResponse);
8316
+ });
8317
+ socket.on("error", (chunk) => {
8318
+ request.destroy();
8319
+ socket.destroy();
8320
+ reject(new Error(chunk.toString()));
8321
+ });
8322
+ });
8323
+ request.on("error", (chunk) => {
8324
+ this.logger.error(`HttpClient - Proxy request error: ${chunk.toString()}`, "");
8325
+ this.logUrlWithPiiAwareness("Destination URL", destinationUrlString);
8326
+ this.logUrlWithPiiAwareness("Proxy URL", this.proxyUrl);
8327
+ this.logger.error(`HttpClient - Method: ${httpMethod}`, "");
8328
+ this.logger.errorPii(`HttpClient - Headers: ${JSON.stringify(headers)}`, "");
8329
+ request.destroy();
8330
+ reject(new Error(chunk.toString()));
8331
+ });
8332
+ });
8333
+ };
8334
+ this.networkRequestViaHttps = (httpMethod, urlString, options, timeout) => {
8335
+ const isPostRequest = httpMethod === HttpMethod.POST;
8336
+ const body = options?.body || "";
8337
+ const url = new URL(urlString);
8338
+ const headers = options?.headers || {};
8339
+ const customOptions = {
8340
+ method: httpMethod,
8341
+ headers: headers,
8342
+ ...NetworkUtils.urlToHttpOptions(url),
8343
+ };
8344
+ if (this.customAgentOptions &&
8345
+ Object.keys(this.customAgentOptions).length) {
8346
+ customOptions.agent = new https.Agent(this.customAgentOptions);
8347
+ }
8348
+ if (isPostRequest) {
8349
+ // needed for post request to work
8350
+ customOptions.headers = {
8351
+ ...customOptions.headers,
8352
+ "Content-Length": body.length,
8353
+ };
8354
+ }
8355
+ else {
8356
+ // optional timeout is only for get requests (regionDiscovery, for example)
8357
+ if (timeout) {
8358
+ customOptions.timeout = timeout;
8359
+ }
8360
+ }
8361
+ return new Promise((resolve, reject) => {
8362
+ let request;
8363
+ // managed identity sources use http instead of https
8364
+ if (customOptions.protocol === "http:") {
8365
+ request = http.request(customOptions);
8366
+ }
8367
+ else {
8368
+ request = https.request(customOptions);
8369
+ }
8370
+ if (isPostRequest) {
8371
+ request.write(body);
8372
+ }
8373
+ if (timeout) {
8374
+ request.on("timeout", () => {
8375
+ this.logUrlWithPiiAwareness(`HTTPS request timeout after ${timeout}ms for URL`, urlString);
8376
+ request.destroy();
8377
+ reject(new Error(`Request time out after ${timeout}ms`));
8378
+ });
8379
+ }
8380
+ request.end();
8381
+ request.on("response", (response) => {
8382
+ const headers = response.headers;
8383
+ const statusCode = response.statusCode;
8384
+ const statusMessage = response.statusMessage;
8385
+ const data = [];
8386
+ response.on("data", (chunk) => {
8387
+ data.push(chunk);
8388
+ });
8389
+ response.on("end", () => {
8390
+ // combine all received buffer streams into one buffer, and then into a string
8391
+ const body = Buffer.concat([...data]).toString();
8392
+ const parsedHeaders = headers;
8393
+ const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, this.parseBody(statusCode, statusMessage, parsedHeaders, body), statusCode);
8394
+ if (this.shouldDestroyRequest(statusCode, networkResponse)) {
8395
+ request.destroy();
8396
+ }
8397
+ resolve(networkResponse);
8398
+ });
8399
+ });
8400
+ request.on("error", (chunk) => {
8401
+ this.logger.error(`HttpClient - HTTPS request error: ${chunk.toString()}`, "");
8402
+ this.logUrlWithPiiAwareness("URL", urlString);
8403
+ this.logger.error(`HttpClient - Method: ${httpMethod}`, "");
8404
+ this.logger.errorPii(`HttpClient - Headers: ${JSON.stringify(headers)}`, "");
8405
+ request.destroy();
8406
+ reject(new Error(chunk.toString()));
8407
+ });
8408
+ });
8409
+ };
8410
+ /**
8411
+ * Check if extra parsing is needed on the repsonse from the server
8412
+ * @param statusCode {number} the status code of the response from the server
8413
+ * @param statusMessage {string | undefined} the status message of the response from the server
8414
+ * @param headers {Record<string, string>} the headers of the response from the server
8415
+ * @param body {string} the body from the response of the server
8416
+ * @returns {Object} JSON parsed body or error object
8417
+ */
8418
+ this.parseBody = (statusCode, statusMessage, headers, body) => {
8419
+ /*
8420
+ * Informational responses (100 – 199)
8421
+ * Successful responses (200 – 299)
8422
+ * Redirection messages (300 – 399)
8423
+ * Client error responses (400 – 499)
8424
+ * Server error responses (500 – 599)
8425
+ */
8426
+ let parsedBody;
8427
+ try {
8428
+ parsedBody = JSON.parse(body);
8429
+ }
8430
+ catch (error) {
8431
+ let errorType;
8432
+ let errorDescriptionHelper;
8433
+ if (statusCode >= HttpStatus.CLIENT_ERROR_RANGE_START &&
8434
+ statusCode <= HttpStatus.CLIENT_ERROR_RANGE_END) {
8435
+ errorType = "client_error";
8436
+ errorDescriptionHelper = "A client";
8437
+ }
8438
+ else if (statusCode >= HttpStatus.SERVER_ERROR_RANGE_START &&
8439
+ statusCode <= HttpStatus.SERVER_ERROR_RANGE_END) {
8440
+ errorType = "server_error";
8441
+ errorDescriptionHelper = "A server";
8442
+ }
8443
+ else {
8444
+ errorType = "unknown_error";
8445
+ errorDescriptionHelper = "An unknown";
8446
+ }
8447
+ parsedBody = {
8448
+ error: errorType,
8449
+ error_description: `${errorDescriptionHelper} error occured.\nHttp status code: ${statusCode}\nHttp status message: ${statusMessage || "Unknown"}\nHeaders: ${JSON.stringify(headers)}`,
8450
+ };
8451
+ }
8452
+ return parsedBody;
8453
+ };
8454
+ /**
8455
+ * Helper function to log a formatted message containing URLs, with PII-aware sanitization
8456
+ * @param label {string} the label for the log message
8457
+ * @param urlString {string} the URL to log
8458
+ */
8459
+ this.logUrlWithPiiAwareness = (label, urlString) => {
8460
+ if (this.isPiiEnabled) {
8461
+ this.logger.errorPii(`HttpClient - ${label}: ${urlString}`, "");
8462
+ }
8463
+ else {
8464
+ let urlHelper;
8465
+ try {
8466
+ const url = new URL(urlString);
8467
+ urlHelper = `${url.protocol}//${url.host}${url.pathname}`;
8468
+ }
8469
+ catch {
8470
+ urlHelper = urlString.split("?")[0] || "unknown";
8471
+ }
8472
+ this.logger.error(`HttpClient - ${label}: ${urlHelper} [Enable PII logging to see additional details]`, "");
8473
+ }
8474
+ };
8475
+ /**
8476
+ * Helper function to determine if a request should be destroyed based on status code and response body.
8477
+ * Checks if the response is an error and not part of the device code flow (authorization_pending).
8478
+ * @param statusCode {number} the status code of the response
8479
+ * @param networkResponse {NetworkResponse<T>} the network response object
8480
+ * @returns {boolean} true if the request should be destroyed, false otherwise
8481
+ */
8482
+ this.shouldDestroyRequest = (statusCode, networkResponse) => {
8483
+ return ((statusCode < HttpStatus.SUCCESS_RANGE_START ||
8484
+ statusCode > HttpStatus.SUCCESS_RANGE_END) &&
8485
+ // do not destroy the request for the device code flow
8486
+ !(networkResponse.body &&
8487
+ typeof networkResponse.body === "object" &&
8488
+ "error" in networkResponse.body &&
8489
+ networkResponse.body.error ===
8490
+ Constants.AUTHORIZATION_PENDING));
8491
+ };
8203
8492
  this.proxyUrl = proxyUrl || "";
8204
8493
  this.customAgentOptions = customAgentOptions || {};
8494
+ this.logger = new Logger(loggerOptions || {}, name, version);
8495
+ this.isPiiEnabled = this.logger.isPiiLoggingEnabled();
8205
8496
  }
8206
8497
  /**
8207
8498
  * Http Get request
@@ -8210,10 +8501,10 @@ class HttpClient {
8210
8501
  */
8211
8502
  async sendGetRequestAsync(url, options, timeout) {
8212
8503
  if (this.proxyUrl) {
8213
- return networkRequestViaProxy(url, this.proxyUrl, HttpMethod.GET, options, this.customAgentOptions, timeout);
8504
+ return this.networkRequestViaProxy(HttpMethod.GET, url, options, timeout);
8214
8505
  }
8215
8506
  else {
8216
- return networkRequestViaHttps(url, HttpMethod.GET, options, this.customAgentOptions, timeout);
8507
+ return this.networkRequestViaHttps(HttpMethod.GET, url, options, timeout);
8217
8508
  }
8218
8509
  }
8219
8510
  /**
@@ -8223,255 +8514,13 @@ class HttpClient {
8223
8514
  */
8224
8515
  async sendPostRequestAsync(url, options) {
8225
8516
  if (this.proxyUrl) {
8226
- return networkRequestViaProxy(url, this.proxyUrl, HttpMethod.POST, options, this.customAgentOptions);
8517
+ return this.networkRequestViaProxy(HttpMethod.POST, url, options);
8227
8518
  }
8228
8519
  else {
8229
- return networkRequestViaHttps(url, HttpMethod.POST, options, this.customAgentOptions);
8520
+ return this.networkRequestViaHttps(HttpMethod.POST, url, options);
8230
8521
  }
8231
8522
  }
8232
- }
8233
- const networkRequestViaProxy = (destinationUrlString, proxyUrlString, httpMethod, options, agentOptions, timeout) => {
8234
- const destinationUrl = new URL(destinationUrlString);
8235
- const proxyUrl = new URL(proxyUrlString);
8236
- // "method: connect" must be used to establish a connection to the proxy
8237
- const headers = options?.headers || {};
8238
- const tunnelRequestOptions = {
8239
- host: proxyUrl.hostname,
8240
- port: proxyUrl.port,
8241
- method: "CONNECT",
8242
- path: destinationUrl.hostname,
8243
- headers: headers,
8244
- };
8245
- if (agentOptions && Object.keys(agentOptions).length) {
8246
- tunnelRequestOptions.agent = new http.Agent(agentOptions);
8247
- }
8248
- // compose a request string for the socket
8249
- let postRequestStringContent = "";
8250
- if (httpMethod === HttpMethod.POST) {
8251
- const body = options?.body || "";
8252
- postRequestStringContent =
8253
- "Content-Type: application/x-www-form-urlencoded\r\n" +
8254
- `Content-Length: ${body.length}\r\n` +
8255
- `\r\n${body}`;
8256
- }
8257
- else {
8258
- // optional timeout is only for get requests (regionDiscovery, for example)
8259
- if (timeout) {
8260
- tunnelRequestOptions.timeout = timeout;
8261
- }
8262
- }
8263
- const outgoingRequestString = `${httpMethod.toUpperCase()} ${destinationUrl.href} HTTP/1.1\r\n` +
8264
- `Host: ${destinationUrl.host}\r\n` +
8265
- "Connection: close\r\n" +
8266
- postRequestStringContent +
8267
- "\r\n";
8268
- return new Promise((resolve, reject) => {
8269
- const request = http.request(tunnelRequestOptions);
8270
- if (timeout) {
8271
- request.on("timeout", () => {
8272
- request.destroy();
8273
- reject(new Error("Request time out"));
8274
- });
8275
- }
8276
- request.end();
8277
- // establish connection to the proxy
8278
- request.on("connect", (response, socket) => {
8279
- const proxyStatusCode = response?.statusCode || ProxyStatus.SERVER_ERROR;
8280
- if (proxyStatusCode < ProxyStatus.SUCCESS_RANGE_START ||
8281
- proxyStatusCode > ProxyStatus.SUCCESS_RANGE_END) {
8282
- request.destroy();
8283
- socket.destroy();
8284
- reject(new Error(`Error connecting to proxy. Http status code: ${response.statusCode}. Http status message: ${response?.statusMessage || "Unknown"}`));
8285
- }
8286
- // make a request over an HTTP tunnel
8287
- socket.write(outgoingRequestString);
8288
- const data = [];
8289
- socket.on("data", (chunk) => {
8290
- data.push(chunk);
8291
- });
8292
- socket.on("end", () => {
8293
- // combine all received buffer streams into one buffer, and then into a string
8294
- const dataString = Buffer.concat([...data]).toString();
8295
- // separate each line into it's own entry in an arry
8296
- const dataStringArray = dataString.split("\r\n");
8297
- // the first entry will contain the statusCode and statusMessage
8298
- const httpStatusCode = parseInt(dataStringArray[0].split(" ")[1]);
8299
- // remove "HTTP/1.1" and the status code to get the status message
8300
- const statusMessage = dataStringArray[0]
8301
- .split(" ")
8302
- .slice(2)
8303
- .join(" ");
8304
- // the last entry will contain the body
8305
- const body = dataStringArray[dataStringArray.length - 1];
8306
- // everything in between the first and last entries are the headers
8307
- const headersArray = dataStringArray.slice(1, dataStringArray.length - 2);
8308
- // build an object out of all the headers
8309
- const entries = new Map();
8310
- headersArray.forEach((header) => {
8311
- /**
8312
- * the header might look like "Content-Length: 1531", but that is just a string
8313
- * it needs to be converted to a key/value pair
8314
- * split the string at the first instance of ":"
8315
- * there may be more than one ":" if the value of the header is supposed to be a JSON object
8316
- */
8317
- const headerKeyValue = header.split(new RegExp(/:\s(.*)/s));
8318
- const headerKey = headerKeyValue[0];
8319
- let headerValue = headerKeyValue[1];
8320
- // check if the value of the header is supposed to be a JSON object
8321
- try {
8322
- const object = JSON.parse(headerValue);
8323
- // if it is, then convert it from a string to a JSON object
8324
- if (object && typeof object === "object") {
8325
- headerValue = object;
8326
- }
8327
- }
8328
- catch (e) {
8329
- // otherwise, leave it as a string
8330
- }
8331
- entries.set(headerKey, headerValue);
8332
- });
8333
- const headers = Object.fromEntries(entries);
8334
- const parsedHeaders = headers;
8335
- const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, parseBody(httpStatusCode, statusMessage, parsedHeaders, body), httpStatusCode);
8336
- if ((httpStatusCode < HttpStatus.SUCCESS_RANGE_START ||
8337
- httpStatusCode > HttpStatus.SUCCESS_RANGE_END) &&
8338
- // do not destroy the request for the device code flow
8339
- networkResponse.body["error"] !==
8340
- Constants.AUTHORIZATION_PENDING) {
8341
- request.destroy();
8342
- }
8343
- resolve(networkResponse);
8344
- });
8345
- socket.on("error", (chunk) => {
8346
- request.destroy();
8347
- socket.destroy();
8348
- reject(new Error(chunk.toString()));
8349
- });
8350
- });
8351
- request.on("error", (chunk) => {
8352
- request.destroy();
8353
- reject(new Error(chunk.toString()));
8354
- });
8355
- });
8356
- };
8357
- const networkRequestViaHttps = (urlString, httpMethod, options, agentOptions, timeout) => {
8358
- const isPostRequest = httpMethod === HttpMethod.POST;
8359
- const body = options?.body || "";
8360
- const url = new URL(urlString);
8361
- const headers = options?.headers || {};
8362
- const customOptions = {
8363
- method: httpMethod,
8364
- headers: headers,
8365
- ...NetworkUtils.urlToHttpOptions(url),
8366
- };
8367
- if (agentOptions && Object.keys(agentOptions).length) {
8368
- customOptions.agent = new https.Agent(agentOptions);
8369
- }
8370
- if (isPostRequest) {
8371
- // needed for post request to work
8372
- customOptions.headers = {
8373
- ...customOptions.headers,
8374
- "Content-Length": body.length,
8375
- };
8376
- }
8377
- else {
8378
- // optional timeout is only for get requests (regionDiscovery, for example)
8379
- if (timeout) {
8380
- customOptions.timeout = timeout;
8381
- }
8382
- }
8383
- return new Promise((resolve, reject) => {
8384
- let request;
8385
- // managed identity sources use http instead of https
8386
- if (customOptions.protocol === "http:") {
8387
- request = http.request(customOptions);
8388
- }
8389
- else {
8390
- request = https.request(customOptions);
8391
- }
8392
- if (isPostRequest) {
8393
- request.write(body);
8394
- }
8395
- if (timeout) {
8396
- request.on("timeout", () => {
8397
- request.destroy();
8398
- reject(new Error("Request time out"));
8399
- });
8400
- }
8401
- request.end();
8402
- request.on("response", (response) => {
8403
- const headers = response.headers;
8404
- const statusCode = response.statusCode;
8405
- const statusMessage = response.statusMessage;
8406
- const data = [];
8407
- response.on("data", (chunk) => {
8408
- data.push(chunk);
8409
- });
8410
- response.on("end", () => {
8411
- // combine all received buffer streams into one buffer, and then into a string
8412
- const body = Buffer.concat([...data]).toString();
8413
- const parsedHeaders = headers;
8414
- const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, parseBody(statusCode, statusMessage, parsedHeaders, body), statusCode);
8415
- if ((statusCode < HttpStatus.SUCCESS_RANGE_START ||
8416
- statusCode > HttpStatus.SUCCESS_RANGE_END) &&
8417
- // do not destroy the request for the device code flow
8418
- networkResponse.body["error"] !==
8419
- Constants.AUTHORIZATION_PENDING) {
8420
- request.destroy();
8421
- }
8422
- resolve(networkResponse);
8423
- });
8424
- });
8425
- request.on("error", (chunk) => {
8426
- request.destroy();
8427
- reject(new Error(chunk.toString()));
8428
- });
8429
- });
8430
- };
8431
- /**
8432
- * Check if extra parsing is needed on the repsonse from the server
8433
- * @param statusCode {number} the status code of the response from the server
8434
- * @param statusMessage {string | undefined} the status message of the response from the server
8435
- * @param headers {Record<string, string>} the headers of the response from the server
8436
- * @param body {string} the body from the response of the server
8437
- * @returns {Object} JSON parsed body or error object
8438
- */
8439
- const parseBody = (statusCode, statusMessage, headers, body) => {
8440
- /*
8441
- * Informational responses (100 – 199)
8442
- * Successful responses (200 – 299)
8443
- * Redirection messages (300 – 399)
8444
- * Client error responses (400 – 499)
8445
- * Server error responses (500 – 599)
8446
- */
8447
- let parsedBody;
8448
- try {
8449
- parsedBody = JSON.parse(body);
8450
- }
8451
- catch (error) {
8452
- let errorType;
8453
- let errorDescriptionHelper;
8454
- if (statusCode >= HttpStatus.CLIENT_ERROR_RANGE_START &&
8455
- statusCode <= HttpStatus.CLIENT_ERROR_RANGE_END) {
8456
- errorType = "client_error";
8457
- errorDescriptionHelper = "A client";
8458
- }
8459
- else if (statusCode >= HttpStatus.SERVER_ERROR_RANGE_START &&
8460
- statusCode <= HttpStatus.SERVER_ERROR_RANGE_END) {
8461
- errorType = "server_error";
8462
- errorDescriptionHelper = "A server";
8463
- }
8464
- else {
8465
- errorType = "unknown_error";
8466
- errorDescriptionHelper = "An unknown";
8467
- }
8468
- parsedBody = {
8469
- error: errorType,
8470
- error_description: `${errorDescriptionHelper} error occured.\nHttp status code: ${statusCode}\nHttp status message: ${statusMessage || "Unknown"}\nHeaders: ${JSON.stringify(headers)}`,
8471
- };
8472
- }
8473
- return parsedBody;
8474
- };
8523
+ }
8475
8524
 
8476
8525
  /*
8477
8526
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9909,10 +9958,6 @@ class ClientAssertion {
9909
9958
  }
9910
9959
  }
9911
9960
 
9912
- /* eslint-disable header/header */
9913
- const name = "@azure/msal-node";
9914
- const version = "3.8.1";
9915
-
9916
9961
  /*
9917
9962
  * Copyright (c) Microsoft Corporation. All rights reserved.
9918
9963
  * Licensed under the MIT License.