@codingame/monaco-vscode-authentication-service-override 25.1.1 → 26.0.0
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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForExtensionAction.js +59 -52
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForMcpServerAction.js +43 -43
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountsAction.js +50 -26
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageDynamicAuthenticationProvidersAction.js +19 -19
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction.js +41 -43
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.js +40 -40
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js +18 -12
- package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js +33 -27
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js +22 -23
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js +130 -78
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationQueryService.js +97 -65
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js +14 -17
- package/vscode/src/vs/workbench/services/authentication/browser/dynamicAuthenticationProviderStorageService.js +54 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - authentication service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -15,14 +15,14 @@ import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
15
15
|
class ManageAccountPreferencesForExtensionAction extends Action2 {
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
|
-
id:
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
18
|
+
id: "_manageAccountPreferencesForExtension",
|
|
19
|
+
title: ( localize2(4443, "Manage Extension Account Preferences...")),
|
|
20
|
+
category: ( localize2(4444, "Accounts")),
|
|
21
21
|
f1: true,
|
|
22
22
|
menu: [{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
id: MenuId.AccountsContext,
|
|
24
|
+
order: 100
|
|
25
|
+
}]
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
run(accessor, extensionId, providerId) {
|
|
@@ -30,7 +30,14 @@ class ManageAccountPreferencesForExtensionAction extends Action2 {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenceForExtensionActionImpl {
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(
|
|
34
|
+
_authenticationService,
|
|
35
|
+
_quickInputService,
|
|
36
|
+
_dialogService,
|
|
37
|
+
_authenticationQueryService,
|
|
38
|
+
_extensionService,
|
|
39
|
+
_logService
|
|
40
|
+
) {
|
|
34
41
|
this._authenticationService = _authenticationService;
|
|
35
42
|
this._quickInputService = _quickInputService;
|
|
36
43
|
this._dialogService = _dialogService;
|
|
@@ -40,15 +47,17 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
40
47
|
}
|
|
41
48
|
async run(extensionId, providerId) {
|
|
42
49
|
if (!extensionId) {
|
|
43
|
-
const extensions = this._extensionService.extensions
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
const extensions = this._extensionService.extensions.filter(
|
|
51
|
+
ext => this._authenticationQueryService.extension(ext.identifier.value).getAllAccountPreferences().size > 0
|
|
52
|
+
).sort(
|
|
53
|
+
(a, b) => (a.displayName ?? a.name).localeCompare((b.displayName ?? b.name))
|
|
54
|
+
);
|
|
46
55
|
const result = await this._quickInputService.pick(( extensions.map(ext => ({
|
|
47
56
|
label: ext.displayName ?? ext.name,
|
|
48
57
|
id: ext.identifier.value
|
|
49
58
|
}))), {
|
|
50
|
-
placeHolder: ( localize(
|
|
51
|
-
title: ( localize(
|
|
59
|
+
placeHolder: ( localize(4445, "Select an extension to manage account preferences for")),
|
|
60
|
+
title: ( localize(4446, "Manage Extension Account Preferences"))
|
|
52
61
|
});
|
|
53
62
|
extensionId = result?.id;
|
|
54
63
|
}
|
|
@@ -63,20 +72,20 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
63
72
|
const extensionQuery = this._authenticationQueryService.extension(extensionId);
|
|
64
73
|
const providersWithAccess = await extensionQuery.getProvidersWithAccess();
|
|
65
74
|
if (!providersWithAccess.length) {
|
|
66
|
-
await this._dialogService.info(( localize(
|
|
75
|
+
await this._dialogService.info(( localize(4447, "This extension has not used any accounts yet.")));
|
|
67
76
|
return;
|
|
68
77
|
}
|
|
69
78
|
providerId = providersWithAccess[0];
|
|
70
79
|
if (providersWithAccess.length > 1) {
|
|
71
80
|
const result = await this._quickInputService.pick(( providersWithAccess.map(providerId => ({
|
|
72
81
|
label: this._authenticationService.getProvider(providerId).label,
|
|
73
|
-
id: providerId
|
|
82
|
+
id: providerId
|
|
74
83
|
}))), {
|
|
75
84
|
placeHolder: ( localize(
|
|
76
|
-
|
|
85
|
+
4448,
|
|
77
86
|
"Select an authentication provider to manage account preferences for"
|
|
78
87
|
)),
|
|
79
|
-
title: ( localize(
|
|
88
|
+
title: ( localize(4446, "Manage Extension Account Preferences"))
|
|
80
89
|
});
|
|
81
90
|
if (!result) {
|
|
82
91
|
return;
|
|
@@ -89,20 +98,27 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
89
98
|
const items = this._getItems(accounts, providerId, currentAccountNamePreference);
|
|
90
99
|
const provider = this._authenticationService.getProvider(providerId);
|
|
91
100
|
if (provider.supportsMultipleAccounts) {
|
|
92
|
-
const lastUsedScopes = accounts
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
const lastUsedScopes = accounts.flatMap(
|
|
102
|
+
account => this._authenticationQueryService.provider(providerId).account(account.label).extension(extensionId).getUsage()
|
|
103
|
+
).sort((a, b) => b.lastUsed - a.lastUsed)[0]?.scopes;
|
|
95
104
|
if (lastUsedScopes) {
|
|
96
|
-
items.push({
|
|
105
|
+
items.push({
|
|
106
|
+
type: "separator"
|
|
107
|
+
});
|
|
97
108
|
items.push({
|
|
98
109
|
providerId,
|
|
99
110
|
scopes: lastUsedScopes,
|
|
100
|
-
label: ( localize(
|
|
111
|
+
label: ( localize(4449, "Use a new account..."))
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
114
|
}
|
|
104
115
|
const disposables = ( new DisposableStore());
|
|
105
|
-
const picker = this._createQuickPick(
|
|
116
|
+
const picker = this._createQuickPick(
|
|
117
|
+
disposables,
|
|
118
|
+
extensionId,
|
|
119
|
+
extension.displayName ?? extension.name,
|
|
120
|
+
provider.label
|
|
121
|
+
);
|
|
106
122
|
if (items.length === 0) {
|
|
107
123
|
disposables.add(this._handleNoAccounts(picker));
|
|
108
124
|
return;
|
|
@@ -111,17 +127,19 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
111
127
|
picker.show();
|
|
112
128
|
}
|
|
113
129
|
_createQuickPick(disposableStore, extensionId, extensionLabel, providerLabel) {
|
|
114
|
-
const picker = disposableStore.add(this._quickInputService.createQuickPick({
|
|
130
|
+
const picker = disposableStore.add(this._quickInputService.createQuickPick({
|
|
131
|
+
useSeparators: true
|
|
132
|
+
}));
|
|
115
133
|
disposableStore.add(picker.onDidHide(() => {
|
|
116
134
|
disposableStore.dispose();
|
|
117
135
|
}));
|
|
118
136
|
picker.placeholder = ( localize(
|
|
119
|
-
|
|
137
|
+
4450,
|
|
120
138
|
"Manage '{0}' account preferences for {1}...",
|
|
121
139
|
extensionLabel,
|
|
122
140
|
providerLabel
|
|
123
141
|
));
|
|
124
|
-
picker.title = ( localize(
|
|
142
|
+
picker.title = ( localize(4451, "'{0}' Account Preferences For This Workspace", extensionLabel));
|
|
125
143
|
picker.sortByLabel = false;
|
|
126
144
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
127
145
|
picker.hide();
|
|
@@ -130,25 +148,23 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
130
148
|
return picker;
|
|
131
149
|
}
|
|
132
150
|
_getItems(accounts, providerId, currentAccountNamePreference) {
|
|
133
|
-
return (accounts.map(a => currentAccountNamePreference === a.label
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
providerId,
|
|
145
|
-
}));
|
|
151
|
+
return (accounts.map(a => currentAccountNamePreference === a.label ? {
|
|
152
|
+
label: a.label,
|
|
153
|
+
account: a,
|
|
154
|
+
providerId,
|
|
155
|
+
description: ( localize(4452, "Current account")),
|
|
156
|
+
picked: true
|
|
157
|
+
} : {
|
|
158
|
+
label: a.label,
|
|
159
|
+
account: a,
|
|
160
|
+
providerId
|
|
161
|
+
}));
|
|
146
162
|
}
|
|
147
163
|
_handleNoAccounts(picker) {
|
|
148
|
-
picker.validationMessage = ( localize(
|
|
164
|
+
picker.validationMessage = ( localize(4453, "No accounts are currently used by this extension."));
|
|
149
165
|
picker.buttons = [this._quickInputService.backButton];
|
|
150
166
|
picker.show();
|
|
151
|
-
return Event.filter(picker.onDidTriggerButton,
|
|
167
|
+
return Event.filter(picker.onDidTriggerButton, e => e === this._quickInputService.backButton)(() => this.run());
|
|
152
168
|
}
|
|
153
169
|
async _accept(extensionId, selectedItems) {
|
|
154
170
|
for (const item of selectedItems) {
|
|
@@ -157,13 +173,11 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
157
173
|
try {
|
|
158
174
|
const session = await this._authenticationService.createSession(item.providerId, [...item.scopes]);
|
|
159
175
|
account = session.account;
|
|
160
|
-
}
|
|
161
|
-
catch (e) {
|
|
176
|
+
} catch (e) {
|
|
162
177
|
this._logService.error(e);
|
|
163
178
|
continue;
|
|
164
179
|
}
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
180
|
+
} else {
|
|
167
181
|
account = item.account;
|
|
168
182
|
}
|
|
169
183
|
const providerId = item.providerId;
|
|
@@ -176,13 +190,6 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
};
|
|
179
|
-
ManageAccountPreferenceForExtensionActionImpl = ( __decorate([
|
|
180
|
-
( __param(0, IAuthenticationService)),
|
|
181
|
-
( __param(1, IQuickInputService)),
|
|
182
|
-
( __param(2, IDialogService)),
|
|
183
|
-
( __param(3, IAuthenticationQueryService)),
|
|
184
|
-
( __param(4, IExtensionService)),
|
|
185
|
-
( __param(5, ILogService))
|
|
186
|
-
], ManageAccountPreferenceForExtensionActionImpl));
|
|
193
|
+
ManageAccountPreferenceForExtensionActionImpl = ( __decorate([( __param(0, IAuthenticationService)), ( __param(1, IQuickInputService)), ( __param(2, IDialogService)), ( __param(3, IAuthenticationQueryService)), ( __param(4, IExtensionService)), ( __param(5, ILogService))], ManageAccountPreferenceForExtensionActionImpl));
|
|
187
194
|
|
|
188
195
|
export { ManageAccountPreferencesForExtensionAction };
|
|
@@ -15,9 +15,9 @@ import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/co
|
|
|
15
15
|
class ManageAccountPreferencesForMcpServerAction extends Action2 {
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
|
-
id:
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
18
|
+
id: "_manageAccountPreferencesForMcpServer",
|
|
19
|
+
title: ( localize2(4454, "Manage MCP Server Account Preferences")),
|
|
20
|
+
category: ( localize2(4455, "Accounts")),
|
|
21
21
|
f1: false
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -26,7 +26,14 @@ class ManageAccountPreferencesForMcpServerAction extends Action2 {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenceForMcpServerActionImpl {
|
|
29
|
-
constructor(
|
|
29
|
+
constructor(
|
|
30
|
+
_authenticationService,
|
|
31
|
+
_quickInputService,
|
|
32
|
+
_dialogService,
|
|
33
|
+
_authenticationQueryService,
|
|
34
|
+
_mcpService,
|
|
35
|
+
_logService
|
|
36
|
+
) {
|
|
30
37
|
this._authenticationService = _authenticationService;
|
|
31
38
|
this._quickInputService = _quickInputService;
|
|
32
39
|
this._dialogService = _dialogService;
|
|
@@ -46,20 +53,20 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
46
53
|
const mcpServerQuery = this._authenticationQueryService.mcpServer(mcpServerId);
|
|
47
54
|
const providersWithAccess = await mcpServerQuery.getProvidersWithAccess();
|
|
48
55
|
if (!providersWithAccess.length) {
|
|
49
|
-
await this._dialogService.info(( localize(
|
|
56
|
+
await this._dialogService.info(( localize(4456, "This MCP server has not used any accounts yet.")));
|
|
50
57
|
return;
|
|
51
58
|
}
|
|
52
59
|
providerId = providersWithAccess[0];
|
|
53
60
|
if (providersWithAccess.length > 1) {
|
|
54
61
|
const result = await this._quickInputService.pick(( providersWithAccess.map(providerId => ({
|
|
55
62
|
label: this._authenticationService.getProvider(providerId).label,
|
|
56
|
-
id: providerId
|
|
63
|
+
id: providerId
|
|
57
64
|
}))), {
|
|
58
65
|
placeHolder: ( localize(
|
|
59
|
-
|
|
66
|
+
4457,
|
|
60
67
|
"Select an authentication provider to manage account preferences for"
|
|
61
68
|
)),
|
|
62
|
-
title: ( localize(
|
|
69
|
+
title: ( localize(4458, "Manage MCP Server Account Preferences"))
|
|
63
70
|
});
|
|
64
71
|
if (!result) {
|
|
65
72
|
return;
|
|
@@ -72,15 +79,17 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
72
79
|
const items = this._getItems(accounts, providerId, currentAccountNamePreference);
|
|
73
80
|
const provider = this._authenticationService.getProvider(providerId);
|
|
74
81
|
if (provider.supportsMultipleAccounts) {
|
|
75
|
-
const lastUsedScopes = accounts
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
const lastUsedScopes = accounts.flatMap(
|
|
83
|
+
account => this._authenticationQueryService.provider(providerId).account(account.label).mcpServer(mcpServerId).getUsage()
|
|
84
|
+
).sort((a, b) => b.lastUsed - a.lastUsed)[0]?.scopes;
|
|
78
85
|
if (lastUsedScopes) {
|
|
79
|
-
items.push({
|
|
86
|
+
items.push({
|
|
87
|
+
type: "separator"
|
|
88
|
+
});
|
|
80
89
|
items.push({
|
|
81
90
|
providerId: providerId,
|
|
82
91
|
scopes: lastUsedScopes,
|
|
83
|
-
label: ( localize(
|
|
92
|
+
label: ( localize(4459, "Use a new account..."))
|
|
84
93
|
});
|
|
85
94
|
}
|
|
86
95
|
}
|
|
@@ -94,17 +103,19 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
94
103
|
picker.show();
|
|
95
104
|
}
|
|
96
105
|
_createQuickPick(disposableStore, mcpServerId, mcpServerLabel, providerLabel) {
|
|
97
|
-
const picker = disposableStore.add(this._quickInputService.createQuickPick({
|
|
106
|
+
const picker = disposableStore.add(this._quickInputService.createQuickPick({
|
|
107
|
+
useSeparators: true
|
|
108
|
+
}));
|
|
98
109
|
disposableStore.add(picker.onDidHide(() => {
|
|
99
110
|
disposableStore.dispose();
|
|
100
111
|
}));
|
|
101
112
|
picker.placeholder = ( localize(
|
|
102
|
-
|
|
113
|
+
4460,
|
|
103
114
|
"Manage '{0}' account preferences for {1}...",
|
|
104
115
|
mcpServerLabel,
|
|
105
116
|
providerLabel
|
|
106
117
|
));
|
|
107
|
-
picker.title = ( localize(
|
|
118
|
+
picker.title = ( localize(4461, "'{0}' Account Preferences For This Workspace", mcpServerLabel));
|
|
108
119
|
picker.sortByLabel = false;
|
|
109
120
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
110
121
|
picker.hide();
|
|
@@ -113,25 +124,23 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
113
124
|
return picker;
|
|
114
125
|
}
|
|
115
126
|
_getItems(accounts, providerId, currentAccountNamePreference) {
|
|
116
|
-
return (accounts.map(a => currentAccountNamePreference === a.label
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
providerId,
|
|
128
|
-
}));
|
|
127
|
+
return (accounts.map(a => currentAccountNamePreference === a.label ? {
|
|
128
|
+
label: a.label,
|
|
129
|
+
account: a,
|
|
130
|
+
providerId,
|
|
131
|
+
description: ( localize(4462, "Current account")),
|
|
132
|
+
picked: true
|
|
133
|
+
} : {
|
|
134
|
+
label: a.label,
|
|
135
|
+
account: a,
|
|
136
|
+
providerId
|
|
137
|
+
}));
|
|
129
138
|
}
|
|
130
139
|
_handleNoAccounts(picker) {
|
|
131
|
-
picker.validationMessage = ( localize(
|
|
140
|
+
picker.validationMessage = ( localize(4463, "No accounts are currently used by this MCP server."));
|
|
132
141
|
picker.buttons = [this._quickInputService.backButton];
|
|
133
142
|
picker.show();
|
|
134
|
-
return Event.filter(picker.onDidTriggerButton,
|
|
143
|
+
return Event.filter(picker.onDidTriggerButton, e => e === this._quickInputService.backButton)(() => this.run());
|
|
135
144
|
}
|
|
136
145
|
async _accept(mcpServerId, selectedItems) {
|
|
137
146
|
for (const item of selectedItems) {
|
|
@@ -140,13 +149,11 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
140
149
|
try {
|
|
141
150
|
const session = await this._authenticationService.createSession(item.providerId, [...item.scopes]);
|
|
142
151
|
account = session.account;
|
|
143
|
-
}
|
|
144
|
-
catch (e) {
|
|
152
|
+
} catch (e) {
|
|
145
153
|
this._logService.error(e);
|
|
146
154
|
continue;
|
|
147
155
|
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
156
|
+
} else {
|
|
150
157
|
account = item.account;
|
|
151
158
|
}
|
|
152
159
|
const providerId = item.providerId;
|
|
@@ -159,13 +166,6 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
159
166
|
}
|
|
160
167
|
}
|
|
161
168
|
};
|
|
162
|
-
ManageAccountPreferenceForMcpServerActionImpl = ( __decorate([
|
|
163
|
-
( __param(0, IAuthenticationService)),
|
|
164
|
-
( __param(1, IQuickInputService)),
|
|
165
|
-
( __param(2, IDialogService)),
|
|
166
|
-
( __param(3, IAuthenticationQueryService)),
|
|
167
|
-
( __param(4, IMcpService)),
|
|
168
|
-
( __param(5, ILogService))
|
|
169
|
-
], ManageAccountPreferenceForMcpServerActionImpl));
|
|
169
|
+
ManageAccountPreferenceForMcpServerActionImpl = ( __decorate([( __param(0, IAuthenticationService)), ( __param(1, IQuickInputService)), ( __param(2, IDialogService)), ( __param(3, IAuthenticationQueryService)), ( __param(4, IMcpService)), ( __param(5, ILogService))], ManageAccountPreferenceForMcpServerActionImpl));
|
|
170
170
|
|
|
171
171
|
export { ManageAccountPreferencesForMcpServerAction };
|
package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountsAction.js
CHANGED
|
@@ -15,9 +15,9 @@ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
15
15
|
class ManageAccountsAction extends Action2 {
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
|
-
id:
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
18
|
+
id: "workbench.action.manageAccounts",
|
|
19
|
+
title: ( localize2(4464, "Manage Accounts")),
|
|
20
|
+
category: ( localize2(4465, "Accounts")),
|
|
21
21
|
f1: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -27,7 +27,13 @@ class ManageAccountsAction extends Action2 {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
30
|
-
constructor(
|
|
30
|
+
constructor(
|
|
31
|
+
quickInputService,
|
|
32
|
+
authenticationService,
|
|
33
|
+
commandService,
|
|
34
|
+
secretStorageService,
|
|
35
|
+
productService
|
|
36
|
+
) {
|
|
31
37
|
this.quickInputService = quickInputService;
|
|
32
38
|
this.authenticationService = authenticationService;
|
|
33
39
|
this.commandService = commandService;
|
|
@@ -35,13 +41,20 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
35
41
|
this.productService = productService;
|
|
36
42
|
}
|
|
37
43
|
async run() {
|
|
38
|
-
const placeHolder = ( localize(
|
|
44
|
+
const placeHolder = ( localize(4466, "Select an account to manage"));
|
|
39
45
|
const accounts = await this.listAccounts();
|
|
40
46
|
if (!accounts.length) {
|
|
41
|
-
await this.quickInputService.pick([{
|
|
47
|
+
await this.quickInputService.pick([{
|
|
48
|
+
label: ( localize(4467, "There are no active accounts."))
|
|
49
|
+
}], {
|
|
50
|
+
placeHolder
|
|
51
|
+
});
|
|
42
52
|
return;
|
|
43
53
|
}
|
|
44
|
-
const account = await this.quickInputService.pick(accounts, {
|
|
54
|
+
const account = await this.quickInputService.pick(accounts, {
|
|
55
|
+
placeHolder,
|
|
56
|
+
matchOnDescription: true
|
|
57
|
+
});
|
|
45
58
|
if (!account) {
|
|
46
59
|
return;
|
|
47
60
|
}
|
|
@@ -54,7 +67,10 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
54
67
|
const accounts = [];
|
|
55
68
|
for (const providerId of this.authenticationService.getProviderIds()) {
|
|
56
69
|
const provider = this.authenticationService.getProvider(providerId);
|
|
57
|
-
for (const {
|
|
70
|
+
for (const {
|
|
71
|
+
label,
|
|
72
|
+
id
|
|
73
|
+
} of await this.authenticationService.getAccounts(providerId)) {
|
|
58
74
|
accounts.push({
|
|
59
75
|
label,
|
|
60
76
|
description: provider.label,
|
|
@@ -74,26 +90,40 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
74
90
|
return true;
|
|
75
91
|
}
|
|
76
92
|
async showAccountActions(account) {
|
|
77
|
-
const {
|
|
93
|
+
const {
|
|
94
|
+
providerId,
|
|
95
|
+
label: accountLabel,
|
|
96
|
+
canUseMcp,
|
|
97
|
+
canSignOut
|
|
98
|
+
} = account;
|
|
78
99
|
const store = ( new DisposableStore());
|
|
79
100
|
const quickPick = store.add(this.quickInputService.createQuickPick());
|
|
80
|
-
quickPick.title = ( localize(
|
|
81
|
-
quickPick.placeholder = ( localize(
|
|
101
|
+
quickPick.title = ( localize(4468, "Manage '{0}'", accountLabel));
|
|
102
|
+
quickPick.placeholder = ( localize(4469, "Select an action"));
|
|
82
103
|
quickPick.buttons = [this.quickInputService.backButton];
|
|
83
104
|
const items = [{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
label: ( localize(4470, "Manage Trusted Extensions")),
|
|
106
|
+
action: () => this.commandService.executeCommand("_manageTrustedExtensionsForAccount", {
|
|
107
|
+
providerId,
|
|
108
|
+
accountLabel
|
|
109
|
+
})
|
|
110
|
+
}];
|
|
87
111
|
if (canUseMcp) {
|
|
88
112
|
items.push({
|
|
89
|
-
label: ( localize(
|
|
90
|
-
action: () => this.commandService.executeCommand(
|
|
113
|
+
label: ( localize(4471, "Manage Trusted MCP Servers")),
|
|
114
|
+
action: () => this.commandService.executeCommand("_manageTrustedMCPServersForAccount", {
|
|
115
|
+
providerId,
|
|
116
|
+
accountLabel
|
|
117
|
+
})
|
|
91
118
|
});
|
|
92
119
|
}
|
|
93
120
|
if (await canSignOut()) {
|
|
94
121
|
items.push({
|
|
95
|
-
label: ( localize(
|
|
96
|
-
action: () => this.commandService.executeCommand(
|
|
122
|
+
label: ( localize(4472, "Sign Out")),
|
|
123
|
+
action: () => this.commandService.executeCommand("_signOutOfAccount", {
|
|
124
|
+
providerId,
|
|
125
|
+
accountLabel
|
|
126
|
+
})
|
|
97
127
|
});
|
|
98
128
|
}
|
|
99
129
|
quickPick.items = items;
|
|
@@ -104,7 +134,7 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
104
134
|
selected.action();
|
|
105
135
|
}
|
|
106
136
|
}));
|
|
107
|
-
store.add(quickPick.onDidTriggerButton(
|
|
137
|
+
store.add(quickPick.onDidTriggerButton(button => {
|
|
108
138
|
if (button === this.quickInputService.backButton) {
|
|
109
139
|
void this.run();
|
|
110
140
|
}
|
|
@@ -113,12 +143,6 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
113
143
|
quickPick.show();
|
|
114
144
|
}
|
|
115
145
|
};
|
|
116
|
-
ManageAccountsActionImpl = ( __decorate([
|
|
117
|
-
( __param(0, IQuickInputService)),
|
|
118
|
-
( __param(1, IAuthenticationService)),
|
|
119
|
-
( __param(2, ICommandService)),
|
|
120
|
-
( __param(3, ISecretStorageService)),
|
|
121
|
-
( __param(4, IProductService))
|
|
122
|
-
], ManageAccountsActionImpl));
|
|
146
|
+
ManageAccountsActionImpl = ( __decorate([( __param(0, IQuickInputService)), ( __param(1, IAuthenticationService)), ( __param(2, ICommandService)), ( __param(3, ISecretStorageService)), ( __param(4, IProductService))], ManageAccountsActionImpl));
|
|
123
147
|
|
|
124
148
|
export { ManageAccountsAction };
|
|
@@ -7,12 +7,14 @@ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
7
7
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
8
8
|
|
|
9
9
|
class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
10
|
-
static {
|
|
10
|
+
static {
|
|
11
|
+
this.ID = "workbench.action.removeDynamicAuthenticationProviders";
|
|
12
|
+
}
|
|
11
13
|
constructor() {
|
|
12
14
|
super({
|
|
13
15
|
id: RemoveDynamicAuthenticationProvidersAction.ID,
|
|
14
|
-
title: ( localize2(
|
|
15
|
-
category: ( localize2(
|
|
16
|
+
title: ( localize2(4473, "Remove Dynamic Authentication Providers")),
|
|
17
|
+
category: ( localize2(4474, "Authentication")),
|
|
16
18
|
f1: true
|
|
17
19
|
});
|
|
18
20
|
}
|
|
@@ -23,42 +25,40 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
23
25
|
const dialogService = accessor.get(IDialogService);
|
|
24
26
|
const interactedProviders = dynamicAuthStorageService.getInteractedProviders();
|
|
25
27
|
if (interactedProviders.length === 0) {
|
|
26
|
-
await dialogService.info(( localize(
|
|
28
|
+
await dialogService.info(( localize(4475, "No dynamic authentication providers")), ( localize(4476, "No dynamic authentication providers have been used yet.")));
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
31
|
const items = ( interactedProviders.map(provider => ({
|
|
30
32
|
label: provider.label,
|
|
31
|
-
description: ( localize(
|
|
33
|
+
description: ( localize(4477, "Client ID: {0}", provider.clientId)),
|
|
32
34
|
provider
|
|
33
35
|
})));
|
|
34
36
|
const selected = await quickInputService.pick(items, {
|
|
35
|
-
placeHolder: ( localize(
|
|
37
|
+
placeHolder: ( localize(4478, "Select a dynamic authentication provider to remove")),
|
|
36
38
|
canPickMany: true
|
|
37
39
|
});
|
|
38
40
|
if (!selected || selected.length === 0) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
|
-
const providerNames = ( selected.map(item => item.provider.label)).join(
|
|
42
|
-
const message = selected.length === 1
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'Are you sure you want to remove the dynamic authentication provider "{0}"?',
|
|
43
|
+
const providerNames = ( selected.map(item => item.provider.label)).join(", ");
|
|
44
|
+
const message = selected.length === 1 ? ( localize(
|
|
45
|
+
4479,
|
|
46
|
+
"Are you sure you want to remove the dynamic authentication provider \"{0}\"?",
|
|
46
47
|
providerNames
|
|
47
|
-
))
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'Are you sure you want to remove {0} dynamic authentication providers: {1}?',
|
|
48
|
+
)) : ( localize(
|
|
49
|
+
4480,
|
|
50
|
+
"Are you sure you want to remove {0} dynamic authentication providers: {1}?",
|
|
51
51
|
selected.length,
|
|
52
52
|
providerNames
|
|
53
53
|
));
|
|
54
54
|
const result = await dialogService.confirm({
|
|
55
55
|
message,
|
|
56
56
|
detail: ( localize(
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
4481,
|
|
58
|
+
"This will remove all stored authentication data for the selected provider(s). You will need to re-authenticate if you use these providers again."
|
|
59
59
|
)),
|
|
60
|
-
primaryButton: ( localize(
|
|
61
|
-
type:
|
|
60
|
+
primaryButton: ( localize(4482, "Remove")),
|
|
61
|
+
type: "warning"
|
|
62
62
|
});
|
|
63
63
|
if (!result.confirmed) {
|
|
64
64
|
return;
|