@azure/identity 2.0.0-alpha.20211006.1 → 2.0.0-alpha.20211007.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.
- package/CHANGELOG.md +102 -4
- package/README.md +4 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +1 -1
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,122 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
## 2.0.0
|
|
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
|
-
|
|
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.
|
|
12
106
|
- Removed support for specific Azure regions on `ClientSecretCredential` and `ClientCertificateCredential. This feature will be added back on the next beta.
|
|
13
107
|
|
|
14
|
-
|
|
15
108
|
### Bugs Fixed
|
|
16
109
|
|
|
110
|
+
- `ClientSecretCredential`, `ClientCertificateCredential`, and `UsernamePasswordCredential` throw if the required parameters aren't provided (even in JavaScript).
|
|
17
111
|
- Fixed a bug that caused `AzureCliCredential` to fail when a custom tenant ID was provided.
|
|
18
112
|
- Caught up with the bug fixes for Azure POD Identity that were implemented on version 1.5.1.
|
|
19
113
|
|
|
20
114
|
### Other Changes
|
|
21
115
|
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
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.
|
|
119
|
+
|
|
22
120
|
## 2.0.0-beta.6 (2021-09-09)
|
|
23
121
|
|
|
24
122
|
### Features Added
|
|
@@ -176,7 +274,7 @@ This update marks the preview for the first major version update of the `@azure/
|
|
|
176
274
|
- This feature uses DPAPI on Windows, it tries to use the Keychain on OSX and the Keyring on Linux.
|
|
177
275
|
- To learn more on the usage, please refer to our docs on the `TokenCachePersistenceOptions` interface.
|
|
178
276
|
- **IMPORTANT:** As part of this beta, this feature is only supported in Node 10, 12 and 14.
|
|
179
|
-
- Changes to `InteractiveBrowserCredential
|
|
277
|
+
- Changes to `InteractiveBrowserCredential` and `DeviceCodeCredential`:
|
|
180
278
|
- 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.
|
|
181
279
|
- When enabled, this option stops the `getToken()` method from requesting user input in case the credential is unable to authenticate silently.
|
|
182
280
|
- 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
|
|
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}`;
|