@azure/identity-vscode 1.0.1 → 2.0.0-beta.1
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.
- package/README.md +10 -11
- package/dist/browser/index.d.ts +1 -4
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +26 -7
- package/dist/browser/index.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -4
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +26 -7
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/index.d.ts +1 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +26 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -4
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +26 -7
- package/dist/react-native/index.js.map +1 -1
- package/package.json +12 -17
package/README.md
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
**Deprecation notice ⚠️**: This package has been deprecated, as the `VisualStudioCodeCredential` credential in `@azure/identity` is deprecated. This is because the VS Code Azure Account extension on which this credential relies has been deprecated. Users should use other dev-time credentials, such as `AzureCliCredential`, `AzureDeveloperCliCredential`, or `AzurePowerShellCredential` for their local development needs. See Azure Account extension deprecation notice [here](https://github.com/microsoft/vscode-azure-account/issues/964).
|
|
1
|
+
# Azure Identity Plugin for Visual Studio Code Authentication
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
This package provides a plugin to the Azure Identity library for JavaScript ([`@azure/identity`](https://npmjs.com/package/@azure/identity)) that enables authentication through the "Azure Account" extension for Visual Studio Code. This plugin provides the dependencies of the `VisualStudioCodeCredential` in `@azure/identity` and enables it for use on its own or as part of `DefaultAzureCredential`.
|
|
3
|
+
This package provides a plugin to the Azure Identity library for JavaScript ([`@azure/identity`](https://npmjs.com/package/@azure/identity)) that enables authentication through the "Azure Resources" extension for Visual Studio Code. This plugin provides the dependencies of the `VisualStudioCodeCredential` in `@azure/identity` and enables it for use on its own or as part of `DefaultAzureCredential`.
|
|
7
4
|
|
|
8
5
|
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) | [Samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-vscode/samples-dev)
|
|
9
6
|
|
|
10
7
|
### Prerequisites
|
|
11
8
|
|
|
12
9
|
- An [Azure subscription](https://azure.microsoft.com/free/).
|
|
13
|
-
- Install [Visual Studio Code](https://aka.ms/vscode) and the ["Azure
|
|
10
|
+
- Install [Visual Studio Code](https://aka.ms/vscode) and the ["Azure Resources" extension][azresourcesext]
|
|
14
11
|
|
|
15
12
|
### Install the package
|
|
16
13
|
|
|
@@ -31,7 +28,7 @@ If this is your first time using `@azure/identity` or Microsoft Entra ID, we rec
|
|
|
31
28
|
|
|
32
29
|
### Azure Identity Plugins
|
|
33
30
|
|
|
34
|
-
As of `@azure/identity` version
|
|
31
|
+
As of `@azure/identity` version 4.11.0, the Identity client library for JavaScript includes a plugin API. This package (`@azure/identity-vscode`) exports a plugin object that you must pass as an argument to the top-level `useIdentityPlugin` function from the `@azure/identity` package. Enable authentication through the "Azure Resource" extension for Visual Studio Code as follows:
|
|
35
32
|
|
|
36
33
|
```ts snippet:ReadmeSampleUsePlugin
|
|
37
34
|
import { useIdentityPlugin } from "@azure/identity";
|
|
@@ -44,10 +41,12 @@ After calling `useIdentityPlugin`, the `VisualStudioCodeCredential` from the `@a
|
|
|
44
41
|
|
|
45
42
|
### Visual Studio Code Authentication
|
|
46
43
|
|
|
47
|
-
`VisualStudioCodeCredential` uses the authentication
|
|
44
|
+
`VisualStudioCodeCredential` uses the authentication record from the ["Azure Resources" extension][azresourcesext]. To use this credential, you must sign in to your Azure account using the extension. To do so, open Visual Studio Code, ensure that the extension is installed, and sign in from **Command Palette** using the "Azure: Sign In" option to open a browser window and sign in to Azure. Alternatively, you can select "Azure: Sign In with Device Code" to use the device code flow.
|
|
48
45
|
|
|
49
46
|
After signing in, you may need to select a subscription (for example, if you have multiple Azure subscriptions), and you can change the active subscription by using the menu to select the "Azure: Select Subscriptions" entry.
|
|
50
47
|
|
|
48
|
+
The plugin automatically detects the authentication record stored by the Azure Resources extension and uses it for authentication.
|
|
49
|
+
|
|
51
50
|
## Examples
|
|
52
51
|
|
|
53
52
|
Once the plugin is registered, you can use `VisualStudioCodeCredential` in a similar fashion to the other credential classes in `@azure/identity`:
|
|
@@ -67,7 +66,7 @@ const scope = "https://graph.microsoft.com/.default";
|
|
|
67
66
|
console.log((await credential.getToken(scope)).token.substr(0, 10), "...");
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
You can also use `DefaultAzureCredential`, which will attempt to authenticate using the "Azure
|
|
69
|
+
You can also use `DefaultAzureCredential`, which will attempt to authenticate using the "Azure Resources" extension for Visual Studio Code if it's available:
|
|
71
70
|
|
|
72
71
|
```ts snippet:ReadmeSampleDefaultAzureCredential
|
|
73
72
|
import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity";
|
|
@@ -76,7 +75,7 @@ import { vsCodePlugin } from "@azure/identity-vscode";
|
|
|
76
75
|
useIdentityPlugin(vsCodePlugin);
|
|
77
76
|
|
|
78
77
|
// With the plugin enabled above, `DefaultAzureCredential` will use
|
|
79
|
-
// Visual Studio Code's "Azure
|
|
78
|
+
// Visual Studio Code's "Azure Resources" extension to authenticate if
|
|
80
79
|
// it is available.
|
|
81
80
|
const credential = new DefaultAzureCredential();
|
|
82
81
|
|
|
@@ -107,4 +106,4 @@ If you encounter bugs or have suggestions, please [open an issue](https://github
|
|
|
107
106
|
|
|
108
107
|
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
|
109
108
|
|
|
110
|
-
[
|
|
109
|
+
[azresourcesext]: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureresourcegroups
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -2,12 +2,9 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
4
4
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
5
|
-
* `@azure/identity` versions
|
|
5
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
6
6
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
7
7
|
*
|
|
8
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
9
|
-
* Account" extension in VS Code.
|
|
10
|
-
*
|
|
11
8
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
12
9
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
13
10
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgDtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAC"}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { NativeBrokerPlugin } from "@azure/msal-node-extensions";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
/**
|
|
8
|
+
* Finds the path to the VS Code authentication record file.
|
|
9
|
+
* @returns The path to the authentication record file, or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
function findAuthRecordPath() {
|
|
12
|
+
const homedir = os.homedir();
|
|
13
|
+
const azureDirs = [".azure", ".Azure"];
|
|
14
|
+
for (const azureDir of azureDirs) {
|
|
15
|
+
const authPath = path.join(homedir, azureDir, "ms-azuretools.vscode-azureresourcegroups", "authRecord.json");
|
|
16
|
+
if (existsSync(authPath)) {
|
|
17
|
+
return authPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
7
24
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
8
|
-
* `@azure/identity` versions
|
|
25
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
9
26
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
10
27
|
*
|
|
11
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
12
|
-
* Account" extension in VS Code.
|
|
13
|
-
*
|
|
14
28
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
15
29
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
16
30
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -36,6 +50,11 @@ const VSCodeServiceName = "VS Code Azure";
|
|
|
36
50
|
*/
|
|
37
51
|
export const vsCodePlugin = (context) => {
|
|
38
52
|
const { vsCodeCredentialControl } = context;
|
|
39
|
-
|
|
53
|
+
const authRecordPath = findAuthRecordPath();
|
|
54
|
+
if (authRecordPath) {
|
|
55
|
+
vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);
|
|
56
|
+
}
|
|
57
|
+
const brokerPlugin = new NativeBrokerPlugin();
|
|
58
|
+
vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);
|
|
40
59
|
};
|
|
41
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B;;;GAGG;AACH,SAAS,kBAAkB;IACzB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,OAAO,EACP,QAAQ,EACR,0CAA0C,EAC1C,iBAAiB,CAClB,CAAC;QACF,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,YAAY,GAAmB,CAAC,OAAO,EAAE,EAAE;IACtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAA6B,CAAC;IAElE,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;IAC5C,IAAI,cAAc,EAAE,CAAC;QACnB,uBAAuB,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACxD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin } from \"@azure/identity\";\nimport { NativeBrokerPlugin } from \"@azure/msal-node-extensions\";\nimport { existsSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\ninterface VSCodeCredentialControl {\n setVSCodeAuthRecordPath(path: string): void;\n setVSCodeBroker(nativeBroker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\ninterface AzurePluginContext {\n vsCodeCredentialControl: VSCodeCredentialControl;\n}\n\n/**\n * Finds the path to the VS Code authentication record file.\n * @returns The path to the authentication record file, or undefined if not found.\n */\nfunction findAuthRecordPath(): string | undefined {\n const homedir = os.homedir();\n const azureDirs = [\".azure\", \".Azure\"];\n\n for (const azureDir of azureDirs) {\n const authPath = path.join(\n homedir,\n azureDir,\n \"ms-azuretools.vscode-azureresourcegroups\",\n \"authRecord.json\",\n );\n if (existsSync(authPath)) {\n return authPath;\n }\n }\n return undefined;\n}\n\n/**\n * A plugin that provides the dependencies of `VisualStudioCodeCredential`\n * and enables it within `@azure/identity`. The plugin API is compatible with\n * `@azure/identity` versions 4.11.0 and later. Load this plugin using the\n * `useIdentityPlugin` function, imported from `@azure/identity`.\n *\n * To use this functionality, import `VisualStudioCodeCredential` or\n * `DefaultAzureCredential` from `@azure/identity`. If this plugin is not\n * enabled, then `VisualStudioCodeCredential` will throw a\n * `CredentialUnavailableError`, and `DefaultAzureCredential` will not be able\n * to use authentication through Visual Studio Code.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleVisualStudioCodeCredential\n * import { useIdentityPlugin, VisualStudioCodeCredential } from \"@azure/identity\";\n * import { vsCodePlugin } from \"@azure/identity-vscode\";\n *\n * useIdentityPlugin(vsCodePlugin);\n *\n * const credential = new VisualStudioCodeCredential();\n *\n * // The graph.microsoft.com scope is used as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substr(0, 10), \"...\");\n * ```\n */\nexport const vsCodePlugin: IdentityPlugin = (context) => {\n const { vsCodeCredentialControl } = context as AzurePluginContext;\n\n const authRecordPath = findAuthRecordPath();\n if (authRecordPath) {\n vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);\n }\n\n const brokerPlugin = new NativeBrokerPlugin();\n vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);\n};\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -2,12 +2,9 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
4
4
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
5
|
-
* `@azure/identity` versions
|
|
5
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
6
6
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
7
7
|
*
|
|
8
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
9
|
-
* Account" extension in VS Code.
|
|
10
|
-
*
|
|
11
8
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
12
9
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
13
10
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgDtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -4,17 +4,31 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.vsCodePlugin = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const msal_node_extensions_1 = require("@azure/msal-node-extensions");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
11
|
+
/**
|
|
12
|
+
* Finds the path to the VS Code authentication record file.
|
|
13
|
+
* @returns The path to the authentication record file, or undefined if not found.
|
|
14
|
+
*/
|
|
15
|
+
function findAuthRecordPath() {
|
|
16
|
+
const homedir = node_os_1.default.homedir();
|
|
17
|
+
const azureDirs = [".azure", ".Azure"];
|
|
18
|
+
for (const azureDir of azureDirs) {
|
|
19
|
+
const authPath = node_path_1.default.join(homedir, azureDir, "ms-azuretools.vscode-azureresourcegroups", "authRecord.json");
|
|
20
|
+
if ((0, node_fs_1.existsSync)(authPath)) {
|
|
21
|
+
return authPath;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
9
26
|
/**
|
|
10
27
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
11
28
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
12
|
-
* `@azure/identity` versions
|
|
29
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
13
30
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
14
31
|
*
|
|
15
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
16
|
-
* Account" extension in VS Code.
|
|
17
|
-
*
|
|
18
32
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
19
33
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
20
34
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -40,7 +54,12 @@ const VSCodeServiceName = "VS Code Azure";
|
|
|
40
54
|
*/
|
|
41
55
|
const vsCodePlugin = (context) => {
|
|
42
56
|
const { vsCodeCredentialControl } = context;
|
|
43
|
-
|
|
57
|
+
const authRecordPath = findAuthRecordPath();
|
|
58
|
+
if (authRecordPath) {
|
|
59
|
+
vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);
|
|
60
|
+
}
|
|
61
|
+
const brokerPlugin = new msal_node_extensions_1.NativeBrokerPlugin();
|
|
62
|
+
vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);
|
|
44
63
|
};
|
|
45
64
|
exports.vsCodePlugin = vsCodePlugin;
|
|
46
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAGlC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAGlC,sEAAiE;AACjE,qCAAqC;AACrC,8DAAyB;AACzB,kEAA6B;AAsB7B;;;GAGG;AACH,SAAS,kBAAkB;IACzB,MAAM,OAAO,GAAG,iBAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CACxB,OAAO,EACP,QAAQ,EACR,0CAA0C,EAC1C,iBAAiB,CAClB,CAAC;QACF,IAAI,IAAA,oBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,MAAM,YAAY,GAAmB,CAAC,OAAO,EAAE,EAAE;IACtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAA6B,CAAC;IAElE,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;IAC5C,IAAI,cAAc,EAAE,CAAC;QACnB,uBAAuB,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,yCAAkB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACxD,CAAC,CAAC;AAVW,QAAA,YAAY,gBAUvB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin } from \"@azure/identity\";\nimport { NativeBrokerPlugin } from \"@azure/msal-node-extensions\";\nimport { existsSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\ninterface VSCodeCredentialControl {\n setVSCodeAuthRecordPath(path: string): void;\n setVSCodeBroker(nativeBroker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\ninterface AzurePluginContext {\n vsCodeCredentialControl: VSCodeCredentialControl;\n}\n\n/**\n * Finds the path to the VS Code authentication record file.\n * @returns The path to the authentication record file, or undefined if not found.\n */\nfunction findAuthRecordPath(): string | undefined {\n const homedir = os.homedir();\n const azureDirs = [\".azure\", \".Azure\"];\n\n for (const azureDir of azureDirs) {\n const authPath = path.join(\n homedir,\n azureDir,\n \"ms-azuretools.vscode-azureresourcegroups\",\n \"authRecord.json\",\n );\n if (existsSync(authPath)) {\n return authPath;\n }\n }\n return undefined;\n}\n\n/**\n * A plugin that provides the dependencies of `VisualStudioCodeCredential`\n * and enables it within `@azure/identity`. The plugin API is compatible with\n * `@azure/identity` versions 4.11.0 and later. Load this plugin using the\n * `useIdentityPlugin` function, imported from `@azure/identity`.\n *\n * To use this functionality, import `VisualStudioCodeCredential` or\n * `DefaultAzureCredential` from `@azure/identity`. If this plugin is not\n * enabled, then `VisualStudioCodeCredential` will throw a\n * `CredentialUnavailableError`, and `DefaultAzureCredential` will not be able\n * to use authentication through Visual Studio Code.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleVisualStudioCodeCredential\n * import { useIdentityPlugin, VisualStudioCodeCredential } from \"@azure/identity\";\n * import { vsCodePlugin } from \"@azure/identity-vscode\";\n *\n * useIdentityPlugin(vsCodePlugin);\n *\n * const credential = new VisualStudioCodeCredential();\n *\n * // The graph.microsoft.com scope is used as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substr(0, 10), \"...\");\n * ```\n */\nexport const vsCodePlugin: IdentityPlugin = (context) => {\n const { vsCodeCredentialControl } = context as AzurePluginContext;\n\n const authRecordPath = findAuthRecordPath();\n if (authRecordPath) {\n vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);\n }\n\n const brokerPlugin = new NativeBrokerPlugin();\n vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);\n};\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,12 +2,9 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
4
4
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
5
|
-
* `@azure/identity` versions
|
|
5
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
6
6
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
7
7
|
*
|
|
8
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
9
|
-
* Account" extension in VS Code.
|
|
10
|
-
*
|
|
11
8
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
12
9
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
13
10
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgDtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { NativeBrokerPlugin } from "@azure/msal-node-extensions";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
/**
|
|
8
|
+
* Finds the path to the VS Code authentication record file.
|
|
9
|
+
* @returns The path to the authentication record file, or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
function findAuthRecordPath() {
|
|
12
|
+
const homedir = os.homedir();
|
|
13
|
+
const azureDirs = [".azure", ".Azure"];
|
|
14
|
+
for (const azureDir of azureDirs) {
|
|
15
|
+
const authPath = path.join(homedir, azureDir, "ms-azuretools.vscode-azureresourcegroups", "authRecord.json");
|
|
16
|
+
if (existsSync(authPath)) {
|
|
17
|
+
return authPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
7
24
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
8
|
-
* `@azure/identity` versions
|
|
25
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
9
26
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
10
27
|
*
|
|
11
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
12
|
-
* Account" extension in VS Code.
|
|
13
|
-
*
|
|
14
28
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
15
29
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
16
30
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -36,6 +50,11 @@ const VSCodeServiceName = "VS Code Azure";
|
|
|
36
50
|
*/
|
|
37
51
|
export const vsCodePlugin = (context) => {
|
|
38
52
|
const { vsCodeCredentialControl } = context;
|
|
39
|
-
|
|
53
|
+
const authRecordPath = findAuthRecordPath();
|
|
54
|
+
if (authRecordPath) {
|
|
55
|
+
vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);
|
|
56
|
+
}
|
|
57
|
+
const brokerPlugin = new NativeBrokerPlugin();
|
|
58
|
+
vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);
|
|
40
59
|
};
|
|
41
60
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B;;;GAGG;AACH,SAAS,kBAAkB;IACzB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,OAAO,EACP,QAAQ,EACR,0CAA0C,EAC1C,iBAAiB,CAClB,CAAC;QACF,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,YAAY,GAAmB,CAAC,OAAO,EAAE,EAAE;IACtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAA6B,CAAC;IAElE,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;IAC5C,IAAI,cAAc,EAAE,CAAC;QACnB,uBAAuB,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACxD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin } from \"@azure/identity\";\nimport { NativeBrokerPlugin } from \"@azure/msal-node-extensions\";\nimport { existsSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\ninterface VSCodeCredentialControl {\n setVSCodeAuthRecordPath(path: string): void;\n setVSCodeBroker(nativeBroker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\ninterface AzurePluginContext {\n vsCodeCredentialControl: VSCodeCredentialControl;\n}\n\n/**\n * Finds the path to the VS Code authentication record file.\n * @returns The path to the authentication record file, or undefined if not found.\n */\nfunction findAuthRecordPath(): string | undefined {\n const homedir = os.homedir();\n const azureDirs = [\".azure\", \".Azure\"];\n\n for (const azureDir of azureDirs) {\n const authPath = path.join(\n homedir,\n azureDir,\n \"ms-azuretools.vscode-azureresourcegroups\",\n \"authRecord.json\",\n );\n if (existsSync(authPath)) {\n return authPath;\n }\n }\n return undefined;\n}\n\n/**\n * A plugin that provides the dependencies of `VisualStudioCodeCredential`\n * and enables it within `@azure/identity`. The plugin API is compatible with\n * `@azure/identity` versions 4.11.0 and later. Load this plugin using the\n * `useIdentityPlugin` function, imported from `@azure/identity`.\n *\n * To use this functionality, import `VisualStudioCodeCredential` or\n * `DefaultAzureCredential` from `@azure/identity`. If this plugin is not\n * enabled, then `VisualStudioCodeCredential` will throw a\n * `CredentialUnavailableError`, and `DefaultAzureCredential` will not be able\n * to use authentication through Visual Studio Code.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleVisualStudioCodeCredential\n * import { useIdentityPlugin, VisualStudioCodeCredential } from \"@azure/identity\";\n * import { vsCodePlugin } from \"@azure/identity-vscode\";\n *\n * useIdentityPlugin(vsCodePlugin);\n *\n * const credential = new VisualStudioCodeCredential();\n *\n * // The graph.microsoft.com scope is used as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substr(0, 10), \"...\");\n * ```\n */\nexport const vsCodePlugin: IdentityPlugin = (context) => {\n const { vsCodeCredentialControl } = context as AzurePluginContext;\n\n const authRecordPath = findAuthRecordPath();\n if (authRecordPath) {\n vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);\n }\n\n const brokerPlugin = new NativeBrokerPlugin();\n vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);\n};\n"]}
|
|
@@ -2,12 +2,9 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
4
4
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
5
|
-
* `@azure/identity` versions
|
|
5
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
6
6
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
7
7
|
*
|
|
8
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
9
|
-
* Account" extension in VS Code.
|
|
10
|
-
*
|
|
11
8
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
12
9
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
13
10
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgDtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAC"}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { NativeBrokerPlugin } from "@azure/msal-node-extensions";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
/**
|
|
8
|
+
* Finds the path to the VS Code authentication record file.
|
|
9
|
+
* @returns The path to the authentication record file, or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
function findAuthRecordPath() {
|
|
12
|
+
const homedir = os.homedir();
|
|
13
|
+
const azureDirs = [".azure", ".Azure"];
|
|
14
|
+
for (const azureDir of azureDirs) {
|
|
15
|
+
const authPath = path.join(homedir, azureDir, "ms-azuretools.vscode-azureresourcegroups", "authRecord.json");
|
|
16
|
+
if (existsSync(authPath)) {
|
|
17
|
+
return authPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* A plugin that provides the dependencies of `VisualStudioCodeCredential`
|
|
7
24
|
* and enables it within `@azure/identity`. The plugin API is compatible with
|
|
8
|
-
* `@azure/identity` versions
|
|
25
|
+
* `@azure/identity` versions 4.11.0 and later. Load this plugin using the
|
|
9
26
|
* `useIdentityPlugin` function, imported from `@azure/identity`.
|
|
10
27
|
*
|
|
11
|
-
* `VisualStudioCodeCredential` uses the authentication session from the "Azure
|
|
12
|
-
* Account" extension in VS Code.
|
|
13
|
-
*
|
|
14
28
|
* To use this functionality, import `VisualStudioCodeCredential` or
|
|
15
29
|
* `DefaultAzureCredential` from `@azure/identity`. If this plugin is not
|
|
16
30
|
* enabled, then `VisualStudioCodeCredential` will throw a
|
|
@@ -36,6 +50,11 @@ const VSCodeServiceName = "VS Code Azure";
|
|
|
36
50
|
*/
|
|
37
51
|
export const vsCodePlugin = (context) => {
|
|
38
52
|
const { vsCodeCredentialControl } = context;
|
|
39
|
-
|
|
53
|
+
const authRecordPath = findAuthRecordPath();
|
|
54
|
+
if (authRecordPath) {
|
|
55
|
+
vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);
|
|
56
|
+
}
|
|
57
|
+
const brokerPlugin = new NativeBrokerPlugin();
|
|
58
|
+
vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);
|
|
40
59
|
};
|
|
41
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B;;;GAGG;AACH,SAAS,kBAAkB;IACzB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,OAAO,EACP,QAAQ,EACR,0CAA0C,EAC1C,iBAAiB,CAClB,CAAC;QACF,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,YAAY,GAAmB,CAAC,OAAO,EAAE,EAAE;IACtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAA6B,CAAC;IAElE,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;IAC5C,IAAI,cAAc,EAAE,CAAC;QACnB,uBAAuB,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACxD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin } from \"@azure/identity\";\nimport { NativeBrokerPlugin } from \"@azure/msal-node-extensions\";\nimport { existsSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\ninterface VSCodeCredentialControl {\n setVSCodeAuthRecordPath(path: string): void;\n setVSCodeBroker(nativeBroker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\ninterface AzurePluginContext {\n vsCodeCredentialControl: VSCodeCredentialControl;\n}\n\n/**\n * Finds the path to the VS Code authentication record file.\n * @returns The path to the authentication record file, or undefined if not found.\n */\nfunction findAuthRecordPath(): string | undefined {\n const homedir = os.homedir();\n const azureDirs = [\".azure\", \".Azure\"];\n\n for (const azureDir of azureDirs) {\n const authPath = path.join(\n homedir,\n azureDir,\n \"ms-azuretools.vscode-azureresourcegroups\",\n \"authRecord.json\",\n );\n if (existsSync(authPath)) {\n return authPath;\n }\n }\n return undefined;\n}\n\n/**\n * A plugin that provides the dependencies of `VisualStudioCodeCredential`\n * and enables it within `@azure/identity`. The plugin API is compatible with\n * `@azure/identity` versions 4.11.0 and later. Load this plugin using the\n * `useIdentityPlugin` function, imported from `@azure/identity`.\n *\n * To use this functionality, import `VisualStudioCodeCredential` or\n * `DefaultAzureCredential` from `@azure/identity`. If this plugin is not\n * enabled, then `VisualStudioCodeCredential` will throw a\n * `CredentialUnavailableError`, and `DefaultAzureCredential` will not be able\n * to use authentication through Visual Studio Code.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleVisualStudioCodeCredential\n * import { useIdentityPlugin, VisualStudioCodeCredential } from \"@azure/identity\";\n * import { vsCodePlugin } from \"@azure/identity-vscode\";\n *\n * useIdentityPlugin(vsCodePlugin);\n *\n * const credential = new VisualStudioCodeCredential();\n *\n * // The graph.microsoft.com scope is used as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substr(0, 10), \"...\");\n * ```\n */\nexport const vsCodePlugin: IdentityPlugin = (context) => {\n const { vsCodeCredentialControl } = context as AzurePluginContext;\n\n const authRecordPath = findAuthRecordPath();\n if (authRecordPath) {\n vsCodeCredentialControl.setVSCodeAuthRecordPath(authRecordPath);\n }\n\n const brokerPlugin = new NativeBrokerPlugin();\n vsCodeCredentialControl.setVSCodeBroker(brokerPlugin);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/identity-vscode",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"sdk-type": "client",
|
|
5
5
|
"description": "Use the Azure Account extension for Visual Studio Code to authenticate with Azure Identity",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -9,24 +9,18 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
11
11
|
"build:samples": "echo skipped",
|
|
12
|
-
"build:test": "echo skipped",
|
|
13
12
|
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
|
|
14
13
|
"clean": "dev-tool run vendored rimraf --glob dist dist-* types *.tgz *.log",
|
|
15
14
|
"execute:samples": "echo skipped",
|
|
16
15
|
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
|
|
17
16
|
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"integration-test:node": "echo skipped",
|
|
21
|
-
"lint": "eslint package.json api-extractor.json README.md src test",
|
|
22
|
-
"lint:fix": "eslint package.json api-extractor.json README.md src test --fix --fix-type [problem,suggestion]",
|
|
17
|
+
"lint": "eslint package.json src test",
|
|
18
|
+
"lint:fix": "eslint package.json src test --fix --fix-type [problem,suggestion]",
|
|
23
19
|
"pack": "npm pack 2>&1",
|
|
24
|
-
"test": "npm run
|
|
25
|
-
"test:browser": "
|
|
26
|
-
"test:node": "
|
|
27
|
-
"
|
|
28
|
-
"unit-test:browser": "echo skipped",
|
|
29
|
-
"unit-test:node": "echo skipped",
|
|
20
|
+
"test": "npm run test:node && npm run test:browser",
|
|
21
|
+
"test:browser": "echo skipped",
|
|
22
|
+
"test:node": "echo skipped",
|
|
23
|
+
"test:node:esm": "echo skipped",
|
|
30
24
|
"update-snippets": "dev-tool run update-snippets"
|
|
31
25
|
},
|
|
32
26
|
"files": [
|
|
@@ -35,7 +29,7 @@
|
|
|
35
29
|
"LICENSE"
|
|
36
30
|
],
|
|
37
31
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
32
|
+
"node": ">=20.0.0"
|
|
39
33
|
},
|
|
40
34
|
"repository": "github:Azure/azure-sdk-for-js",
|
|
41
35
|
"keywords": [
|
|
@@ -56,8 +50,9 @@
|
|
|
56
50
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode/README.md",
|
|
57
51
|
"sideEffects": false,
|
|
58
52
|
"dependencies": {
|
|
59
|
-
"@azure/identity": "
|
|
60
|
-
"
|
|
53
|
+
"@azure/identity": "4.11.0-beta.1",
|
|
54
|
+
"@azure/msal-node": "^3.2.2",
|
|
55
|
+
"@azure/msal-node-extensions": "^1.3.0",
|
|
61
56
|
"tslib": "^2.8.1"
|
|
62
57
|
},
|
|
63
58
|
"devDependencies": {
|
|
@@ -67,7 +62,7 @@
|
|
|
67
62
|
"@azure/dev-tool": "^1.0.0",
|
|
68
63
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
69
64
|
"@azure/logger": "^1.1.4",
|
|
70
|
-
"@types/node": "^
|
|
65
|
+
"@types/node": "^20.0.0",
|
|
71
66
|
"@vitest/browser": "^3.0.9",
|
|
72
67
|
"@vitest/coverage-istanbul": "^3.0.9",
|
|
73
68
|
"dotenv": "^16.0.0",
|