@azure/identity 2.0.0-alpha.20211004.2 → 2.0.0-alpha.20211008.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.

Potentially problematic release.


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

Files changed (27) hide show
  1. package/CHANGELOG.md +109 -3
  2. package/README.md +4 -0
  3. package/dist/index.js +81 -72
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/identityClient.js +1 -1
  6. package/dist-esm/src/client/identityClient.js.map +1 -1
  7. package/dist-esm/src/credentials/{applicationCredential.browser.js → azureApplicationCredential.browser.js} +4 -4
  8. package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
  9. package/dist-esm/src/credentials/{applicationCredential.js → azureApplicationCredential.js} +7 -7
  10. package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
  11. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  12. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  13. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  14. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  15. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +31 -22
  16. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  17. package/dist-esm/src/credentials/onBehalfOfCredential.js +6 -11
  18. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  19. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
  20. package/dist-esm/src/index.js +1 -2
  21. package/dist-esm/src/index.js.map +1 -1
  22. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +1 -1
  23. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  24. package/package.json +2 -2
  25. package/types/identity.d.ts +24 -139
  26. package/dist-esm/src/credentials/applicationCredential.browser.js.map +0 -1
  27. package/dist-esm/src/credentials/applicationCredential.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,22 +1,128 @@
1
1
  # Release History
2
2
 
3
- ## 2.0.0-beta.7 (Unreleased)
3
+ ## 2.0.0 (2021-10-12)
4
+
5
+ After multiple beta releases over the past year, we're proud to announce the general availability of version 2 of the `@azure/identity` package. This version includes the best parts of v1, plus several improvements.
6
+
7
+ This changelog entry showcases the changes that have been made from version 1 of this package. See the [v1-to-v2 migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md) for details on how to upgrade your application to use the version 2 of `@azure/identity`.
4
8
 
5
9
  ### Features Added
6
10
 
7
- ### Breaking Changes
11
+ #### Plugin API
12
+
13
+ Identity v2 provides a top-level `useIdentityPlugin` function, which allows using two new plugin packages:
14
+
15
+ - [@azure/identity-vscode](https://www.npmjs.com/package/@azure/identity-vscode), which provides the dependencies of `VisualStudioCodeCredential` and enables it.
16
+ - If the `@azure/identity-vscode` plugin isn't used through the `useIdentityPlugin` function, the `VisualStudioCodeCredential` exposed by Identity v2 will throw a `CredentialUnavailableError`.
17
+ - [@azure/identity-cache-persistence](https://www.npmjs.com/package/@azure/identity-cache-persistence), which provides persistent token caching.
18
+
19
+ Most credentials on Identity v2 now support the persistent token caching feature. Such credentials include the property [tokenCachePersistenceOptions](https://docs.microsoft.com/javascript/api/@azure/identity/tokencachepersistenceoptions) in the constructor options which can be used to enable this feature.
20
+
21
+ The following example showcases how to enable persistence caching by first enabling the `@azure/identity-cache-persistence` plugin with `useIdentityPlugin(cachePersistencePlugin)`, and then passing the `tokenCachePersistenceOptions` through the constructor of the `DeviceCodeCredential`:
22
+
23
+ ```ts
24
+ import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
25
+ import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
26
+
27
+ useIdentityPlugin(cachePersistencePlugin);
28
+
29
+ async function main() {
30
+ const credential = new DeviceCodeCredential({
31
+ tokenCachePersistenceOptions: {
32
+ enabled: true
33
+ }
34
+ });
35
+ }
36
+ ```
37
+
38
+ #### New credentials
39
+
40
+ Identity v2 includes three new credential types:
41
+
42
+ - `AzurePowerShellCredential`, which re-uses any account previously authenticated with the `Az.Account` PowerShell module.
43
+ - `ApplicationCredential`, which is a simplified `DefaultAzureCredential` that only includes `EnvironmentCredential` and `ManagedIdentityCredential`.
44
+ - `OnBehalfOfCredential`, which enables the [On-Behalf-Of authentication flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
45
+
46
+ #### New features in all credentials
47
+
48
+ Identity v2 enables:
49
+
50
+ - Support for claims challenges resulting from [Continuous Access Enforcement (CAE)](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation) and [Conditional Access authentication context](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/granular-conditional-access-for-sensitive-data-and-actions/ba-p/1751775).
51
+ - By default, credentials of Identity v2 will produce tokens that can be used to trigger the challenge authentication flows. After these tokens expire, the next HTTP requests to Azure will fail, but the response will contain information to re-authenticate.
52
+ - To disable this behavior, set the environment variable `AZURE_IDENTITY_DISABLE_CP1` to any value. For more about claims challenges, see [Claims challenges, claims requests, and client capabilities](https://docs.microsoft.com/azure/active-directory/develop/claims-challenge).
53
+ - Support for multi-tenant authentication on all credentials except `ManagedIdentityCredential`.
54
+ - At the moment, applications needing multi-tenancy support will need to call to the credentials' `getToken` directly, sending the new `tenantId` property.
55
+ - A sample with more context will be provided in a future date.
56
+ - To disable it, set the environment variable `AZURE_IDENTITY_DISABLE_MULTITENANTAUTH`. For more about multitenancy, see [Identity management in multitenant apps](https://docs.microsoft.com/azure/architecture/multitenant-identity/).
57
+
58
+ #### New features in InteractiveBrowserCredential and DeviceCodeCredential
59
+
60
+ You can now control when the credential requests user input with the new `disableAutomaticAuthentication` option added to the options you pass to the credential constructors.
61
+
62
+ - When enabled, this option stops the `getToken()` method from requesting user input in case the credential is unable to authenticate silently.
63
+ - If `getToken()` fails to authenticate without user interaction, and `disableAutomaticAuthentication` has been set to true, a new error will be thrown: `AuthenticationRequired`. You may use this error to identify scenarios when manual authentication needs to be triggered (with `authenticate()`, as described in the next point).
64
+
65
+ A new method `authenticate()` is added to these credentials which is similar to `getToken()`, but it does not read the `disableAutomaticAuthentication` option described above.
66
+
67
+ - Use this to get an `AuthenticationRecord` which you can then use to create new credentials that will re-use the token information.
68
+ - The `AuthenticationRecord` object has a `serialize()` method that allows an authenticated account to be stored as a string and re-used in another credential at any time. Use the new helper function `deserializeAuthenticationRecord` to de-serialize this string.
69
+ - `authenticate()` might succeed and still return `undefined` if we're unable to pick just one account record from the cache. This might happen if the cache is being used by more than one credential, or if multiple users have authenticated using the same Client ID and Tenant ID. To ensure consistency on a program with many users, please keep track of the `AuthenticationRecord` and provide them in the constructors of the credentials on initialization.
70
+
71
+ Learn more via the below samples
72
+ - [Samples around controlling user interaction](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#control-user-interaction).
73
+ - [Samples around persisting user authentication data](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#persist-user-authentication-data).
74
+
75
+ #### New features in ManagedIdentityCredential
76
+
77
+ In Identity v2, the `ManagedIdentityCredential` retries with exponential back-off when a request for a token fails with a 404 status code. This change only applies to environments with available IMDS endpoints.
78
+
79
+ Azure Service Fabric support hasn't been added on the initial version 2 of Identity. Subscribe to [issue #12420](https://github.com/Azure/azure-sdk-for-js/issues/12420) for updates on this feature.
80
+
81
+ #### Other features
82
+
83
+ - The Node.js version of `InteractiveBrowserCredential` has [Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) enabled by default.
84
+ - `InteractiveBrowserCredential` has a new `loginHint` constructor option, which allows a username to be pre-selected for interactive logins.
85
+ - In `AzureCliCredential`, we allow specifying a `tenantId` in the parameters through the `AzureCliCredentialOptions`.
86
+ - A new error, named `AuthenticationRequiredError`, has been added. This error shows up when a credential fails to authenticate silently.
87
+ - Errors and logged exceptions may point to the new [troubleshooting guidelines](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/Troubleshooting.md).
88
+ - On all of the credentials we're providing, the initial authentication attempt in the lifetime of your app will include an additional request to first discover relevant endpoint metadata information from Azure.
89
+
90
+ ### Breaking changes
91
+
92
+ #### Breaking changes from v1
93
+
94
+ - For `ClientCertificateCredential` specifically, the validity of the PEM certificate is evaluated on `getToken` and not on the constructor.
95
+ - We have also renamed the error `CredentialUnavailable` to `CredentialUnavailableError`, to align with the naming convention used for error classes in the Azure SDKs in JavaScript.
96
+ - In v1 of Identity some `getToken` calls could resolve with `null` in the case the authentication request succeeded with a malformed output. In v2, issues with the `getToken` method will always throw errors.
97
+ - Breaking changes to InteractiveBrowserCredential
98
+ - The `InteractiveBrowserCredential` will use the [Auth Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) with [PKCE](https://tools.ietf.org/html/rfc7636) rather than [Implicit Grant Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow) to better support browsers with enhanced security restrictions. Learn how to migrate in the [migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md). Read more about the latest `InteractiveBrowserCredential` [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md).
99
+ - The default client ID used for `InteractiveBrowserCredential` was viable only in Node.js and not for the browser. Therefore, on v2 client ID is a required parameter when using this credential in browser apps.
100
+ - Identity v2 also removes the `postLogoutRedirectUri` from the options to the constructor for `InteractiveBrowserCredential`. This option wasn't being used. Instead of using this option, use MSAL directly. For more information, see [Authenticating with the @azure/msal-browser Public Client](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-the-azuremsal-browser-public-client).
101
+ - In Identity v2, `VisualStudioCodeCredential` throws a `CredentialUnavailableError` unless the new [@azure/identity-vscode](https://www.npmjs.com/package/@azure/identity-vscode) plugin is used.
8
102
 
9
103
  #### Breaking Changes from 2.0.0-beta.4
10
104
 
11
105
  - Removed the `allowMultiTenantAuthentication` option from all of the credentials. Multi-tenant authentication is now enabled by default. On Node.js, it can be disabled with the `AZURE_IDENTITY_DISABLE_MULTITENANTAUTH` environment variable.
106
+ - Removed support for specific Azure regions on `ClientSecretCredential` and `ClientCertificateCredential. This feature will be added back on the next beta.
107
+
108
+ #### Breaking Changes from 2.0.0-beta.6
12
109
 
110
+ - Renamed the `ApplicationCredential` to `AzureApplicationCredential`.
111
+ - Removed the `CredentialPersistenceOptions` from `DefaultAzureCredential` and `EnvironmentCredential`.
112
+ - Merged the configuration and the options bag on the `OnBehalfOfCredential` into a single options bag.
13
113
 
14
114
  ### Bugs Fixed
15
115
 
116
+ - `ClientSecretCredential`, `ClientCertificateCredential`, and `UsernamePasswordCredential` throw if the required parameters aren't provided (even in JavaScript).
16
117
  - Fixed a bug that caused `AzureCliCredential` to fail when a custom tenant ID was provided.
118
+ - Caught up with the bug fixes for Azure POD Identity that were implemented on version 1.5.1.
17
119
 
18
120
  ### Other Changes
19
121
 
122
+ Identity v2 no longer includes native dependencies (neither ordinary, peer, nor optional dependencies). Previous distributions of `@azure/identity` included an optional dependency on `keytar`, which caused issues for some users in restrictive environments.
123
+
124
+ Identity v2 for JavaScript now also depends on the latest available versions of `@azure/msal-common`, `@azure/msal-node`, and `@azure/msal-browser`. Our goal is to always be up-to-date with the MSAL versions.
125
+
20
126
  ## 2.0.0-beta.6 (2021-09-09)
21
127
 
22
128
  ### Features Added
@@ -174,7 +280,7 @@ This update marks the preview for the first major version update of the `@azure/
174
280
  - This feature uses DPAPI on Windows, it tries to use the Keychain on OSX and the Keyring on Linux.
175
281
  - To learn more on the usage, please refer to our docs on the `TokenCachePersistenceOptions` interface.
176
282
  - **IMPORTANT:** As part of this beta, this feature is only supported in Node 10, 12 and 14.
177
- - Changes to `InteractiveBrowserCredential`, `DeviceCodeCredential`, and `UsernamePasswordCredential`:
283
+ - Changes to `InteractiveBrowserCredential` and `DeviceCodeCredential`:
178
284
  - You can now control when the credential requests user input with the new `disableAutomaticAuthentication` option added to the options you pass to the credential constructors.
179
285
  - When enabled, this option stops the `getToken()` method from requesting user input in case the credential is unable to authenticate silently.
180
286
  - If `getToken()` fails to authenticate without user interaction, and `disableAutomaticAuthentication` has been set to true, a new error will be thrown: `AuthenticationRequired`. You may use this error to identify scenarios when manual authentication needs to be triggered (with `authenticate()`, as described in the next point).
package/README.md CHANGED
@@ -14,6 +14,10 @@ Key links:
14
14
 
15
15
  ## Getting started
16
16
 
17
+ ### Migrate from v1 to v2 of @azure/identity
18
+
19
+ If you're using v1 of `@azure/identity`, see the [migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md) to update to v2.
20
+
17
21
  ### Currently supported environments
18
22
 
19
23
  - [LTS versions of Node.js](https://nodejs.org/about/releases/)
package/dist/index.js CHANGED
@@ -316,7 +316,7 @@ function getIdentityClientAuthorityHost(options) {
316
316
  class IdentityClient extends coreClient.ServiceClient {
317
317
  constructor(options) {
318
318
  var _a;
319
- const packageDetails = `azsdk-js-identity/2.0.0-beta.7`;
319
+ const packageDetails = `azsdk-js-identity/2.0.0`;
320
320
  const userAgentPrefix = ((_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
321
321
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
322
322
  : `${packageDetails}`;
@@ -739,6 +739,40 @@ function deserializeAuthenticationRecord(serializedRecord) {
739
739
  }
740
740
 
741
741
  // Copyright (c) Microsoft Corporation.
742
+ // Licensed under the MIT license.
743
+ /**
744
+ * @internal
745
+ */
746
+ const multiTenantDisabledErrorMessage = "A getToken request was attempted with a tenant different than the tenant configured at the initialization of the credential, but multi-tenant authentication has been disabled by the environment variable AZURE_IDENTITY_DISABLE_MULTITENANTAUTH.";
747
+ /**
748
+ * @internal
749
+ */
750
+ const multiTenantADFSErrorMessage = "A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.";
751
+ /**
752
+ * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
753
+ * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
754
+ * or unless the original tenant Id is `adfs`.
755
+ * @internal
756
+ */
757
+ function processMultiTenantRequest(tenantId, getTokenOptions) {
758
+ if (!(getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId)) {
759
+ return tenantId;
760
+ }
761
+ if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {
762
+ throw new Error(multiTenantDisabledErrorMessage);
763
+ }
764
+ if (tenantId === "adfs") {
765
+ throw new Error(multiTenantADFSErrorMessage);
766
+ }
767
+ return getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId;
768
+ }
769
+
770
+ // Copyright (c) Microsoft Corporation.
771
+ // Licensed under the MIT license.
772
+ /**
773
+ * Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
774
+ */
775
+ var RegionalAuthority;
742
776
  (function (RegionalAuthority) {
743
777
  /** Instructs MSAL to attempt to discover the region */
744
778
  RegionalAuthority["AutoDiscoverRegion"] = "AutoDiscoverRegion";
@@ -846,36 +880,7 @@ function deserializeAuthenticationRecord(serializedRecord) {
846
880
  RegionalAuthority["GovernmentUSDodEast"] = "usdodeast";
847
881
  /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
848
882
  RegionalAuthority["GovernmentUSDodCentral"] = "usdodcentral";
849
- })(exports.RegionalAuthority || (exports.RegionalAuthority = {}));
850
-
851
- // Copyright (c) Microsoft Corporation.
852
- // Licensed under the MIT license.
853
- /**
854
- * @internal
855
- */
856
- const multiTenantDisabledErrorMessage = "A getToken request was attempted with a tenant different than the tenant configured at the initialization of the credential, but multi-tenant authentication has been disabled by the environment variable AZURE_IDENTITY_DISABLE_MULTITENANTAUTH.";
857
- /**
858
- * @internal
859
- */
860
- const multiTenantADFSErrorMessage = "A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.";
861
- /**
862
- * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
863
- * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
864
- * or unless the original tenant Id is `adfs`.
865
- * @internal
866
- */
867
- function processMultiTenantRequest(tenantId, getTokenOptions) {
868
- if (!(getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId)) {
869
- return tenantId;
870
- }
871
- if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {
872
- throw new Error(multiTenantDisabledErrorMessage);
873
- }
874
- if (tenantId === "adfs") {
875
- throw new Error(multiTenantADFSErrorMessage);
876
- }
877
- return getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId;
878
- }
883
+ })(RegionalAuthority || (RegionalAuthority = {}));
879
884
 
880
885
  // Copyright (c) Microsoft Corporation.
881
886
  /**
@@ -922,7 +927,7 @@ class MsalNode extends MsalBaseUtilities {
922
927
  ].join(" "));
923
928
  }
924
929
  this.azureRegion = (_c = options.regionalAuthority) !== null && _c !== void 0 ? _c : process.env.AZURE_REGIONAL_AUTHORITY_NAME;
925
- if (this.azureRegion === exports.RegionalAuthority.AutoDiscoverRegion) {
930
+ if (this.azureRegion === RegionalAuthority.AutoDiscoverRegion) {
926
931
  this.azureRegion = "AUTO_DISCOVER";
927
932
  }
928
933
  }
@@ -2257,7 +2262,7 @@ function expiresInParser$2(requestBody) {
2257
2262
  if (requestBody.expires_on) {
2258
2263
  // Use the expires_on timestamp if it's available
2259
2264
  const expires = +requestBody.expires_on * 1000;
2260
- logger$b.info(`${msiName$2}: IMDS using expires_on: ${expires} (original value: ${requestBody.expires_on})`);
2265
+ logger$b.info(`${msiName$2}: Using expires_on: ${expires} (original value: ${requestBody.expires_on})`);
2261
2266
  return expires;
2262
2267
  }
2263
2268
  else {
@@ -2267,29 +2272,41 @@ function expiresInParser$2(requestBody) {
2267
2272
  return expires;
2268
2273
  }
2269
2274
  }
2270
- function prepareRequestOptions$2(scopes, clientId) {
2275
+ function prepareRequestOptions$2(scopes, clientId, options) {
2271
2276
  var _a;
2272
2277
  const resource = mapScopesToResource(scopes);
2273
2278
  if (!resource) {
2274
2279
  throw new Error(`${msiName$2}: Multiple scopes are not supported.`);
2275
2280
  }
2276
- const queryParameters = {
2277
- resource,
2278
- "api-version": imdsApiVersion
2279
- };
2280
- if (clientId) {
2281
- queryParameters.client_id = clientId;
2281
+ const { skipQuery, skipMetadataHeader } = options || {};
2282
+ let query = "";
2283
+ // Pod Identity will try to process this request even if the Metadata header is missing.
2284
+ // We can exclude the request query to ensure no IMDS endpoint tries to process the ping request.
2285
+ if (!skipQuery) {
2286
+ const queryParameters = {
2287
+ resource,
2288
+ "api-version": imdsApiVersion
2289
+ };
2290
+ if (clientId) {
2291
+ queryParameters.client_id = clientId;
2292
+ }
2293
+ const params = new URLSearchParams(queryParameters);
2294
+ query = `?${params.toString()}`;
2282
2295
  }
2283
- const params = new URLSearchParams(queryParameters);
2284
- const query = params.toString();
2285
2296
  const url = new URL(imdsEndpointPath, (_a = process.env.AZURE_POD_IDENTITY_AUTHORITY_HOST) !== null && _a !== void 0 ? _a : imdsHost);
2297
+ const rawHeaders = {
2298
+ Accept: "application/json",
2299
+ Metadata: "true"
2300
+ };
2301
+ // Remove the Metadata header to invoke a request error from some IMDS endpoints.
2302
+ if (skipMetadataHeader) {
2303
+ delete rawHeaders.Metadata;
2304
+ }
2286
2305
  return {
2287
- url: `${url}?${query}`,
2306
+ // In this case, the `?` should be added in the "query" variable `skipQuery` is not set.
2307
+ url: `${url}${query}`,
2288
2308
  method: "GET",
2289
- headers: coreRestPipeline.createHttpHeaders({
2290
- Accept: "application/json",
2291
- Metadata: "true"
2292
- })
2309
+ headers: coreRestPipeline.createHttpHeaders(rawHeaders)
2293
2310
  };
2294
2311
  }
2295
2312
  // 800ms -> 1600ms -> 3200ms
@@ -2311,13 +2328,10 @@ const imdsMsi = {
2311
2328
  if (process.env.AZURE_POD_IDENTITY_AUTHORITY_HOST) {
2312
2329
  return true;
2313
2330
  }
2314
- const requestOptions = prepareRequestOptions$2(resource, clientId);
2315
- // This will always be populated, but let's make TypeScript happy
2316
- if (requestOptions.headers) {
2317
- // Remove the Metadata header to invoke a request error from
2318
- // IMDS endpoint
2319
- requestOptions.headers.delete("Metadata");
2320
- }
2331
+ const requestOptions = prepareRequestOptions$2(resource, clientId, {
2332
+ skipMetadataHeader: true,
2333
+ skipQuery: true
2334
+ });
2321
2335
  requestOptions.tracingOptions = options.tracingOptions;
2322
2336
  try {
2323
2337
  // Create a request with a timeout since we expect that
@@ -3177,7 +3191,7 @@ class AuthorizationCodeCredential {
3177
3191
  }
3178
3192
 
3179
3193
  // Copyright (c) Microsoft Corporation.
3180
- const ApplicationCredentials = [
3194
+ const AzureApplicationCredentials = [
3181
3195
  EnvironmentCredential,
3182
3196
  DefaultManagedIdentityCredential
3183
3197
  ];
@@ -3185,11 +3199,11 @@ const ApplicationCredentials = [
3185
3199
  * Provides a default {@link ChainedTokenCredential} configuration that should
3186
3200
  * work for most applications that use the Azure SDK.
3187
3201
  */
3188
- class ApplicationCredential extends ChainedTokenCredential {
3202
+ class AzureApplicationCredential extends ChainedTokenCredential {
3189
3203
  /**
3190
- * Creates an instance of the ApplicationCredential class.
3204
+ * Creates an instance of the AzureApplicationCredential class.
3191
3205
  *
3192
- * The ApplicationCredential provides a default {@link ChainedTokenCredential} configuration that should
3206
+ * The AzureApplicationCredential provides a default {@link ChainedTokenCredential} configuration that should
3193
3207
  * work for most applications that use the Azure SDK. The following credential
3194
3208
  * types will be tried, in order:
3195
3209
  *
@@ -3199,10 +3213,10 @@ class ApplicationCredential extends ChainedTokenCredential {
3199
3213
  * Consult the documentation of these credential types for more information
3200
3214
  * on how they attempt authentication.
3201
3215
  *
3202
- * @param options - Optional parameters. See {@link ApplicationCredentialOptions}.
3216
+ * @param options - Optional parameters. See {@link AzureApplicationCredentialOptions}.
3203
3217
  */
3204
3218
  constructor(options) {
3205
- super(...ApplicationCredentials.map((ctor) => new ctor(options)));
3219
+ super(...AzureApplicationCredentials.map((ctor) => new ctor(options)));
3206
3220
  this.UnavailableMessage =
3207
3221
  "ApplicationCredential => failed to retrieve a token from the included credentials";
3208
3222
  }
@@ -3286,22 +3300,17 @@ class OnBehalfOfCredential {
3286
3300
  * await client.getKey("key-name");
3287
3301
  * ```
3288
3302
  *
3289
- * @param configuration - Configuration specific to this credential.
3290
3303
  * @param options - Optional parameters, generally common across credentials.
3291
3304
  */
3292
- constructor(configuration, options = {}) {
3293
- this.configuration = configuration;
3305
+ constructor(options) {
3294
3306
  this.options = options;
3295
- const { tenantId, clientId, userAssertionToken } = configuration;
3296
- const secretConfiguration = configuration;
3297
- const certificateConfiguration = configuration;
3298
- if (!tenantId ||
3299
- !clientId ||
3300
- !(secretConfiguration.clientSecret || certificateConfiguration.certificatePath) ||
3301
- !userAssertionToken) {
3307
+ const { clientSecret } = options;
3308
+ const { certificatePath } = options;
3309
+ const { tenantId, clientId, userAssertionToken } = options;
3310
+ if (!tenantId || !clientId || !(clientSecret || certificatePath) || !userAssertionToken) {
3302
3311
  throw new Error(`${credentialName}: tenantId, clientId, clientSecret (or certificatePath) and userAssertionToken are required parameters.`);
3303
3312
  }
3304
- this.msalFlow = new MsalOnBehalfOf(Object.assign(Object.assign(Object.assign({}, this.options), this.configuration), { logger: logger$i, tokenCredentialOptions: this.options }));
3313
+ this.msalFlow = new MsalOnBehalfOf(Object.assign(Object.assign({}, this.options), { logger: logger$i, tokenCredentialOptions: this.options }));
3305
3314
  }
3306
3315
  /**
3307
3316
  * Authenticates with Azure Active Directory and returns an access token if successful.
@@ -3328,7 +3337,7 @@ function getDefaultAzureCredential() {
3328
3337
 
3329
3338
  exports.AggregateAuthenticationError = AggregateAuthenticationError;
3330
3339
  exports.AggregateAuthenticationErrorName = AggregateAuthenticationErrorName;
3331
- exports.ApplicationCredential = ApplicationCredential;
3340
+ exports.ApplicationCredential = AzureApplicationCredential;
3332
3341
  exports.AuthenticationError = AuthenticationError;
3333
3342
  exports.AuthenticationErrorName = AuthenticationErrorName;
3334
3343
  exports.AuthenticationRequiredError = AuthenticationRequiredError;