@azure/identity 4.4.0 → 4.5.0-alpha.20240813.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/README.md +22 -1
  2. package/dist/index.js +441 -812
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/client/identityClient.js +8 -2
  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/azurePipelinesCredential.js +50 -26
  9. package/dist-esm/src/credentials/azurePipelinesCredential.js.map +1 -1
  10. package/dist-esm/src/credentials/azurePowerShellCredential.js +63 -19
  11. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  12. package/dist-esm/src/credentials/clientAssertionCredential.js +9 -2
  13. package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -1
  14. package/dist-esm/src/credentials/clientCertificateCredential.js +35 -27
  15. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  16. package/dist-esm/src/credentials/clientSecretCredential.js +9 -2
  17. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  18. package/dist-esm/src/credentials/deviceCodeCredential.js +1 -1
  19. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  20. package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
  21. package/dist-esm/src/credentials/environmentCredential.js +11 -1
  22. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  23. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  24. package/dist-esm/src/credentials/interactiveBrowserCredential.js +1 -1
  25. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  26. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  27. package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js +37 -0
  28. package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -0
  29. package/dist-esm/src/credentials/managedIdentityCredential/index.js +6 -2
  30. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  31. package/dist-esm/src/credentials/managedIdentityCredential/legacyMsiProvider.js +1 -1
  32. package/dist-esm/src/credentials/managedIdentityCredential/legacyMsiProvider.js.map +1 -1
  33. package/dist-esm/src/credentials/managedIdentityCredential/msalMsiProvider.js +195 -0
  34. package/dist-esm/src/credentials/managedIdentityCredential/msalMsiProvider.js.map +1 -0
  35. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +19 -22
  36. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  37. package/dist-esm/src/credentials/onBehalfOfCredential.js +16 -9
  38. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  39. package/dist-esm/src/credentials/usernamePasswordCredential.js +13 -3
  40. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  41. package/dist-esm/src/credentials/workloadIdentityCredential.js +16 -6
  42. package/dist-esm/src/credentials/workloadIdentityCredential.js.map +1 -1
  43. package/dist-esm/src/errors.js +12 -7
  44. package/dist-esm/src/errors.js.map +1 -1
  45. package/dist-esm/src/msal/browserFlows/flows.js.map +1 -0
  46. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  47. package/dist-esm/src/msal/nodeFlows/msalClient.js +8 -1
  48. package/dist-esm/src/msal/nodeFlows/msalClient.js.map +1 -1
  49. package/package.json +4 -4
  50. package/types/identity.d.ts +26 -8
  51. package/dist-esm/src/msal/flows.js.map +0 -1
  52. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +0 -47
  53. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +0 -1
  54. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +0 -42
  55. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +0 -1
  56. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +0 -112
  57. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +0 -1
  58. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js +0 -33
  59. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +0 -1
  60. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +0 -35
  61. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +0 -1
  62. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +0 -323
  63. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +0 -1
  64. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +0 -58
  65. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +0 -1
  66. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +0 -113
  67. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +0 -1
  68. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js +0 -33
  69. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +0 -1
  70. /package/dist-esm/src/msal/{flows.js → browserFlows/flows.js} +0 -0
package/README.md CHANGED
@@ -213,7 +213,7 @@ For examples of how to use managed identity for authentication, see [the example
213
213
 
214
214
  ## Cloud configuration
215
215
 
216
- Credentials default to authenticating to the Microsoft Entra endpoint for Azure Public Cloud. To access resources in other clouds, such as Azure Government or a private cloud, configure credentials with the `authorityHost` argument in the constructor. The `AzureAuthorityHosts` interface defines authorities for well-known clouds. For the US Government cloud, you could instantiate a credential this way:
216
+ Credentials default to authenticating to the Microsoft Entra endpoint for Azure Public Cloud. To access resources in other clouds, such as Azure Government or a private cloud, configure credentials with the `authorityHost` argument in the constructor. The [`AzureAuthorityHosts`][authority_hosts] enum defines authorities for well-known clouds. For the US Government cloud, you could instantiate a credential this way:
217
217
 
218
218
  ```typescript
219
219
  import { AzureAuthorityHosts, ClientSecretCredential } from "@azure/identity";
@@ -227,6 +227,26 @@ const credential = new ClientSecretCredential(
227
227
  );
228
228
  ```
229
229
 
230
+ As an alternative to specifying the `authorityHost` argument, you can also set the `AZURE_AUTHORITY_HOST` environment variable to the URL of your cloud's authority. This approach is useful when configuring multiple credentials to authenticate to the same cloud or when the deployed environment needs to define the target cloud:
231
+
232
+ ```sh
233
+ AZURE_AUTHORITY_HOST=https://login.partner.microsoftonline.cn
234
+ ```
235
+
236
+ The `AzureAuthorityHosts` enum defines authorities for well-known clouds for your convenience; however, if the authority for your cloud isn't listed in `AzureAuthorityHosts`, you may pass any valid authority URL as a string argument. For example:
237
+
238
+ ```typescript
239
+ import { AzureAuthorityHosts, ClientSecretCredential } from "@azure/identity";
240
+ const credential = new ClientSecretCredential(
241
+ "<YOUR_TENANT_ID>",
242
+ "<YOUR_CLIENT_ID>",
243
+ "<YOUR_CLIENT_SECRET>",
244
+ {
245
+ authorityHost: "https://login.partner.microsoftonline.cn",
246
+ }
247
+ );
248
+ ```
249
+
230
250
  Not all credentials require this configuration. Credentials that authenticate through a development tool, such as `AzureCliCredential`, use that tool's configuration. Similarly, `VisualStudioCodeCredential` accepts an `authorityHost` argument but defaults to the `authorityHost` matching Visual Studio Code's **Azure: Cloud** setting.
231
251
 
232
252
  ## Credential classes
@@ -369,5 +389,6 @@ If you'd like to contribute to this library, please read the [contributing guide
369
389
  [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.svg
370
390
  [azure_identity_broker]: https://www.npmjs.com/package/@azure/identity-broker
371
391
  [azure_identity_broker_readme]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-broker
392
+ [authority_hosts]: https://learn.microsoft.com/javascript/api/@azure/identity/azureauthorityhosts
372
393
 
373
394
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)