@codingame/monaco-vscode-authentication-service-override 25.1.2 → 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
|
@@ -18,9 +18,9 @@ import { IExtensionsWorkbenchService } from '@codingame/monaco-vscode-api/vscode
|
|
|
18
18
|
class ManageTrustedExtensionsForAccountAction extends Action2 {
|
|
19
19
|
constructor() {
|
|
20
20
|
super({
|
|
21
|
-
id:
|
|
22
|
-
title: ( localize2(
|
|
23
|
-
category: ( localize2(
|
|
21
|
+
id: "_manageTrustedExtensionsForAccount",
|
|
22
|
+
title: ( localize2(4483, "Manage Trusted Extensions For Account")),
|
|
23
|
+
category: ( localize2(4484, "Accounts")),
|
|
24
24
|
f1: true
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -30,7 +30,15 @@ class ManageTrustedExtensionsForAccountAction extends Action2 {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsForAccountActionImpl {
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(
|
|
34
|
+
_extensionService,
|
|
35
|
+
_dialogService,
|
|
36
|
+
_quickInputService,
|
|
37
|
+
_authenticationService,
|
|
38
|
+
_authenticationQueryService,
|
|
39
|
+
_commandService,
|
|
40
|
+
_extensionsWorkbenchService
|
|
41
|
+
) {
|
|
34
42
|
this._extensionService = _extensionService;
|
|
35
43
|
this._dialogService = _dialogService;
|
|
36
44
|
this._quickInputService = _quickInputService;
|
|
@@ -39,12 +47,12 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
39
47
|
this._commandService = _commandService;
|
|
40
48
|
this._extensionsWorkbenchService = _extensionsWorkbenchService;
|
|
41
49
|
this._viewDetailsButton = {
|
|
42
|
-
tooltip: ( localize(
|
|
43
|
-
iconClass: ThemeIcon.asClassName(Codicon.info)
|
|
50
|
+
tooltip: ( localize(4485, "View extension details")),
|
|
51
|
+
iconClass: ThemeIcon.asClassName(Codicon.info)
|
|
44
52
|
};
|
|
45
53
|
this._managePreferencesButton = {
|
|
46
|
-
tooltip: ( localize(
|
|
47
|
-
iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
|
|
54
|
+
tooltip: ( localize(4486, "Manage account preferences for this extension")),
|
|
55
|
+
iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
async run(options) {
|
|
@@ -58,7 +66,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
58
66
|
}
|
|
59
67
|
const picker = this._createQuickPick(accountQuery);
|
|
60
68
|
picker.items = items;
|
|
61
|
-
picker.selectedItems = items.filter(
|
|
69
|
+
picker.selectedItems = items.filter(i => i.type !== "separator" && !!i.picked);
|
|
62
70
|
picker.show();
|
|
63
71
|
}
|
|
64
72
|
async _resolveAccountQuery(providerId, accountLabel) {
|
|
@@ -67,8 +75,8 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
67
75
|
}
|
|
68
76
|
const accounts = await this._getAllAvailableAccounts();
|
|
69
77
|
const pick = await this._quickInputService.pick(accounts, {
|
|
70
|
-
placeHolder: ( localize(
|
|
71
|
-
matchOnDescription: true
|
|
78
|
+
placeHolder: ( localize(4487, "Pick an account to manage trusted extensions for")),
|
|
79
|
+
matchOnDescription: true
|
|
72
80
|
});
|
|
73
81
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
74
82
|
}
|
|
@@ -100,9 +108,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
100
108
|
extensionIdToDisplayName.set(allowedExtensions[i].id, resolved.displayName || resolved.name);
|
|
101
109
|
}
|
|
102
110
|
});
|
|
103
|
-
const filteredExtensions = ( allowedExtensions
|
|
104
|
-
.filter(ext => ( extensionIdToDisplayName.has(ext.id)))
|
|
105
|
-
.map(ext => {
|
|
111
|
+
const filteredExtensions = ( allowedExtensions.filter(ext => ( extensionIdToDisplayName.has(ext.id))).map(ext => {
|
|
106
112
|
const usage = accountQuery.extension(ext.id).getUsage();
|
|
107
113
|
return {
|
|
108
114
|
...ext,
|
|
@@ -111,29 +117,26 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
111
117
|
};
|
|
112
118
|
}));
|
|
113
119
|
if (!filteredExtensions.length) {
|
|
114
|
-
this._dialogService.info(( localize(
|
|
120
|
+
this._dialogService.info(( localize(4488, "This account has not been used by any extensions.")));
|
|
115
121
|
return [];
|
|
116
122
|
}
|
|
117
123
|
const trustedExtensions = filteredExtensions.filter(e => e.trusted);
|
|
118
124
|
const otherExtensions = filteredExtensions.filter(e => !e.trusted);
|
|
119
125
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
120
126
|
const _toQuickPickItem = this._toQuickPickItem.bind(this);
|
|
121
|
-
return [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
];
|
|
127
|
+
return [...( otherExtensions.sort(sortByLastUsed).map(_toQuickPickItem)), {
|
|
128
|
+
type: "separator",
|
|
129
|
+
label: ( localize(4489, "Trusted by Microsoft"))
|
|
130
|
+
}, ...( trustedExtensions.sort(sortByLastUsed).map(_toQuickPickItem))];
|
|
126
131
|
}
|
|
127
132
|
_toQuickPickItem(extension) {
|
|
128
133
|
const lastUsed = extension.lastUsed;
|
|
129
|
-
const description = lastUsed
|
|
130
|
-
? ( localize(4480, "Last used this account {0}", fromNow(lastUsed, true)))
|
|
131
|
-
: ( localize(4481, "Has not used this account"));
|
|
134
|
+
const description = lastUsed ? ( localize(4490, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(4491, "Has not used this account"));
|
|
132
135
|
let tooltip;
|
|
133
136
|
let disabled;
|
|
134
137
|
if (extension.trusted) {
|
|
135
138
|
tooltip = ( localize(
|
|
136
|
-
|
|
139
|
+
4492,
|
|
137
140
|
"This extension is trusted by Microsoft and\nalways has access to this account"
|
|
138
141
|
));
|
|
139
142
|
disabled = true;
|
|
@@ -150,17 +153,17 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
150
153
|
}
|
|
151
154
|
_createQuickPick(accountQuery) {
|
|
152
155
|
const disposableStore = ( new DisposableStore());
|
|
153
|
-
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({
|
|
156
|
+
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({
|
|
157
|
+
useSeparators: true
|
|
158
|
+
}));
|
|
154
159
|
quickPick.canSelectMany = true;
|
|
155
160
|
quickPick.customButton = true;
|
|
156
|
-
quickPick.customLabel = ( localize(
|
|
161
|
+
quickPick.customLabel = ( localize(4493, "Cancel"));
|
|
157
162
|
quickPick.customButtonSecondary = true;
|
|
158
|
-
quickPick.title = ( localize(
|
|
159
|
-
quickPick.placeholder = ( localize(
|
|
163
|
+
quickPick.title = ( localize(4494, "Manage Trusted Extensions"));
|
|
164
|
+
quickPick.placeholder = ( localize(4495, "Choose which extensions can access this account"));
|
|
160
165
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
161
|
-
const updatedAllowedList = ( quickPick.items
|
|
162
|
-
.filter((item) => item.type !== 'separator')
|
|
163
|
-
.map(i => i.extension));
|
|
166
|
+
const updatedAllowedList = ( quickPick.items.filter(item => item.type !== "separator").map(i => i.extension));
|
|
164
167
|
const allowedExtensionsSet = ( new Set(( quickPick.selectedItems.map(i => i.extension))));
|
|
165
168
|
for (const extension of updatedAllowedList) {
|
|
166
169
|
const allowed = ( allowedExtensionsSet.has(extension));
|
|
@@ -172,23 +175,18 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
172
175
|
disposableStore.add(quickPick.onDidCustom(() => quickPick.hide()));
|
|
173
176
|
disposableStore.add(quickPick.onDidTriggerItemButton(e => {
|
|
174
177
|
if (e.button === this._managePreferencesButton) {
|
|
175
|
-
this._commandService.executeCommand(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
this._commandService.executeCommand(
|
|
179
|
+
"_manageAccountPreferencesForExtension",
|
|
180
|
+
e.item.extension.id,
|
|
181
|
+
accountQuery.providerId
|
|
182
|
+
);
|
|
183
|
+
} else if (e.button === this._viewDetailsButton) {
|
|
178
184
|
this._extensionsWorkbenchService.open(e.item.extension.id);
|
|
179
185
|
}
|
|
180
186
|
}));
|
|
181
187
|
return quickPick;
|
|
182
188
|
}
|
|
183
189
|
};
|
|
184
|
-
ManageTrustedExtensionsForAccountActionImpl = ( __decorate([
|
|
185
|
-
( __param(0, IExtensionService)),
|
|
186
|
-
( __param(1, IDialogService)),
|
|
187
|
-
( __param(2, IQuickInputService)),
|
|
188
|
-
( __param(3, IAuthenticationService)),
|
|
189
|
-
( __param(4, IAuthenticationQueryService)),
|
|
190
|
-
( __param(5, ICommandService)),
|
|
191
|
-
( __param(6, IExtensionsWorkbenchService))
|
|
192
|
-
], ManageTrustedExtensionsForAccountActionImpl));
|
|
190
|
+
ManageTrustedExtensionsForAccountActionImpl = ( __decorate([( __param(0, IExtensionService)), ( __param(1, IDialogService)), ( __param(2, IQuickInputService)), ( __param(3, IAuthenticationService)), ( __param(4, IAuthenticationQueryService)), ( __param(5, ICommandService)), ( __param(6, IExtensionsWorkbenchService))], ManageTrustedExtensionsForAccountActionImpl));
|
|
193
191
|
|
|
194
192
|
export { ManageTrustedExtensionsForAccountAction };
|
|
@@ -18,9 +18,9 @@ import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/co
|
|
|
18
18
|
class ManageTrustedMcpServersForAccountAction extends Action2 {
|
|
19
19
|
constructor() {
|
|
20
20
|
super({
|
|
21
|
-
id:
|
|
22
|
-
title: ( localize2(
|
|
23
|
-
category: ( localize2(
|
|
21
|
+
id: "_manageTrustedMCPServersForAccount",
|
|
22
|
+
title: ( localize2(4496, "Manage Trusted MCP Servers For Account")),
|
|
23
|
+
category: ( localize2(4497, "Accounts")),
|
|
24
24
|
f1: true,
|
|
25
25
|
precondition: ( ChatContextKeys.Setup.hidden.negate())
|
|
26
26
|
});
|
|
@@ -31,7 +31,14 @@ class ManageTrustedMcpServersForAccountAction extends Action2 {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersForAccountActionImpl {
|
|
34
|
-
constructor(
|
|
34
|
+
constructor(
|
|
35
|
+
_mcpServerService,
|
|
36
|
+
_dialogService,
|
|
37
|
+
_quickInputService,
|
|
38
|
+
_mcpServerAuthenticationService,
|
|
39
|
+
_authenticationQueryService,
|
|
40
|
+
_commandService
|
|
41
|
+
) {
|
|
35
42
|
this._mcpServerService = _mcpServerService;
|
|
36
43
|
this._dialogService = _dialogService;
|
|
37
44
|
this._quickInputService = _quickInputService;
|
|
@@ -50,7 +57,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
50
57
|
}
|
|
51
58
|
const picker = this._createQuickPick(accountQuery);
|
|
52
59
|
picker.items = items;
|
|
53
|
-
picker.selectedItems = items.filter(
|
|
60
|
+
picker.selectedItems = items.filter(i => i.type !== "separator" && !!i.picked);
|
|
54
61
|
picker.show();
|
|
55
62
|
}
|
|
56
63
|
async _resolveAccountQuery(providerId, accountLabel) {
|
|
@@ -59,8 +66,8 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
59
66
|
}
|
|
60
67
|
const accounts = await this._getAllAvailableAccounts();
|
|
61
68
|
const pick = await this._quickInputService.pick(accounts, {
|
|
62
|
-
placeHolder: ( localize(
|
|
63
|
-
matchOnDescription: true
|
|
69
|
+
placeHolder: ( localize(4498, "Pick an account to manage trusted MCP servers for")),
|
|
70
|
+
matchOnDescription: true
|
|
64
71
|
});
|
|
65
72
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
66
73
|
}
|
|
@@ -86,9 +93,8 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
86
93
|
async _getItems(accountQuery) {
|
|
87
94
|
const allowedMcpServers = accountQuery.mcpServers().getAllowedMcpServers();
|
|
88
95
|
const serverIdToLabel = ( new Map(( this._mcpServerService.servers.get().map(s => [s.definition.id, s.definition.label]))));
|
|
89
|
-
const filteredMcpServers = (
|
|
90
|
-
|
|
91
|
-
.map(server => {
|
|
96
|
+
const filteredMcpServers = (
|
|
97
|
+
allowedMcpServers.filter(server => ( serverIdToLabel.has(server.id))).map(server => {
|
|
92
98
|
const usage = accountQuery.mcpServer(server.id).getUsage();
|
|
93
99
|
return {
|
|
94
100
|
...server,
|
|
@@ -97,28 +103,25 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
97
103
|
};
|
|
98
104
|
}));
|
|
99
105
|
if (!filteredMcpServers.length) {
|
|
100
|
-
this._dialogService.info(( localize(
|
|
106
|
+
this._dialogService.info(( localize(4499, "This account has not been used by any MCP servers.")));
|
|
101
107
|
return [];
|
|
102
108
|
}
|
|
103
109
|
const trustedServers = filteredMcpServers.filter(s => s.trusted);
|
|
104
110
|
const otherServers = filteredMcpServers.filter(s => !s.trusted);
|
|
105
111
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
106
|
-
return [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
];
|
|
112
|
+
return [...( otherServers.sort(sortByLastUsed).map(this._toQuickPickItem)), {
|
|
113
|
+
type: "separator",
|
|
114
|
+
label: ( localize(4500, "Trusted by Microsoft"))
|
|
115
|
+
}, ...( trustedServers.sort(sortByLastUsed).map(this._toQuickPickItem))];
|
|
111
116
|
}
|
|
112
117
|
_toQuickPickItem(mcpServer) {
|
|
113
118
|
const lastUsed = mcpServer.lastUsed;
|
|
114
|
-
const description = lastUsed
|
|
115
|
-
? ( localize(4491, "Last used this account {0}", fromNow(lastUsed, true)))
|
|
116
|
-
: ( localize(4492, "Has not used this account"));
|
|
119
|
+
const description = lastUsed ? ( localize(4501, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(4502, "Has not used this account"));
|
|
117
120
|
let tooltip;
|
|
118
121
|
let disabled;
|
|
119
122
|
if (mcpServer.trusted) {
|
|
120
123
|
tooltip = ( localize(
|
|
121
|
-
|
|
124
|
+
4503,
|
|
122
125
|
"This MCP server is trusted by Microsoft and\nalways has access to this account"
|
|
123
126
|
));
|
|
124
127
|
disabled = true;
|
|
@@ -130,27 +133,27 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
130
133
|
tooltip,
|
|
131
134
|
disabled,
|
|
132
135
|
buttons: [{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
tooltip: ( localize(4504, "Manage account preferences for this MCP server")),
|
|
137
|
+
iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
|
|
138
|
+
}],
|
|
136
139
|
picked: mcpServer.allowed === undefined || mcpServer.allowed
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
142
|
_createQuickPick(accountQuery) {
|
|
140
143
|
const disposableStore = ( new DisposableStore());
|
|
141
|
-
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({
|
|
144
|
+
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({
|
|
145
|
+
useSeparators: true
|
|
146
|
+
}));
|
|
142
147
|
quickPick.canSelectMany = true;
|
|
143
148
|
quickPick.customButton = true;
|
|
144
|
-
quickPick.customLabel = ( localize(
|
|
149
|
+
quickPick.customLabel = ( localize(4505, "Cancel"));
|
|
145
150
|
quickPick.customButtonSecondary = true;
|
|
146
|
-
quickPick.title = ( localize(
|
|
147
|
-
quickPick.placeholder = ( localize(
|
|
151
|
+
quickPick.title = ( localize(4506, "Manage Trusted MCP Servers"));
|
|
152
|
+
quickPick.placeholder = ( localize(4507, "Choose which MCP servers can access this account"));
|
|
148
153
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
149
154
|
quickPick.hide();
|
|
150
|
-
const allServers = ( quickPick.items
|
|
151
|
-
|
|
152
|
-
.map((i) => i.mcpServer));
|
|
153
|
-
const selectedServers = ( new Set(( quickPick.selectedItems.map((i) => i.mcpServer))));
|
|
155
|
+
const allServers = ( quickPick.items.filter(item => item.type !== "separator").map(i => i.mcpServer));
|
|
156
|
+
const selectedServers = ( new Set(( quickPick.selectedItems.map(i => i.mcpServer))));
|
|
154
157
|
for (const mcpServer of allServers) {
|
|
155
158
|
const isAllowed = ( selectedServers.has(mcpServer));
|
|
156
159
|
accountQuery.mcpServer(mcpServer.id).setAccessAllowed(isAllowed, mcpServer.name);
|
|
@@ -158,17 +161,14 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
158
161
|
}));
|
|
159
162
|
disposableStore.add(quickPick.onDidHide(() => disposableStore.dispose()));
|
|
160
163
|
disposableStore.add(quickPick.onDidCustom(() => quickPick.hide()));
|
|
161
|
-
disposableStore.add(quickPick.onDidTriggerItemButton(
|
|
164
|
+
disposableStore.add(quickPick.onDidTriggerItemButton(e => this._commandService.executeCommand(
|
|
165
|
+
"_manageAccountPreferencesForMcpServer",
|
|
166
|
+
e.item.mcpServer.id,
|
|
167
|
+
accountQuery.providerId
|
|
168
|
+
)));
|
|
162
169
|
return quickPick;
|
|
163
170
|
}
|
|
164
171
|
};
|
|
165
|
-
ManageTrustedMcpServersForAccountActionImpl = ( __decorate([
|
|
166
|
-
( __param(0, IMcpService)),
|
|
167
|
-
( __param(1, IDialogService)),
|
|
168
|
-
( __param(2, IQuickInputService)),
|
|
169
|
-
( __param(3, IAuthenticationService)),
|
|
170
|
-
( __param(4, IAuthenticationQueryService)),
|
|
171
|
-
( __param(5, ICommandService))
|
|
172
|
-
], ManageTrustedMcpServersForAccountActionImpl));
|
|
172
|
+
ManageTrustedMcpServersForAccountActionImpl = ( __decorate([( __param(0, IMcpService)), ( __param(1, IDialogService)), ( __param(2, IQuickInputService)), ( __param(3, IAuthenticationService)), ( __param(4, IAuthenticationQueryService)), ( __param(5, ICommandService))], ManageTrustedMcpServersForAccountActionImpl));
|
|
173
173
|
|
|
174
174
|
export { ManageTrustedMcpServersForAccountAction };
|
package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js
CHANGED
|
@@ -10,35 +10,41 @@ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
10
10
|
class SignOutOfAccountAction extends Action2 {
|
|
11
11
|
constructor() {
|
|
12
12
|
super({
|
|
13
|
-
id:
|
|
14
|
-
title: ( localize(
|
|
13
|
+
id: "_signOutOfAccount",
|
|
14
|
+
title: ( localize(4508, "Sign out of account")),
|
|
15
15
|
f1: false
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
async run(
|
|
18
|
+
async run(
|
|
19
|
+
accessor,
|
|
20
|
+
{
|
|
21
|
+
providerId,
|
|
22
|
+
accountLabel
|
|
23
|
+
}
|
|
24
|
+
) {
|
|
19
25
|
const authenticationService = accessor.get(IAuthenticationService);
|
|
20
26
|
const authenticationUsageService = accessor.get(IAuthenticationUsageService);
|
|
21
27
|
const authenticationAccessService = accessor.get(IAuthenticationAccessService);
|
|
22
28
|
const dialogService = accessor.get(IDialogService);
|
|
23
29
|
if (!providerId || !accountLabel) {
|
|
24
30
|
throw ( new Error(
|
|
25
|
-
|
|
31
|
+
"Invalid arguments. Expected: { providerId: string; accountLabel: string }"
|
|
26
32
|
));
|
|
27
33
|
}
|
|
28
34
|
const allSessions = await authenticationService.getSessions(providerId);
|
|
29
35
|
const sessions = allSessions.filter(s => s.account.label === accountLabel);
|
|
30
36
|
const accountUsages = authenticationUsageService.readAccountUsages(providerId, accountLabel);
|
|
31
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
confirmed
|
|
39
|
+
} = await dialogService.confirm({
|
|
32
40
|
type: Severity.Info,
|
|
33
|
-
message: accountUsages.length
|
|
34
|
-
|
|
35
|
-
4499,
|
|
41
|
+
message: accountUsages.length ? ( localize(
|
|
42
|
+
4509,
|
|
36
43
|
"The account '{0}' has been used by: \n\n{1}\n\n Sign out from these extensions?",
|
|
37
44
|
accountLabel,
|
|
38
|
-
( accountUsages.map(usage => usage.extensionName)).join(
|
|
39
|
-
))
|
|
40
|
-
|
|
41
|
-
primaryButton: ( localize(4501, "&&Sign Out"))
|
|
45
|
+
( accountUsages.map(usage => usage.extensionName)).join("\n")
|
|
46
|
+
)) : ( localize(4510, "Sign out of '{0}'?", accountLabel)),
|
|
47
|
+
primaryButton: ( localize(4511, "&&Sign Out"))
|
|
42
48
|
});
|
|
43
49
|
if (confirmed) {
|
|
44
50
|
const removeSessionPromises = ( sessions.map(session => authenticationService.removeSession(providerId, session.id)));
|
package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js
CHANGED
|
@@ -18,14 +18,14 @@ import { ManageTrustedMcpServersForAccountAction } from './actions/manageTrusted
|
|
|
18
18
|
import { RemoveDynamicAuthenticationProvidersAction } from './actions/manageDynamicAuthenticationProvidersAction.js';
|
|
19
19
|
import { ManageAccountsAction } from './actions/manageAccountsAction.js';
|
|
20
20
|
|
|
21
|
-
const codeExchangeProxyCommand = CommandsRegistry.registerCommand(
|
|
21
|
+
const codeExchangeProxyCommand = CommandsRegistry.registerCommand("workbench.getCodeExchangeProxyEndpoints", function(accessor, _) {
|
|
22
22
|
const environmentService = accessor.get(IBrowserWorkbenchEnvironmentService);
|
|
23
23
|
return environmentService.options?.codeExchangeProxyEndpoints;
|
|
24
24
|
});
|
|
25
25
|
class AuthenticationDataRenderer extends Disposable {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
|
-
this.type =
|
|
28
|
+
this.type = "table";
|
|
29
29
|
}
|
|
30
30
|
shouldRender(manifest) {
|
|
31
31
|
return !!manifest.contributes?.authentication;
|
|
@@ -33,41 +33,39 @@ class AuthenticationDataRenderer extends Disposable {
|
|
|
33
33
|
render(manifest) {
|
|
34
34
|
const authentication = manifest.contributes?.authentication || [];
|
|
35
35
|
if (!authentication.length) {
|
|
36
|
-
return {
|
|
36
|
+
return {
|
|
37
|
+
data: {
|
|
38
|
+
headers: [],
|
|
39
|
+
rows: []
|
|
40
|
+
},
|
|
41
|
+
dispose: () => {}
|
|
42
|
+
};
|
|
37
43
|
}
|
|
38
|
-
const headers = [
|
|
39
|
-
|
|
40
|
-
(
|
|
41
|
-
( localize(4504, "MCP Authorization Servers"))
|
|
42
|
-
];
|
|
43
|
-
const rows = ( authentication
|
|
44
|
-
.sort((a, b) => a.label.localeCompare(b.label))
|
|
45
|
-
.map(auth => {
|
|
46
|
-
return [
|
|
47
|
-
auth.label,
|
|
48
|
-
auth.id,
|
|
49
|
-
(auth.authorizationServerGlobs ?? []).join(',\n')
|
|
50
|
-
];
|
|
44
|
+
const headers = [( localize(4512, "Label")), ( localize(4513, "ID")), ( localize(4514, "MCP Authorization Servers"))];
|
|
45
|
+
const rows = ( authentication.sort((a, b) => a.label.localeCompare(b.label)).map(auth => {
|
|
46
|
+
return [auth.label, auth.id, (auth.authorizationServerGlobs ?? []).join(",\n")];
|
|
51
47
|
}));
|
|
52
48
|
return {
|
|
53
49
|
data: {
|
|
54
50
|
headers,
|
|
55
51
|
rows
|
|
56
52
|
},
|
|
57
|
-
dispose: () => {
|
|
53
|
+
dispose: () => {}
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
const extensionFeature = ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
|
|
62
|
-
id:
|
|
63
|
-
label: ( localize(
|
|
58
|
+
id: "authentication",
|
|
59
|
+
label: ( localize(4515, "Authentication")),
|
|
64
60
|
access: {
|
|
65
61
|
canToggle: false
|
|
66
62
|
},
|
|
67
|
-
renderer: ( new SyncDescriptor(AuthenticationDataRenderer))
|
|
63
|
+
renderer: ( new SyncDescriptor(AuthenticationDataRenderer))
|
|
68
64
|
});
|
|
69
65
|
class AuthenticationContribution extends Disposable {
|
|
70
|
-
static {
|
|
66
|
+
static {
|
|
67
|
+
this.ID = "workbench.contrib.authentication";
|
|
68
|
+
}
|
|
71
69
|
constructor() {
|
|
72
70
|
super();
|
|
73
71
|
this._register(codeExchangeProxyCommand);
|
|
@@ -85,7 +83,9 @@ class AuthenticationContribution extends Disposable {
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
let AuthenticationUsageContribution = class AuthenticationUsageContribution {
|
|
88
|
-
static {
|
|
86
|
+
static {
|
|
87
|
+
this.ID = "workbench.contrib.authenticationUsage";
|
|
88
|
+
}
|
|
89
89
|
constructor(_authenticationUsageService) {
|
|
90
90
|
this._authenticationUsageService = _authenticationUsageService;
|
|
91
91
|
this._initializeExtensionUsageCache();
|
|
@@ -94,8 +94,14 @@ let AuthenticationUsageContribution = class AuthenticationUsageContribution {
|
|
|
94
94
|
await this._authenticationUsageService.initializeExtensionUsageCache();
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
AuthenticationUsageContribution = ( __decorate([
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
AuthenticationUsageContribution = ( __decorate([( __param(0, IAuthenticationUsageService))], AuthenticationUsageContribution));
|
|
98
|
+
registerWorkbenchContribution2(
|
|
99
|
+
AuthenticationContribution.ID,
|
|
100
|
+
AuthenticationContribution,
|
|
101
|
+
WorkbenchPhase.AfterRestored
|
|
102
|
+
);
|
|
103
|
+
registerWorkbenchContribution2(
|
|
104
|
+
AuthenticationUsageContribution.ID,
|
|
105
|
+
AuthenticationUsageContribution,
|
|
106
|
+
WorkbenchPhase.Eventually
|
|
107
|
+
);
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js
CHANGED
|
@@ -24,8 +24,7 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
24
24
|
if (trustedExtensionAuthAccess.includes(extensionKey)) {
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
|
-
}
|
|
28
|
-
else if (trustedExtensionAuthAccess?.[providerId]?.includes(extensionKey)) {
|
|
27
|
+
} else if (trustedExtensionAuthAccess?.[providerId]?.includes(extensionKey)) {
|
|
29
28
|
return true;
|
|
30
29
|
}
|
|
31
30
|
const allowList = this.readAllowedExtensions(providerId, accountName);
|
|
@@ -33,9 +32,7 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
33
32
|
if (!extensionData) {
|
|
34
33
|
return undefined;
|
|
35
34
|
}
|
|
36
|
-
return extensionData.allowed !== undefined
|
|
37
|
-
? extensionData.allowed
|
|
38
|
-
: true;
|
|
35
|
+
return extensionData.allowed !== undefined ? extensionData.allowed : true;
|
|
39
36
|
}
|
|
40
37
|
readAllowedExtensions(providerId, accountName) {
|
|
41
38
|
let trustedExtensions = [];
|
|
@@ -44,15 +41,11 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
44
41
|
if (trustedExtensionSrc) {
|
|
45
42
|
trustedExtensions = JSON.parse(trustedExtensionSrc);
|
|
46
43
|
}
|
|
47
|
-
}
|
|
48
|
-
catch (err) { }
|
|
44
|
+
} catch (err) {}
|
|
49
45
|
const trustedExtensionAuthAccess = this._productService.trustedExtensionAuthAccess;
|
|
50
46
|
const trustedExtensionIds =
|
|
51
|
-
Array.isArray(trustedExtensionAuthAccess)
|
|
52
|
-
|
|
53
|
-
: typeof trustedExtensionAuthAccess === 'object'
|
|
54
|
-
? trustedExtensionAuthAccess[providerId] ?? []
|
|
55
|
-
: [];
|
|
47
|
+
Array.isArray(trustedExtensionAuthAccess) ?
|
|
48
|
+
trustedExtensionAuthAccess : typeof trustedExtensionAuthAccess === "object" ? trustedExtensionAuthAccess[providerId] ?? [] : [];
|
|
56
49
|
for (const extensionId of trustedExtensionIds) {
|
|
57
50
|
const extensionKey = ExtensionIdentifier.toKey(extensionId);
|
|
58
51
|
const existingExtension = trustedExtensions.find(extension => extension.id === extensionKey);
|
|
@@ -63,8 +56,7 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
63
56
|
allowed: true,
|
|
64
57
|
trusted: true
|
|
65
58
|
});
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
59
|
+
} else {
|
|
68
60
|
existingExtension.allowed = true;
|
|
69
61
|
existingExtension.trusted = true;
|
|
70
62
|
}
|
|
@@ -81,8 +73,7 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
81
73
|
...extension,
|
|
82
74
|
id: extensionKey
|
|
83
75
|
});
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
76
|
+
} else {
|
|
86
77
|
allowList[index].allowed = extension.allowed;
|
|
87
78
|
if (extension.name && extension.name !== extensionKey && allowList[index].name !== extension.name) {
|
|
88
79
|
allowList[index].name = extension.name;
|
|
@@ -90,17 +81,25 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
83
|
const userManagedExtensions = allowList.filter(extension => !extension.trusted);
|
|
93
|
-
this._storageService.store(
|
|
94
|
-
|
|
84
|
+
this._storageService.store(
|
|
85
|
+
`${providerId}-${accountName}`,
|
|
86
|
+
JSON.stringify(userManagedExtensions),
|
|
87
|
+
StorageScope.APPLICATION,
|
|
88
|
+
StorageTarget.USER
|
|
89
|
+
);
|
|
90
|
+
this._onDidChangeExtensionSessionAccess.fire({
|
|
91
|
+
providerId,
|
|
92
|
+
accountName
|
|
93
|
+
});
|
|
95
94
|
}
|
|
96
95
|
removeAllowedExtensions(providerId, accountName) {
|
|
97
96
|
this._storageService.remove(`${providerId}-${accountName}`, StorageScope.APPLICATION);
|
|
98
|
-
this._onDidChangeExtensionSessionAccess.fire({
|
|
97
|
+
this._onDidChangeExtensionSessionAccess.fire({
|
|
98
|
+
providerId,
|
|
99
|
+
accountName
|
|
100
|
+
});
|
|
99
101
|
}
|
|
100
102
|
};
|
|
101
|
-
AuthenticationAccessService = ( __decorate([
|
|
102
|
-
( __param(0, IStorageService)),
|
|
103
|
-
( __param(1, IProductService))
|
|
104
|
-
], AuthenticationAccessService));
|
|
103
|
+
AuthenticationAccessService = ( __decorate([( __param(0, IStorageService)), ( __param(1, IProductService))], AuthenticationAccessService));
|
|
105
104
|
|
|
106
105
|
export { AuthenticationAccessService };
|