@azure/identity 3.3.1-alpha.20230927.1 → 3.3.1-alpha.20231009.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.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var msalNode = require('@azure/msal-node');
6
4
  var logger$o = require('@azure/logger');
7
5
  var msalCommon = require('@azure/msal-common');
@@ -23,10 +21,7 @@ var http = require('http');
23
21
  var open = require('open');
24
22
  var stoppable = require('stoppable');
25
23
 
26
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
-
28
- function _interopNamespace(e) {
29
- if (e && e.__esModule) return e;
24
+ function _interopNamespaceDefault(e) {
30
25
  var n = Object.create(null);
31
26
  if (e) {
32
27
  Object.keys(e).forEach(function (k) {
@@ -39,21 +34,13 @@ function _interopNamespace(e) {
39
34
  }
40
35
  });
41
36
  }
42
- n["default"] = e;
37
+ n.default = e;
43
38
  return Object.freeze(n);
44
39
  }
45
40
 
46
- var msalNode__namespace = /*#__PURE__*/_interopNamespace(msalNode);
47
- var msalCommon__namespace = /*#__PURE__*/_interopNamespace(msalCommon);
48
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
49
- var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
50
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
51
- var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
52
- var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
53
- var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
54
- var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
55
- var open__default = /*#__PURE__*/_interopDefaultLegacy(open);
56
- var stoppable__default = /*#__PURE__*/_interopDefaultLegacy(stoppable);
41
+ var msalNode__namespace = /*#__PURE__*/_interopNamespaceDefault(msalNode);
42
+ var msalCommon__namespace = /*#__PURE__*/_interopNamespaceDefault(msalCommon);
43
+ var child_process__namespace = /*#__PURE__*/_interopNamespaceDefault(child_process);
57
44
 
58
45
  // Copyright (c) Microsoft Corporation.
59
46
  // Licensed under the MIT license.
@@ -175,6 +162,7 @@ class AuthenticationRequiredError extends Error {
175
162
  }
176
163
 
177
164
  // Copyright (c) Microsoft Corporation.
165
+ // Licensed under the MIT license.
178
166
  /**
179
167
  * The AzureLogger used for all clients within the identity package
180
168
  */
@@ -305,6 +293,7 @@ const CACHE_CAE_SUFFIX = ".cae";
305
293
  const CACHE_NON_CAE_SUFFIX = ".nocae";
306
294
 
307
295
  // Copyright (c) Microsoft Corporation.
296
+ // Licensed under the MIT license.
308
297
  /**
309
298
  * Latest AuthenticationRecord version
310
299
  * @internal
@@ -534,6 +523,7 @@ function deserializeAuthenticationRecord(serializedRecord) {
534
523
  }
535
524
 
536
525
  // Copyright (c) Microsoft Corporation.
526
+ // Licensed under the MIT license.
537
527
  function createConfigurationErrorMessage(tenantId) {
538
528
  return `The current credential is not configured to acquire tokens for tenant ${tenantId}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant.`;
539
529
  }
@@ -567,6 +557,7 @@ function processMultiTenantRequest(tenantId, getTokenOptions, additionallyAllowe
567
557
  }
568
558
 
569
559
  // Copyright (c) Microsoft Corporation.
560
+ // Licensed under the MIT license.
570
561
  /**
571
562
  * @internal
572
563
  */
@@ -618,6 +609,7 @@ function getIdentityTokenEndpointSuffix(tenantId) {
618
609
  }
619
610
 
620
611
  // Copyright (c) Microsoft Corporation.
612
+ // Licensed under the MIT license.
621
613
  /**
622
614
  * Creates a span using the global tracer.
623
615
  * @internal
@@ -638,6 +630,7 @@ const azureArcAPIVersion = "2019-11-01";
638
630
  const azureFabricVersion = "2019-07-01-preview";
639
631
 
640
632
  // Copyright (c) Microsoft Corporation.
633
+ // Licensed under the MIT license.
641
634
  /**
642
635
  * Most MSIs send requests to the IMDS endpoint, or a similar endpoint.
643
636
  * These are GET requests that require sending a `resource` parameter on the query.
@@ -688,6 +681,7 @@ function parseExpirationTimestamp(body) {
688
681
  }
689
682
 
690
683
  // Copyright (c) Microsoft Corporation.
684
+ // Licensed under the MIT license.
691
685
  const noCorrelationId = "noCorrelationId";
692
686
  /**
693
687
  * @internal
@@ -1032,6 +1026,7 @@ var RegionalAuthority;
1032
1026
  })(RegionalAuthority || (RegionalAuthority = {}));
1033
1027
 
1034
1028
  // Copyright (c) Microsoft Corporation.
1029
+ // Licensed under the MIT license.
1035
1030
  /**
1036
1031
  * The current persistence provider, undefined by default.
1037
1032
  * @internal
@@ -1313,6 +1308,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
1313
1308
  }
1314
1309
 
1315
1310
  // Copyright (c) Microsoft Corporation.
1311
+ // Licensed under the MIT license.
1316
1312
  const CommonTenantId = "common";
1317
1313
  const AzureAccountClientId = "aebc6443-996d-45c2-90f0-388ff96faa56"; // VSC: 'aebc6443-996d-45c2-90f0-388ff96faa56'
1318
1314
  const logger$m = credentialLogger("VisualStudioCodeCredential");
@@ -1347,10 +1343,10 @@ function getPropertyFromVSCode(property) {
1347
1343
  const settingsPath = ["User", "settings.json"];
1348
1344
  // Eventually we can add more folders for more versions of VSCode.
1349
1345
  const vsCodeFolder = "Code";
1350
- const homedir = os__default["default"].homedir();
1346
+ const homedir = os.homedir();
1351
1347
  function loadProperty(...pathSegments) {
1352
- const fullPath = path__default["default"].join(...pathSegments, vsCodeFolder, ...settingsPath);
1353
- const settings = JSON.parse(fs__default["default"].readFileSync(fullPath, { encoding: "utf8" }));
1348
+ const fullPath = path.join(...pathSegments, vsCodeFolder, ...settingsPath);
1349
+ const settings = JSON.parse(fs.readFileSync(fullPath, { encoding: "utf8" }));
1354
1350
  return settings[property];
1355
1351
  }
1356
1352
  try {
@@ -1493,6 +1489,7 @@ class VisualStudioCodeCredential {
1493
1489
  }
1494
1490
 
1495
1491
  // Copyright (c) Microsoft Corporation.
1492
+ // Licensed under the MIT license.
1496
1493
  /**
1497
1494
  * The context passed to an Identity plugin. This contains objects that
1498
1495
  * plugins can use to set backend implementations.
@@ -1534,6 +1531,7 @@ function useIdentityPlugin(plugin) {
1534
1531
  }
1535
1532
 
1536
1533
  // Copyright (c) Microsoft Corporation.
1534
+ // Licensed under the MIT license.
1537
1535
  const msiName$6 = "ManagedIdentityCredential - AppServiceMSI 2017";
1538
1536
  const logger$l = credentialLogger(msiName$6);
1539
1537
  /**
@@ -1601,6 +1599,7 @@ const appServiceMsi2017 = {
1601
1599
  };
1602
1600
 
1603
1601
  // Copyright (c) Microsoft Corporation.
1602
+ // Licensed under the MIT license.
1604
1603
  const msiName$5 = "ManagedIdentityCredential - CloudShellMSI";
1605
1604
  const logger$k = credentialLogger(msiName$5);
1606
1605
  /**
@@ -1672,6 +1671,7 @@ const cloudShellMsi = {
1672
1671
  };
1673
1672
 
1674
1673
  // Copyright (c) Microsoft Corporation.
1674
+ // Licensed under the MIT license.
1675
1675
  const msiName$4 = "ManagedIdentityCredential - IMDS";
1676
1676
  const logger$j = credentialLogger(msiName$4);
1677
1677
  /**
@@ -1804,6 +1804,7 @@ const imdsMsi = {
1804
1804
  };
1805
1805
 
1806
1806
  // Copyright (c) Microsoft Corporation.
1807
+ // Licensed under the MIT license.
1807
1808
  const msiName$3 = "ManagedIdentityCredential - Azure Arc MSI";
1808
1809
  const logger$i = credentialLogger(msiName$3);
1809
1810
  /**
@@ -1914,6 +1915,7 @@ const arcMsi = {
1914
1915
  };
1915
1916
 
1916
1917
  // Copyright (c) Microsoft Corporation.
1918
+ // Licensed under the MIT license.
1917
1919
  /**
1918
1920
  * MSAL client assertion client. Calls to MSAL's confidential application's `acquireTokenByClientCredential` during `doGetToken`.
1919
1921
  * @internal
@@ -1953,6 +1955,7 @@ class MsalClientAssertion extends MsalNode {
1953
1955
  }
1954
1956
 
1955
1957
  // Copyright (c) Microsoft Corporation.
1958
+ // Licensed under the MIT license.
1956
1959
  const logger$h = credentialLogger("ClientAssertionCredential");
1957
1960
  /**
1958
1961
  * Authenticates a service principal with a JWT assertion.
@@ -1996,6 +1999,7 @@ class ClientAssertionCredential {
1996
1999
  }
1997
2000
 
1998
2001
  // Copyright (c) Microsoft Corporation.
2002
+ // Licensed under the MIT license.
1999
2003
  const credentialName$3 = "WorkloadIdentityCredential";
2000
2004
  /**
2001
2005
  * Contains the list of all supported environment variable names so that an
@@ -2094,6 +2098,7 @@ class WorkloadIdentityCredential {
2094
2098
  }
2095
2099
 
2096
2100
  // Copyright (c) Microsoft Corporation.
2101
+ // Licensed under the MIT license.
2097
2102
  const msiName$2 = "ManagedIdentityCredential - Token Exchange";
2098
2103
  const logger$f = credentialLogger(msiName$2);
2099
2104
  /**
@@ -2123,6 +2128,7 @@ function tokenExchangeMsi() {
2123
2128
  }
2124
2129
 
2125
2130
  // Copyright (c) Microsoft Corporation.
2131
+ // Licensed under the MIT license.
2126
2132
  // This MSI can be easily tested by deploying a container to Azure Service Fabric with the Dockerfile:
2127
2133
  //
2128
2134
  // FROM node:12
@@ -2201,7 +2207,7 @@ const fabricMsi = {
2201
2207
  "IDENTITY_SERVER_THUMBPRINT=[REDACTED].",
2202
2208
  ].join(" "));
2203
2209
  const request = coreRestPipeline.createPipelineRequest(Object.assign({ abortSignal: getTokenOptions.abortSignal }, prepareRequestOptions$1(scopes, clientId, resourceId)));
2204
- request.agent = new https__default["default"].Agent({
2210
+ request.agent = new https.Agent({
2205
2211
  // This is necessary because Service Fabric provides a self-signed certificate.
2206
2212
  // The alternative path is to verify the certificate using the IDENTITY_SERVER_THUMBPRINT env variable.
2207
2213
  rejectUnauthorized: false,
@@ -2212,6 +2218,7 @@ const fabricMsi = {
2212
2218
  };
2213
2219
 
2214
2220
  // Copyright (c) Microsoft Corporation.
2221
+ // Licensed under the MIT license.
2215
2222
  const msiName = "ManagedIdentityCredential - AppServiceMSI 2019";
2216
2223
  const logger$d = credentialLogger(msiName);
2217
2224
  /**
@@ -2279,6 +2286,7 @@ const appServiceMsi2019 = {
2279
2286
  };
2280
2287
 
2281
2288
  // Copyright (c) Microsoft Corporation.
2289
+ // Licensed under the MIT license.
2282
2290
  const logger$c = credentialLogger("ManagedIdentityCredential");
2283
2291
  /**
2284
2292
  * Attempts authentication using a managed identity available at the deployment environment.
@@ -2559,6 +2567,7 @@ class ManagedIdentityCredential {
2559
2567
  }
2560
2568
 
2561
2569
  // Copyright (c) Microsoft Corporation.
2570
+ // Licensed under the MIT license.
2562
2571
  /**
2563
2572
  * Ensures the scopes value is an array.
2564
2573
  * @internal
@@ -2586,6 +2595,7 @@ function getScopeResource(scope) {
2586
2595
  }
2587
2596
 
2588
2597
  // Copyright (c) Microsoft Corporation.
2598
+ // Licensed under the MIT license.
2589
2599
  /**
2590
2600
  * Mockable reference to the CLI credential cliCredentialFunctions
2591
2601
  * @internal
@@ -2617,7 +2627,7 @@ const cliCredentialInternals = {
2617
2627
  }
2618
2628
  return new Promise((resolve, reject) => {
2619
2629
  try {
2620
- child_process__default["default"].execFile("az", [
2630
+ child_process.execFile("az", [
2621
2631
  "account",
2622
2632
  "get-access-token",
2623
2633
  "--output",
@@ -2716,6 +2726,7 @@ class AzureCliCredential {
2716
2726
  }
2717
2727
 
2718
2728
  // Copyright (c) Microsoft Corporation.
2729
+ // Licensed under the MIT license.
2719
2730
  /**
2720
2731
  * Easy to mock childProcess utils.
2721
2732
  * @internal
@@ -2746,6 +2757,7 @@ const processUtils = {
2746
2757
  };
2747
2758
 
2748
2759
  // Copyright (c) Microsoft Corporation.
2760
+ // Licensed under the MIT license.
2749
2761
  const logger$a = credentialLogger("AzurePowerShellCredential");
2750
2762
  const isWindows = process.platform === "win32";
2751
2763
  /**
@@ -2917,6 +2929,7 @@ class AzurePowerShellCredential {
2917
2929
  }
2918
2930
 
2919
2931
  // Copyright (c) Microsoft Corporation.
2932
+ // Licensed under the MIT license.
2920
2933
  /**
2921
2934
  * @internal
2922
2935
  */
@@ -2995,6 +3008,7 @@ class ChainedTokenCredential {
2995
3008
  }
2996
3009
 
2997
3010
  // Copyright (c) Microsoft Corporation.
3011
+ // Licensed under the MIT license.
2998
3012
  const readFileAsync = util.promisify(fs.readFile);
2999
3013
  /**
3000
3014
  * Tries to asynchronously load a certificate from the given path.
@@ -3100,6 +3114,7 @@ class MsalClientCertificate extends MsalNode {
3100
3114
  }
3101
3115
 
3102
3116
  // Copyright (c) Microsoft Corporation.
3117
+ // Licensed under the MIT license.
3103
3118
  const credentialName$2 = "ClientCertificateCredential";
3104
3119
  const logger$8 = credentialLogger(credentialName$2);
3105
3120
  /**
@@ -3154,6 +3169,7 @@ class ClientCertificateCredential {
3154
3169
  }
3155
3170
 
3156
3171
  // Copyright (c) Microsoft Corporation.
3172
+ // Licensed under the MIT license.
3157
3173
  /**
3158
3174
  * MSAL client secret client. Calls to MSAL's confidential application's `acquireTokenByClientCredential` during `doGetToken`.
3159
3175
  * @internal
@@ -3184,6 +3200,7 @@ class MsalClientSecret extends MsalNode {
3184
3200
  }
3185
3201
 
3186
3202
  // Copyright (c) Microsoft Corporation.
3203
+ // Licensed under the MIT license.
3187
3204
  const logger$7 = credentialLogger("ClientSecretCredential");
3188
3205
  /**
3189
3206
  * Enables authentication to Azure Active Directory using a client secret
@@ -3233,6 +3250,7 @@ class ClientSecretCredential {
3233
3250
  }
3234
3251
 
3235
3252
  // Copyright (c) Microsoft Corporation.
3253
+ // Licensed under the MIT license.
3236
3254
  /**
3237
3255
  * MSAL username and password client. Calls to the MSAL's public application's `acquireTokenByUsernamePassword` during `doGetToken`.
3238
3256
  * @internal
@@ -3263,6 +3281,7 @@ class MsalUsernamePassword extends MsalNode {
3263
3281
  }
3264
3282
 
3265
3283
  // Copyright (c) Microsoft Corporation.
3284
+ // Licensed under the MIT license.
3266
3285
  const logger$6 = credentialLogger("UsernamePasswordCredential");
3267
3286
  /**
3268
3287
  * Enables authentication to Azure Active Directory with a user's
@@ -3316,6 +3335,7 @@ class UsernamePasswordCredential {
3316
3335
  }
3317
3336
 
3318
3337
  // Copyright (c) Microsoft Corporation.
3338
+ // Licensed under the MIT license.
3319
3339
  /**
3320
3340
  * Contains the list of all supported environment variable names so that an
3321
3341
  * appropriate error message can be generated when no credentials can be
@@ -3428,6 +3448,7 @@ class EnvironmentCredential {
3428
3448
  }
3429
3449
 
3430
3450
  // Copyright (c) Microsoft Corporation.
3451
+ // Licensed under the MIT license.
3431
3452
  /**
3432
3453
  * Mockable reference to the Developer CLI credential cliCredentialFunctions
3433
3454
  * @internal
@@ -3459,7 +3480,7 @@ const developerCliCredentialInternals = {
3459
3480
  }
3460
3481
  return new Promise((resolve, reject) => {
3461
3482
  try {
3462
- child_process__default["default"].execFile("azd", [
3483
+ child_process.execFile("azd", [
3463
3484
  "auth",
3464
3485
  "token",
3465
3486
  "--output",
@@ -3583,6 +3604,7 @@ class AzureDeveloperCliCredential {
3583
3604
  }
3584
3605
 
3585
3606
  // Copyright (c) Microsoft Corporation.
3607
+ // Licensed under the MIT license.
3586
3608
  /**
3587
3609
  * A shim around ManagedIdentityCredential that adapts it to accept
3588
3610
  * `DefaultAzureCredentialOptions`.
@@ -3679,12 +3701,13 @@ class DefaultAzureCredential extends ChainedTokenCredential {
3679
3701
  }
3680
3702
 
3681
3703
  // Copyright (c) Microsoft Corporation.
3704
+ // Licensed under the MIT license.
3682
3705
  /**
3683
3706
  * A call to open(), but mockable
3684
3707
  * @internal
3685
3708
  */
3686
3709
  const interactiveBrowserMockable = {
3687
- open: open__default["default"],
3710
+ open,
3688
3711
  };
3689
3712
  /**
3690
3713
  * This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`
@@ -3766,8 +3789,8 @@ class MsalOpenBrowser extends MsalNode {
3766
3789
  cleanup();
3767
3790
  });
3768
3791
  };
3769
- const app = http__default["default"].createServer(requestListener);
3770
- const server = stoppable__default["default"](app);
3792
+ const app = http.createServer(requestListener);
3793
+ const server = stoppable(app);
3771
3794
  const listen = app.listen(this.port, this.hostname, () => this.logger.info(`InteractiveBrowserCredential listening on port ${this.port}!`));
3772
3795
  function cleanup() {
3773
3796
  if (listen) {
@@ -3839,6 +3862,7 @@ class MsalOpenBrowser extends MsalNode {
3839
3862
  }
3840
3863
 
3841
3864
  // Copyright (c) Microsoft Corporation.
3865
+ // Licensed under the MIT license.
3842
3866
  const logger$3 = credentialLogger("InteractiveBrowserCredential");
3843
3867
  /**
3844
3868
  * Enables authentication to Azure Active Directory inside of the web browser
@@ -3909,6 +3933,7 @@ class InteractiveBrowserCredential {
3909
3933
  }
3910
3934
 
3911
3935
  // Copyright (c) Microsoft Corporation.
3936
+ // Licensed under the MIT license.
3912
3937
  /**
3913
3938
  * MSAL device code client. Calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`.
3914
3939
  * @internal
@@ -3941,6 +3966,7 @@ class MsalDeviceCode extends MsalNode {
3941
3966
  }
3942
3967
 
3943
3968
  // Copyright (c) Microsoft Corporation.
3969
+ // Licensed under the MIT license.
3944
3970
  const logger$2 = credentialLogger("DeviceCodeCredential");
3945
3971
  /**
3946
3972
  * Method that logs the user code from the DeviceCodeCredential.
@@ -4019,6 +4045,7 @@ class DeviceCodeCredential {
4019
4045
  }
4020
4046
 
4021
4047
  // Copyright (c) Microsoft Corporation.
4048
+ // Licensed under the MIT license.
4022
4049
  /**
4023
4050
  * This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`
4024
4051
  * to trigger the authentication flow, and then respond based on the values obtained from the redirect callback
@@ -4062,6 +4089,7 @@ class MsalAuthorizationCode extends MsalNode {
4062
4089
  }
4063
4090
 
4064
4091
  // Copyright (c) Microsoft Corporation.
4092
+ // Licensed under the MIT license.
4065
4093
  const logger$1 = credentialLogger("AuthorizationCodeCredential");
4066
4094
  /**
4067
4095
  * Enables authentication to Azure Active Directory using an authorization code
@@ -4117,6 +4145,7 @@ class AuthorizationCodeCredential {
4117
4145
  }
4118
4146
 
4119
4147
  // Copyright (c) Microsoft Corporation.
4148
+ // Licensed under the MIT license.
4120
4149
  /**
4121
4150
  * MSAL on behalf of flow. Calls to MSAL's confidential application's `acquireTokenOnBehalfOf` during `doGetToken`.
4122
4151
  * @internal
@@ -4170,6 +4199,7 @@ class MsalOnBehalfOf extends MsalNode {
4170
4199
  }
4171
4200
 
4172
4201
  // Copyright (c) Microsoft Corporation.
4202
+ // Licensed under the MIT license.
4173
4203
  const credentialName = "OnBehalfOfCredential";
4174
4204
  const logger = credentialLogger(credentialName);
4175
4205
  /**
@@ -4205,6 +4235,7 @@ class OnBehalfOfCredential {
4205
4235
  }
4206
4236
 
4207
4237
  // Copyright (c) Microsoft Corporation.
4238
+ // Licensed under the MIT license.
4208
4239
  /**
4209
4240
  * Returns a new instance of the {@link DefaultAzureCredential}.
4210
4241
  */