@azure/identity 1.0.0-preview.1 → 1.0.0-preview.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 (88) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +50 -23
  3. package/browser/identity.js +9828 -0
  4. package/browser/identity.js.map +1 -0
  5. package/browser/identity.min.js +2 -0
  6. package/browser/identity.min.js.map +1 -0
  7. package/dist/index.js +475 -205
  8. package/dist/index.js.map +1 -1
  9. package/dist-esm/src/client/errors.d.ts +1 -1
  10. package/dist-esm/src/client/errors.d.ts.map +1 -1
  11. package/dist-esm/src/client/errors.js +9 -1
  12. package/dist-esm/src/client/errors.js.map +1 -1
  13. package/dist-esm/src/client/identityClient.d.ts +20 -17
  14. package/dist-esm/src/client/identityClient.d.ts.map +1 -1
  15. package/dist-esm/src/client/identityClient.js +42 -206
  16. package/dist-esm/src/client/identityClient.js.map +1 -1
  17. package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts +7 -0
  18. package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts.map +1 -0
  19. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +12 -0
  20. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -0
  21. package/dist-esm/src/credentials/clientCertificateCredential.d.ts +5 -5
  22. package/dist-esm/src/credentials/clientCertificateCredential.d.ts.map +1 -1
  23. package/dist-esm/src/credentials/clientCertificateCredential.js +59 -5
  24. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  25. package/dist-esm/src/credentials/clientSecretCredential.d.ts +3 -3
  26. package/dist-esm/src/credentials/clientSecretCredential.d.ts.map +1 -1
  27. package/dist-esm/src/credentials/clientSecretCredential.js +27 -4
  28. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  29. package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts +7 -0
  30. package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts.map +1 -0
  31. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +12 -0
  32. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -0
  33. package/dist-esm/src/credentials/deviceCodeCredential.d.ts +67 -0
  34. package/dist-esm/src/credentials/deviceCodeCredential.d.ts.map +1 -0
  35. package/dist-esm/src/credentials/deviceCodeCredential.js +139 -0
  36. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -0
  37. package/dist-esm/src/credentials/environmentCredential.browser.d.ts +7 -0
  38. package/dist-esm/src/credentials/environmentCredential.browser.d.ts.map +1 -0
  39. package/dist-esm/src/credentials/environmentCredential.browser.js +12 -0
  40. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -0
  41. package/dist-esm/src/credentials/environmentCredential.d.ts.map +1 -1
  42. package/dist-esm/src/credentials/environmentCredential.js +0 -4
  43. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  44. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts +32 -0
  45. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts.map +1 -0
  46. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +112 -0
  47. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -0
  48. package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts +12 -0
  49. package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts.map +1 -0
  50. package/dist-esm/src/credentials/interactiveBrowserCredential.js +17 -0
  51. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -0
  52. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts +24 -0
  53. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -0
  54. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js +3 -0
  55. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -0
  56. package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts +7 -0
  57. package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts.map +1 -0
  58. package/dist-esm/src/credentials/managedIdentityCredential.browser.js +15 -0
  59. package/dist-esm/src/credentials/managedIdentityCredential.browser.js.map +1 -0
  60. package/dist-esm/src/credentials/managedIdentityCredential.d.ts +10 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential.d.ts.map +1 -1
  62. package/dist-esm/src/credentials/managedIdentityCredential.js +144 -2
  63. package/dist-esm/src/credentials/managedIdentityCredential.js.map +1 -1
  64. package/dist-esm/src/credentials/usernamePasswordCredential.d.ts +39 -0
  65. package/dist-esm/src/credentials/usernamePasswordCredential.d.ts.map +1 -0
  66. package/dist-esm/src/credentials/usernamePasswordCredential.js +67 -0
  67. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -0
  68. package/dist-esm/src/index.d.ts +4 -0
  69. package/dist-esm/src/index.d.ts.map +1 -1
  70. package/dist-esm/src/index.js +3 -0
  71. package/dist-esm/src/index.js.map +1 -1
  72. package/package.json +32 -14
  73. package/src/client/errors.ts +11 -3
  74. package/src/client/identityClient.ts +64 -246
  75. package/src/credentials/clientCertificateCredential.browser.ts +27 -0
  76. package/src/credentials/clientCertificateCredential.ts +72 -22
  77. package/src/credentials/clientSecretCredential.ts +32 -17
  78. package/src/credentials/deviceCodeCredential.browser.ts +27 -0
  79. package/src/credentials/deviceCodeCredential.ts +203 -0
  80. package/src/credentials/environmentCredential.browser.ts +19 -0
  81. package/src/credentials/environmentCredential.ts +5 -9
  82. package/src/credentials/interactiveBrowserCredential.browser.ts +134 -0
  83. package/src/credentials/interactiveBrowserCredential.ts +31 -0
  84. package/src/credentials/interactiveBrowserCredentialOptions.ts +30 -0
  85. package/src/credentials/managedIdentityCredential.browser.ts +22 -0
  86. package/src/credentials/managedIdentityCredential.ts +179 -8
  87. package/src/credentials/usernamePasswordCredential.ts +83 -0
  88. package/src/index.ts +4 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0-preview.2 - 2019-08-05
4
+
5
+ - Introduced the following credential types:
6
+ - [`DeviceCodeCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/devicecodecredential.html)
7
+ - [`InteractiveBrowserCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/interactivebrowsercredential.html)
8
+ - [`UsernamePasswordCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/usernamepasswordcredential.html)
9
+ - This library can now be used in the browser! The following credential types supported in browser builds:
10
+ - `ClientSecretCredential`
11
+ - `UsernamePasswordCredential`
12
+ - `InteractiveBrowserCredential`
13
+
14
+ ## 1.0.0-preview.1 - 2019-06-27
15
+
16
+ For release notes and more information please visit https://aka.ms/azure-sdk-preview1-js
17
+
18
+ - Introduced the following credential types:
19
+ - [`DefaultAzureCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/defaultazurecredential.html)
20
+ - [`EnvironmentCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/environmentcredential.html)
21
+ - [`ManagedIdentityCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/managedidentitycredential.html)
22
+ - [`ClientSecretCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/clientsecretcredential.html)
23
+ - [`ClientCertificateCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/clientcertificatecredential.html)
24
+ - [`ChainedTokenCredential`](https://azure.github.io/azure-sdk-for-js/identity/classes/chainedtokencredential.html)
package/README.md CHANGED
@@ -12,11 +12,12 @@ to authenticate API requests. It supports token authentication using an Azure Ac
12
12
  - if you don't have one, you can sign up for a [free account](https://azure.microsoft.com/free/)
13
13
  - Node.js 8 LTS or higher
14
14
 
15
- **NOTE:** The credential implementations in this library are not yet supported in the browser. We will provide browser-supported implementations for some in a future preview release.
15
+ **NOTE:** The credential implementations in this library are not yet supported in the browser. We will provide browser-supported implementations for some in a future preview release.
16
16
 
17
17
  ### Install the package
18
18
 
19
19
  Install Azure Identity with `npm`:
20
+
20
21
  ```sh
21
22
  npm install --save @azure/identity
22
23
  ```
@@ -25,24 +26,27 @@ npm install --save @azure/identity
25
26
 
26
27
  ### Credentials
27
28
 
28
- Azure Identity offers a variety of credential classes that are accepted by Azure SDK data plane clients. Each client library documents its Azure Identity integration in its README and samples. Azure SDK management plane libraries (those starting with `@azure/arm-*`)
29
+ Azure Identity offers a variety of credential classes that are accepted by Azure SDK data plane clients. Each client library documents its Azure Identity integration in its README and samples. Azure SDK management plane libraries (those starting with `@azure/arm-*`)
29
30
  do not accept these credentials.
30
31
 
31
32
  Credentials differ mostly in configuration:
32
33
 
33
- |credential class|identity|configuration
34
- |-|-|-
35
- |`DefaultAzureCredential`|service principal or managed identity|none for managed identity; [environment variables](#environment-variables) for service principal
36
- |`ManagedIdentityCredential`|managed identity|none
37
- |`EnvironmentCredential`|service principal|[environment variables](#environment-variables)
38
- |`ClientSecretCredential`|service principal|constructor parameters
39
- |`ClientCertificateCredential`|service principal|constructor parameters
34
+ | credential class | identity | configuration |
35
+ | ---------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------ |
36
+ | [`DefaultAzureCredential`][1] | service principal or managed identity | none for managed identity; [environment variables](#environment-variables) for service principal |
37
+ | [`ManagedIdentityCredential`][2] | managed identity | none |
38
+ | [`EnvironmentCredential`][3] | service principal | [environment variables](#environment-variables) |
39
+ | [`ClientSecretCredential`][4] | service principal | constructor parameters |
40
+ | [`ClientCertificateCredential`][5] | service principal | constructor parameters |
41
+ | [`DeviceCodeCredential`][6] | app registration details | constructor parameters |
42
+ | [`InteractiveBrowserCredential`][7]| app registration details | constructor parameters |
43
+ | [`UsernamePasswordCredential`][8] | user principal | constructor parameters |
40
44
 
41
45
  Credentials can be chained and tried in turn until one succeeds; see [chaining credentials](#chaining-credentials) for details.
42
46
 
43
47
  ### DefaultAzureCredential
44
48
 
45
- `DefaultAzureCredential` is appropriate for most scenarios. It supports authenticating as a service principal or managed identity. To authenticate as a service principal, provide configuration in environment variables as described in the next section. Currently this credential attempts to use the `EnvironmentCredential` and `ManagedIdentityCredential`, in that order.
49
+ `DefaultAzureCredential` is appropriate for most scenarios. It supports authenticating as a service principal or managed identity. To authenticate as a service principal, provide configuration in environment variables as described in the next section. Currently this credential attempts to use the `EnvironmentCredential` and `ManagedIdentityCredential`, in that order.
46
50
 
47
51
  Authenticating as a managed identity requires no configuration, but does require platform support. See the [managed identity documentation](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities) for more information.
48
52
 
@@ -50,11 +54,11 @@ Authenticating as a managed identity requires no configuration, but does require
50
54
 
51
55
  `DefaultAzureCredential` and `EnvironmentCredential` are configured for service principal authentication with these environment variables:
52
56
 
53
- |variable name|value
54
- |-|-
55
- |`AZURE_CLIENT_ID`|service principal's app id
56
- |`AZURE_TENANT_ID`|id of the principal's Azure Active Directory tenant
57
- |`AZURE_CLIENT_SECRET`|one of the service principal's client secrets
57
+ | variable name | value |
58
+ | --------------------- | --------------------------------------------------- |
59
+ | `AZURE_CLIENT_ID` | service principal's app id |
60
+ | `AZURE_TENANT_ID` | id of the principal's Azure Active Directory tenant |
61
+ | `AZURE_CLIENT_SECRET` | one of the service principal's client secrets |
58
62
 
59
63
  ## Examples
60
64
 
@@ -64,7 +68,7 @@ Authenticating as a managed identity requires no configuration, but does require
64
68
  // The default credential first checks environment variables for configuration as described above.
65
69
  // If environment configuration is incomplete, it will try managed identity.
66
70
  const { KeysClient } = require("@azure/keyvault-keys");
67
- const { DefaultAzureCredential } = require('@azure/identity');
71
+ const { DefaultAzureCredential } = require("@azure/identity");
68
72
 
69
73
  // Azure SDK clients accept the credential as a parameter
70
74
  const credential = new DefaultAzureCredential();
@@ -73,23 +77,29 @@ const getResult = await client.getKey("MyKeyName");
73
77
  ```
74
78
 
75
79
  ### Authenticating as a service principal:
80
+
76
81
  ```javascript
77
82
  // Using a client secret
78
- const { ClientSecretCredential } = require('@azure/identity');
83
+ const { ClientSecretCredential } = require("@azure/identity");
79
84
  const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
80
85
 
81
86
  // Using a PEM-encoded certificate with a private key, not password protected
82
- const { ClientCertificateCredential } = require('@azure/identity');
83
- const credential = new ClientCertificateCredential(tenantId, clientId, "/app/certs/certificate.pem")
87
+ const { ClientCertificateCredential } = require("@azure/identity");
88
+ const credential = new ClientCertificateCredential(
89
+ tenantId,
90
+ clientId,
91
+ "/app/certs/certificate.pem"
92
+ );
84
93
 
85
94
  // Using environment variables (see "Environment variables" above for variable names)
86
- const { EnvironmentCredential } = require('@azure/identity');
95
+ const { EnvironmentCredential } = require("@azure/identity");
87
96
  const credential = new EnvironmentCredential();
88
97
  ```
89
98
 
90
99
  ### Chaining credentials:
100
+
91
101
  ```javascript
92
- const { ClientSecretCredential, ChainedTokenCredential } = require('@azure/identity');
102
+ const { ClientSecretCredential, ChainedTokenCredential } = require("@azure/identity");
93
103
 
94
104
  // When an access token is requested, the chain will try each
95
105
  // credential in order, stopping when one provides a token
@@ -105,16 +115,22 @@ const client = new KeysClient(vaultUrl, credentialChain);
105
115
  ## Troubleshooting
106
116
 
107
117
  ### General
108
- Credentials raise `AuthenticationError` when they fail to authenticate. This class has a `message` field which describes why authentication failed. An `AggregateAuthenticationError` will be raised by `ChainedTokenCredential` with an `errors` field containing an array of errors from each credential in the chain.
118
+
119
+ Credentials raise `AuthenticationError` when they fail to authenticate. This class has a `message` field which describes why authentication failed. An `AggregateAuthenticationError` will be raised by `ChainedTokenCredential` with an `errors` field containing an array of errors from each credential in the chain.
109
120
 
110
121
  ## Next steps
111
122
 
123
+ ### Read the documentation
124
+
125
+ API documentation for this library can be found on our [documentation site](https://azure.github.io/azure-sdk-for-js/identity/index.html).
126
+
112
127
  ### Provide Feedback
113
128
 
114
129
  If you encounter bugs or have suggestions, please [open an issue](https://github.com/Azure/azure-sdk-for-js/issues).
115
130
 
116
131
  ## Contributing
117
- This project welcomes contributions and suggestions. Most contributions require you to agree to a
132
+
133
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
118
134
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
119
135
  the rights to use your contribution. For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
120
136
 
@@ -122,6 +138,17 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
122
138
  a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
123
139
  provided by the bot. You will only need to do this once across all repos using our CLA.
124
140
 
141
+ If you'd like to contribute to this library, please read the [contributing guide](../../../CONTRIBUTING.md) to learn more about how to build and test the code.
142
+
125
143
  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
126
144
  For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
127
145
  or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
146
+
147
+ [1]: https://azure.github.io/azure-sdk-for-js/identity/classes/defaultazurecredential.html
148
+ [2]: https://azure.github.io/azure-sdk-for-js/identity/classes/managedidentitycredential.html
149
+ [3]: https://azure.github.io/azure-sdk-for-js/identity/classes/environmentcredential.html
150
+ [4]: https://azure.github.io/azure-sdk-for-js/identity/classes/clientsecretcredential.html
151
+ [5]: https://azure.github.io/azure-sdk-for-js/identity/classes/clientcertificatecredential.html
152
+ [6]: https://azure.github.io/azure-sdk-for-js/identity/classes/devicecodecredential.html
153
+ [7]: https://azure.github.io/azure-sdk-for-js/identity/classes/interactivebrowsercredential.html
154
+ [8]: https://azure.github.io/azure-sdk-for-js/identity/classes/usernamepasswordcredential.html