@azure/identity 2.1.0-alpha.20220609.3 → 2.1.0-alpha.20220708.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 (65) hide show
  1. package/README.md +24 -24
  2. package/dist/index.js +192 -103
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/client/identityClient.js +1 -1
  5. package/dist-esm/src/client/identityClient.js.map +1 -1
  6. package/dist-esm/src/constants.js +1 -1
  7. package/dist-esm/src/constants.js.map +1 -1
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  10. package/dist-esm/src/credentials/azureCliCredential.js +1 -1
  11. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  12. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  13. package/dist-esm/src/credentials/azurePowerShellCredential.js +1 -1
  14. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  15. package/dist-esm/src/credentials/chainedTokenCredential.js +1 -1
  16. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  17. package/dist-esm/src/credentials/clientAssertionCredential.browser.js +22 -0
  18. package/dist-esm/src/credentials/clientAssertionCredential.browser.js.map +1 -0
  19. package/dist-esm/src/credentials/clientAssertionCredential.js +45 -0
  20. package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -0
  21. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  22. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  23. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  24. package/dist-esm/src/credentials/environmentCredential.js +1 -1
  25. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  26. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  27. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
  28. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  29. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  30. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  31. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +1 -1
  32. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  33. package/dist-esm/src/credentials/managedIdentityCredential/index.js +1 -1
  34. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  35. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  36. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
  37. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +1 -1
  38. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  39. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  40. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  41. package/dist-esm/src/index.js +1 -0
  42. package/dist-esm/src/index.js.map +1 -1
  43. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  44. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +1 -1
  45. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  46. package/dist-esm/src/msal/credentials.js.map +1 -1
  47. package/dist-esm/src/msal/flows.js.map +1 -1
  48. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  49. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +42 -0
  50. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +1 -0
  51. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +3 -2
  52. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  53. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  54. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  55. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +7 -1
  56. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
  57. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
  58. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +2 -1
  59. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  60. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  61. package/dist-esm/src/msal/utils.js +1 -1
  62. package/dist-esm/src/msal/utils.js.map +1 -1
  63. package/dist-esm/src/util/logging.js.map +1 -1
  64. package/package.json +20 -14
  65. package/types/identity.d.ts +30 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Azure Identity client library for JavaScript
1
+ # Azure Identity client library for JavaScript
2
2
 
3
3
  The Azure Identity library provides [Azure Active Directory (Azure AD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) token authentication through a set of convenient [TokenCredential](https://docs.microsoft.com/javascript/api/@azure/core-auth/tokencredential) implementations.
4
4
 
@@ -125,7 +125,7 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
125
125
  1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
126
126
  1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
127
127
  1. **Visual Studio Code** - If the developer has authenticated with the [Visual Studio Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), the `DefaultAzureCredential` will authenticate using that account.
128
- - In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
128
+ - In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
129
129
  1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
130
130
  1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
131
131
 
@@ -237,7 +237,7 @@ const credential = new ClientSecretCredential(
237
237
  "<YOUR_CLIENT_ID>",
238
238
  "<YOUR_CLIENT_SECRET>",
239
239
  {
240
- authorityHost: AzureAuthorityHosts.AzureGovernment
240
+ authorityHost: AzureAuthorityHosts.AzureGovernment,
241
241
  }
242
242
  );
243
243
  ```
@@ -248,35 +248,35 @@ Not all credentials require this configuration. Credentials that authenticate th
248
248
 
249
249
  ### Authenticating Azure-hosted applications
250
250
 
251
- | Credential | Usage | Example |
252
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
- | [`DefaultAzureCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
254
- | [`ChainedTokenCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
255
- | [`EnvironmentCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
251
+ | Credential | Usage | Example |
252
+ | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
+ | [`DefaultAzureCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
254
+ | [`ChainedTokenCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
255
+ | [`EnvironmentCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
256
256
  | [`ManagedIdentityCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/managedidentitycredential?view=azure-node-latest) | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
257
257
 
258
258
  ### Authenticating Service Principals
259
259
 
260
- | Credential | Usage | Example | Reference |
261
- | ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
260
+ | Credential | Usage | Example | Reference |
261
+ | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
262
262
  | [`ClientCertificateCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientcertificatecredential?view=azure-node-latest) | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-certificate) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
263
- | [`ClientSecretCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest) | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
263
+ | [`ClientSecretCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest) | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
264
264
 
265
265
  ### Authenticating Users
266
266
 
267
- | Credential | Usage | Example | Reference |
268
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
269
- | [`AuthorizationCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/authorizationcodecredential?view=azure-node-latest) | Authenticates a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
270
- | [`DeviceCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/devicecodecredential?view=azure-node-latest) | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
267
+ | Credential | Usage | Example | Reference |
268
+ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
269
+ | [`AuthorizationCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/authorizationcodecredential?view=azure-node-latest) | Authenticates a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
270
+ | [`DeviceCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/devicecodecredential?view=azure-node-latest) | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
271
271
  | [`InteractiveBrowserCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/interactivebrowsercredential?view=azure-node-latest) | Interactively authenticates a user with the default system browser. Read more about how this happens [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md). | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-interactively-in-the-browser) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
272
- | [`OnBehalfOfCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/onbehalfofcredential?view=azure-node-latest) | Propagates the delegated user identity and permissions through the request chain |
273
- | [`UsernamePasswordCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest) | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
272
+ | [`OnBehalfOfCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/onbehalfofcredential?view=azure-node-latest) | Propagates the delegated user identity and permissions through the request chain |
273
+ | [`UsernamePasswordCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest) | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
274
274
 
275
275
  ### Authenticating via Development Tools
276
276
 
277
- | Credential | Usage | Example | Reference |
278
- | --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
279
- | [`AzureCliCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
277
+ | Credential | Usage | Example | Reference |
278
+ | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
279
+ | [`AzureCliCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
280
280
  | [`AzurePowerShellCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azurepowershellcredential?view=azure-node-latest) | Authenticate in a development environment using Azure PowerShell. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-powershell) | [Azure PowerShell authentication](https://docs.microsoft.com/powershell/azure/authenticate-azureps) |
281
281
 
282
282
  ## Troubleshooting
@@ -290,7 +290,7 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla
290
290
  Enabling logging may help uncover useful information about failures.
291
291
 
292
292
  To see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`.
293
- You can read this environment variable from the *.env* file by explicitly specifying a file path:
293
+ You can read this environment variable from the _.env_ file by explicitly specifying a file path:
294
294
 
295
295
  ```javascript
296
296
  require("dotenv").config({ path: ".env" });
@@ -303,7 +303,7 @@ import { setLogLevel } from "@azure/logger";
303
303
 
304
304
  setLogLevel("info");
305
305
  ```
306
-
306
+
307
307
  In cases where the authenticate code might be running in an environment with more than one credential available,
308
308
  the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential,
309
309
  developers can set `allowLoggingAccountIdentifiers` to true in the
@@ -319,7 +319,7 @@ import { setLogLevel } from "@azure/logger";
319
319
  setLogLevel("info");
320
320
 
321
321
  const credential = new DefaultAzureCredential({
322
- loggingOptions: { allowLoggingAccountIdentifiers: true }
322
+ loggingOptions: { allowLoggingAccountIdentifiers: true },
323
323
  });
324
324
  ```
325
325
 
@@ -329,7 +329,7 @@ Once that credential authenticates, the following message will appear in the log
329
329
  azure:identity:info [Authenticated account] Client ID: HIDDEN. Tenant ID: HIDDEN. User Principal Name: HIDDEN. Object ID (user): HIDDEN
330
330
  ```
331
331
 
332
- For assistance with troubleshooting, see the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/TROUBLESHOOTING.md).
332
+ For assistance with troubleshooting, see the [troubleshooting guide](https://aka.ms/azsdk/js/identity/troubleshoot).
333
333
 
334
334
  ## Next steps
335
335