Skip to content

Commit 0aaaae8

Browse files
[identity] Remove machine-code-dependent codepaths (Azure#15024) (Azure#15041)
* [identity] Remove machine-code-dependent codepaths * Linter fixes * Disable broken perf test * Added missing import back
1 parent 3127875 commit 0aaaae8

25 files changed

+40
-1126
lines changed

sdk/identity/identity/CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
### New features
66

7+
- Azure Identity for JavaScript no longer carries any native dependencies (neither ordinary, peer, nor optional dependencies). Previous distributions of `@azure/identity` carried an optional dependency on `keytar`, which caused issues for some users in restrictive environments.
78
- Updated the `@azure/msal-node` dependency to version `^1.0.2`, which allows cancelling of an ongoing `getToken()` operation on `DeviceCodeCredential`.
89
- Fixed issue with the logging of success messages on the `DefaultAzureCredential` and the `ChainedTokenCredential`. These messages will now mention the internal credential that succeeded.
910
- The feature of persistence caching of credentials (introduced in 2.0.0-beta.1) is now supported on Node.js 15 as well.
1011
- `AuthenticationRequiredError` (introduced in 2.0.0-beta.1) now has the same impact on `ChainedTokenCredential` as the `CredentialUnavailableError` which is to allow the next credential in the chain to be tried.
11-
- `ManagedIdentityCredential` now retries with exponential back-off when a request for a token fails with a 404 status code on environments with available IMDS endpoints.
12+
- `ManagedIdentityCredential` now retries with exponential back-off when a request for a token fails with a 404 status code on environments with available IMDS endpoints.
1213

1314
### Breaking changes from 2.0.0-beta.1
1415

16+
- Removed `VisualStudioCodeCredential`, as it requires us to list `keytar` as an optional dependency. `keytar` containes machine-code components that are difficult to build in certain environments, so this credential will be offered through a separate extension package in the future.
17+
- Removed token persistence through `@azure/msal-node-extensions`, as its machine-code components have the same problems as `keytar`. This functionality will similarly be reintroduced through a separate extension package in the future.
1518
- Removed `authenticationRecord`, `disableAutomaticAuthentication` and `authenticate()` from the credential `UsernamePasswordCredential`. While MSAL does support this, allowing `authenticationRecord` arguably could result in users authenticating through an account other than the one they're specifying with the username and the password.
1619

1720
## 2.0.0-beta.2 (2021-04-06)
@@ -38,7 +41,7 @@ This update marks the preview for the first major version update of the `@azure/
3841

3942
### Breaking changes
4043

41-
- Changes to `InteractiveBrowserCredential`
44+
- Changes to `InteractiveBrowserCredential`
4245
- When used in browser applications, the `InteractiveBrowserCredential` has been updated to 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) by default to better support browsers with enhanced security restrictions. Please note that this credential always used the Auth Code Flow when used in Node.js applications. Read more on this in our [docs on Interactive Browser Credential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/interactive-browser-credential.md).
4346
- The default client ID used for `InteractiveBrowserCredential` was viable only in Node.js and not for the browser. Therefore, client Id is now a required parameter when constructing this credential in browser applications.
4447
- The `loginStyle` and `flow` options to the constructor for `InteractiveBrowserCredential` will now show up only when used in browser applications as these were never applicable to Node.js
@@ -53,7 +56,7 @@ This update marks the preview for the first major version update of the `@azure/
5356
- Changes to `InteractiveBrowserCredential`, `DeviceCodeCredential`, `ClientSecretCredential`, `ClientCertificateCredential` and `UsernamePasswordCredential`:
5457
- Migrated to use the latest MSAL. This update improves caching of tokens, significantly reducing the number of network requests.
5558
- Added the feature of persistence caching of credentials. This is driven by the new `tokenCachePersistenceOptions` option available in the options you pass to the credential constructors.
56-
- For now, to use this feature, users will need to install `@azure/msal-node-extensions` [1.0.0-alpha.6](https://www.npmjs.com/package/@azure/msal-node-extensions/v/1.0.0-alpha.6) on their own. This experience will be improved in the next update.
59+
- For now, to use this feature, users will need to install `@azure/msal-node-extensions` [1.0.0-alpha.6](https://www.npmjs.com/package/@azure/msal-node-extensions/v/1.0.0-alpha.6) on their own. This experience will be improved in the next update.
5760
- This feature uses DPAPI on Windows, it tries to use the Keychain on OSX and the Keyring on Linux.
5861
- To learn more on the usage, please refer to our docs on the `TokenCachePersistenceOptions` interface.
5962
- **IMPORTANT:** As part of this beta, this feature is only supported in Node 10, 12 and 14.
@@ -69,7 +72,7 @@ This update marks the preview for the first major version update of the `@azure/
6972
### Other changes
7073

7174
- Updated the `@azure/msal-node` dependency to `^1.0.0`.
72-
- `DefaultAzureCredential`'s implementation for browsers is simplified to throw the `BrowserNotSupportedError` in its constructor. Previously, we relied on getting the same error from trying to instantiate the different credentials that `DefaultAzureCredential` supports in Node.js.
75+
- `DefaultAzureCredential`'s implementation for browsers is simplified to throw the `BrowserNotSupportedError` in its constructor. Previously, we relied on getting the same error from trying to instantiate the different credentials that `DefaultAzureCredential` supports in Node.js.
7376
- As before, please use only the `InteractiveBrowserCredential` in your browser applications.
7477
- For the `InteractiveBrowserCredential` for node, replaced the use of the `express` module with a native http server for Node, shrinking the resulting identity module considerably.
7578

sdk/identity/identity/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
"tslib": "^2.0.0",
9797
"uuid": "^8.3.0"
9898
},
99-
"optionalDependencies": {
100-
"keytar": "^7.6.0"
101-
},
10299
"devDependencies": {
103100
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
104101
"@azure/dev-tool": "^1.0.0",

sdk/identity/identity/review/identity.api.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export class ClientCertificateCredential implements TokenCredential {
104104
// @public
105105
export interface ClientCertificateCredentialOptions extends TokenCredentialOptions {
106106
sendCertificateChain?: boolean;
107-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
108107
}
109108

110109
// @public
@@ -115,7 +114,6 @@ export class ClientSecretCredential implements TokenCredential {
115114

116115
// @public
117116
export interface ClientSecretCredentialOptions extends TokenCredentialOptions {
118-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
119117
}
120118

121119
// @public
@@ -211,7 +209,6 @@ export type InteractiveBrowserCredentialOptions = TokenCredentialOptions & Inter
211209
export interface InteractiveCredentialOptions extends TokenCredentialOptions {
212210
authenticationRecord?: AuthenticationRecord;
213211
disableAutomaticAuthentication?: boolean;
214-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
215212
}
216213

217214
// @public
@@ -227,12 +224,6 @@ export class ManagedIdentityCredential implements TokenCredential {
227224
// @public
228225
export function serializeAuthenticationRecord(record: AuthenticationRecord): string;
229226

230-
// @public
231-
export interface TokenCachePersistenceOptions {
232-
allowUnencryptedStorage?: boolean;
233-
name?: string;
234-
}
235-
236227
export { TokenCredential }
237228

238229
// @public
@@ -248,18 +239,6 @@ export class UsernamePasswordCredential implements TokenCredential {
248239

249240
// @public
250241
export interface UsernamePasswordCredentialOptions extends TokenCredentialOptions {
251-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
252-
}
253-
254-
// @public
255-
export class VisualStudioCodeCredential implements TokenCredential {
256-
constructor(options?: VisualStudioCodeCredentialOptions);
257-
getToken(scopes: string | string[], _options?: GetTokenOptions): Promise<AccessToken>;
258-
}
259-
260-
// @public
261-
export interface VisualStudioCodeCredentialOptions extends TokenCredentialOptions {
262-
tenantId?: string;
263242
}
264243

265244

sdk/identity/identity/src/credentials/clientCertificateCredentialOptions.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license.
33

44
import { TokenCredentialOptions } from "../client/identityClient";
5-
import { TokenCachePersistenceOptions } from "../tokenCache/persistencePlatforms";
65

76
/**
87
* Optional parameters for the {@link ClientCertificateCredential} class.
@@ -13,16 +12,4 @@ export interface ClientCertificateCredentialOptions extends TokenCredentialOptio
1312
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
1413
*/
1514
sendCertificateChain?: boolean;
16-
17-
/**
18-
* To provide a persistence layer to store the credentials,
19-
* we allow users to optionally specify {@link TokenCachePersistenceOptions} for their credential.
20-
*
21-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
22-
*
23-
* This persistence layer uses DPAPI on Windows.
24-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
25-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
26-
*/
27-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
2815
}

sdk/identity/identity/src/credentials/clientSecretCredentialOptions.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,8 @@
22
// Licensed under the MIT license.
33

44
import { TokenCredentialOptions } from "../client/identityClient";
5-
import { TokenCachePersistenceOptions } from "../tokenCache/persistencePlatforms";
65

76
/**
87
* Optional parameters for the {@link ClientSecretCredential} class.
98
*/
10-
export interface ClientSecretCredentialOptions extends TokenCredentialOptions {
11-
/**
12-
* To provide a persistence layer to store the credentials,
13-
* we allow users to optionally specify {@link TokenCachePersistenceOptions} for their credential.
14-
*
15-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
16-
*
17-
* This persistence layer uses DPAPI on Windows.
18-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
19-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
20-
*/
21-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
22-
}
9+
export interface ClientSecretCredentialOptions extends TokenCredentialOptions {}

sdk/identity/identity/src/credentials/defaultAzureCredential.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { ChainedTokenCredential } from "./chainedTokenCredential";
66
import { EnvironmentCredential } from "./environmentCredential";
77
import { ManagedIdentityCredential } from "./managedIdentityCredential";
88
import { AzureCliCredential } from "./azureCliCredential";
9-
import { VisualStudioCodeCredential } from "./visualStudioCodeCredential";
109

1110
/**
1211
* Provides options to configure the {@link DefaultAzureCredential} class.
@@ -58,7 +57,6 @@ export class DefaultAzureCredential extends ChainedTokenCredential {
5857
}
5958

6059
credentials.push(new AzureCliCredential());
61-
credentials.push(new VisualStudioCodeCredential(options));
6260

6361
super(...credentials);
6462
this.UnavailableMessage =

sdk/identity/identity/src/credentials/interactiveCredentialOptions.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import { TokenCredentialOptions } from "../client/identityClient";
55
import { AuthenticationRecord } from "../msal/types";
6-
import { TokenCachePersistenceOptions } from "../tokenCache/persistencePlatforms";
76

87
/**
98
* Common constructor options for the Identity credentials that requires user interaction.
@@ -26,16 +25,4 @@ export interface InteractiveCredentialOptions extends TokenCredentialOptions {
2625
* Developers will need to call to `authenticate()` to control when to manually authenticate.
2726
*/
2827
disableAutomaticAuthentication?: boolean;
29-
30-
/**
31-
* To provide a persistence layer to store the credentials,
32-
* we allow users to optionally specify {@link TokenCachePersistenceOptions} for their credential.
33-
*
34-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
35-
*
36-
* This persistence layer uses DPAPI on Windows.
37-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
38-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
39-
*/
40-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
4128
}

sdk/identity/identity/src/credentials/usernamePasswordCredentialOptions.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,8 @@
22
// Licensed under the MIT license.
33

44
import { TokenCredentialOptions } from "../client/identityClient";
5-
import { TokenCachePersistenceOptions } from "../tokenCache/persistencePlatforms";
65

76
/**
87
* Defines options for the {@link UsernamePasswordCredential} class.
98
*/
10-
export interface UsernamePasswordCredentialOptions extends TokenCredentialOptions {
11-
/**
12-
* To provide a persistence layer to store the credentials,
13-
* we allow users to optionally specify {@link TokenCachePersistenceOptions} for their credential.
14-
*
15-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
16-
*
17-
* This persistence layer uses DPAPI on Windows.
18-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
19-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
20-
*/
21-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
22-
}
9+
export interface UsernamePasswordCredentialOptions extends TokenCredentialOptions {}

sdk/identity/identity/src/credentials/visualStudioCodeCredential.browser.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)