@codingame/monaco-vscode-authentication-service-override 20.5.0 → 21.0.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/index.js +1 -1
- package/package.json +5 -5
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForExtensionAction.js +24 -11
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForMcpServerAction.js +10 -10
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageDynamicAuthenticationProvidersAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js +4 -4
- package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js +4 -4
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.d.ts +5 -5
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js +36 -33
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.d.ts +1 -1
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
3
|
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
4
|
import { IAuthenticationExtensionsService, IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
5
|
-
import { AuthenticationService } from '@codingame/monaco-vscode-
|
|
5
|
+
import { AuthenticationService } from '@codingame/monaco-vscode-8f0e3e10-3d00-5abd-87f4-e9b3b4384fc6-common/vscode/vs/workbench/services/authentication/browser/authenticationService';
|
|
6
6
|
import { AuthenticationAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js';
|
|
7
7
|
import { AuthenticationUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js';
|
|
8
8
|
import { AuthenticationExtensionsService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - authentication service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-34a0ffd3-b9f5-5699-b43b-38af5732f38a-common": "
|
|
19
|
-
"@codingame/monaco-vscode-
|
|
20
|
-
"@codingame/monaco-vscode-
|
|
21
|
-
"@codingame/monaco-vscode-
|
|
18
|
+
"@codingame/monaco-vscode-34a0ffd3-b9f5-5699-b43b-38af5732f38a-common": "21.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-8f0e3e10-3d00-5abd-87f4-e9b3b4384fc6-common": "21.0.1",
|
|
20
|
+
"@codingame/monaco-vscode-9a5ab9e7-d838-5831-9eb4-e79ea3764dcb-common": "21.0.1",
|
|
21
|
+
"@codingame/monaco-vscode-api": "21.0.1"
|
|
22
22
|
},
|
|
23
23
|
"main": "index.js",
|
|
24
24
|
"module": "index.js",
|
|
@@ -16,9 +16,9 @@ class ManageAccountPreferencesForExtensionAction extends Action2 {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
18
|
id: '_manageAccountPreferencesForExtension',
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
21
|
-
f1:
|
|
19
|
+
title: ( localize2(4337, "Manage Extension Account Preferences")),
|
|
20
|
+
category: ( localize2(4338, "Accounts")),
|
|
21
|
+
f1: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
run(accessor, extensionId, providerId) {
|
|
@@ -35,6 +35,19 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
35
35
|
this._logService = _logService;
|
|
36
36
|
}
|
|
37
37
|
async run(extensionId, providerId) {
|
|
38
|
+
if (!extensionId) {
|
|
39
|
+
const extensions = this._extensionService.extensions
|
|
40
|
+
.filter(ext => this._authenticationQueryService.extension(ext.identifier.value).getAllAccountPreferences().size > 0)
|
|
41
|
+
.sort((a, b) => (a.displayName ?? a.name).localeCompare((b.displayName ?? b.name)));
|
|
42
|
+
const result = await this._quickInputService.pick(( extensions.map(ext => ({
|
|
43
|
+
label: ext.displayName ?? ext.name,
|
|
44
|
+
id: ext.identifier.value
|
|
45
|
+
}))), {
|
|
46
|
+
placeHolder: ( localize(4339, "Select an extension to manage account preferences for")),
|
|
47
|
+
title: ( localize(4340, "Manage Extension Account Preferences"))
|
|
48
|
+
});
|
|
49
|
+
extensionId = result?.id;
|
|
50
|
+
}
|
|
38
51
|
if (!extensionId) {
|
|
39
52
|
return;
|
|
40
53
|
}
|
|
@@ -46,7 +59,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
46
59
|
const extensionQuery = this._authenticationQueryService.extension(extensionId);
|
|
47
60
|
const providersWithAccess = await extensionQuery.getProvidersWithAccess();
|
|
48
61
|
if (!providersWithAccess.length) {
|
|
49
|
-
await this._dialogService.info(( localize(
|
|
62
|
+
await this._dialogService.info(( localize(4341, "This extension has not used any accounts yet.")));
|
|
50
63
|
return;
|
|
51
64
|
}
|
|
52
65
|
providerId = providersWithAccess[0];
|
|
@@ -56,10 +69,10 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
56
69
|
id: providerId,
|
|
57
70
|
}))), {
|
|
58
71
|
placeHolder: ( localize(
|
|
59
|
-
|
|
72
|
+
4342,
|
|
60
73
|
"Select an authentication provider to manage account preferences for"
|
|
61
74
|
)),
|
|
62
|
-
title: ( localize(
|
|
75
|
+
title: ( localize(4340, "Manage Extension Account Preferences"))
|
|
63
76
|
});
|
|
64
77
|
if (!result) {
|
|
65
78
|
return;
|
|
@@ -80,7 +93,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
80
93
|
items.push({
|
|
81
94
|
providerId,
|
|
82
95
|
scopes: lastUsedScopes,
|
|
83
|
-
label: ( localize(
|
|
96
|
+
label: ( localize(4343, "Use a new account...")),
|
|
84
97
|
});
|
|
85
98
|
}
|
|
86
99
|
}
|
|
@@ -99,12 +112,12 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
99
112
|
disposableStore.dispose();
|
|
100
113
|
}));
|
|
101
114
|
picker.placeholder = ( localize(
|
|
102
|
-
|
|
115
|
+
4344,
|
|
103
116
|
"Manage '{0}' account preferences for {1}...",
|
|
104
117
|
extensionLabel,
|
|
105
118
|
providerLabel
|
|
106
119
|
));
|
|
107
|
-
picker.title = ( localize(
|
|
120
|
+
picker.title = ( localize(4345, "'{0}' Account Preferences For This Workspace", extensionLabel));
|
|
108
121
|
picker.sortByLabel = false;
|
|
109
122
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
110
123
|
picker.hide();
|
|
@@ -118,7 +131,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
118
131
|
label: a.label,
|
|
119
132
|
account: a,
|
|
120
133
|
providerId,
|
|
121
|
-
description: ( localize(
|
|
134
|
+
description: ( localize(4346, "Current account")),
|
|
122
135
|
picked: true
|
|
123
136
|
}
|
|
124
137
|
: {
|
|
@@ -128,7 +141,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
128
141
|
}));
|
|
129
142
|
}
|
|
130
143
|
_handleNoAccounts(picker) {
|
|
131
|
-
picker.validationMessage = ( localize(
|
|
144
|
+
picker.validationMessage = ( localize(4347, "No accounts are currently used by this extension."));
|
|
132
145
|
picker.buttons = [this._quickInputService.backButton];
|
|
133
146
|
picker.show();
|
|
134
147
|
return Event.filter(picker.onDidTriggerButton, (e) => e === this._quickInputService.backButton)(() => this.run());
|
|
@@ -16,8 +16,8 @@ class ManageAccountPreferencesForMcpServerAction extends Action2 {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
18
|
id: '_manageAccountPreferencesForMcpServer',
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
19
|
+
title: ( localize2(4348, "Manage MCP Server Account Preferences")),
|
|
20
|
+
category: ( localize2(4349, "Accounts")),
|
|
21
21
|
f1: false
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -46,7 +46,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
46
46
|
const mcpServerQuery = this._authenticationQueryService.mcpServer(mcpServerId);
|
|
47
47
|
const providersWithAccess = await mcpServerQuery.getProvidersWithAccess();
|
|
48
48
|
if (!providersWithAccess.length) {
|
|
49
|
-
await this._dialogService.info(( localize(
|
|
49
|
+
await this._dialogService.info(( localize(4350, "This MCP server has not used any accounts yet.")));
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
providerId = providersWithAccess[0];
|
|
@@ -56,10 +56,10 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
56
56
|
id: providerId,
|
|
57
57
|
}))), {
|
|
58
58
|
placeHolder: ( localize(
|
|
59
|
-
|
|
59
|
+
4351,
|
|
60
60
|
"Select an authentication provider to manage account preferences for"
|
|
61
61
|
)),
|
|
62
|
-
title: ( localize(
|
|
62
|
+
title: ( localize(4352, "Manage MCP Server Account Preferences"))
|
|
63
63
|
});
|
|
64
64
|
if (!result) {
|
|
65
65
|
return;
|
|
@@ -80,7 +80,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
80
80
|
items.push({
|
|
81
81
|
providerId: providerId,
|
|
82
82
|
scopes: lastUsedScopes,
|
|
83
|
-
label: ( localize(
|
|
83
|
+
label: ( localize(4353, "Use a new account...")),
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -99,12 +99,12 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
99
99
|
disposableStore.dispose();
|
|
100
100
|
}));
|
|
101
101
|
picker.placeholder = ( localize(
|
|
102
|
-
|
|
102
|
+
4354,
|
|
103
103
|
"Manage '{0}' account preferences for {1}...",
|
|
104
104
|
mcpServerLabel,
|
|
105
105
|
providerLabel
|
|
106
106
|
));
|
|
107
|
-
picker.title = ( localize(
|
|
107
|
+
picker.title = ( localize(4355, "'{0}' Account Preferences For This Workspace", mcpServerLabel));
|
|
108
108
|
picker.sortByLabel = false;
|
|
109
109
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
110
110
|
picker.hide();
|
|
@@ -118,7 +118,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
118
118
|
label: a.label,
|
|
119
119
|
account: a,
|
|
120
120
|
providerId,
|
|
121
|
-
description: ( localize(
|
|
121
|
+
description: ( localize(4356, "Current account")),
|
|
122
122
|
picked: true
|
|
123
123
|
}
|
|
124
124
|
: {
|
|
@@ -128,7 +128,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
128
128
|
}));
|
|
129
129
|
}
|
|
130
130
|
_handleNoAccounts(picker) {
|
|
131
|
-
picker.validationMessage = ( localize(
|
|
131
|
+
picker.validationMessage = ( localize(4357, "No accounts are currently used by this MCP server."));
|
|
132
132
|
picker.buttons = [this._quickInputService.backButton];
|
|
133
133
|
picker.show();
|
|
134
134
|
return Event.filter(picker.onDidTriggerButton, (e) => e === this._quickInputService.backButton)(() => this.run());
|
|
@@ -11,8 +11,8 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super({
|
|
13
13
|
id: RemoveDynamicAuthenticationProvidersAction.ID,
|
|
14
|
-
title: ( localize2(
|
|
15
|
-
category: ( localize2(
|
|
14
|
+
title: ( localize2(4358, 'Remove Dynamic Authentication Providers')),
|
|
15
|
+
category: ( localize2(4359, 'Authentication')),
|
|
16
16
|
f1: true
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -23,16 +23,16 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
23
23
|
const dialogService = accessor.get(IDialogService);
|
|
24
24
|
const interactedProviders = dynamicAuthStorageService.getInteractedProviders();
|
|
25
25
|
if (interactedProviders.length === 0) {
|
|
26
|
-
await dialogService.info(( localize(
|
|
26
|
+
await dialogService.info(( localize(4360, 'No dynamic authentication providers')), ( localize(4361, 'No dynamic authentication providers have been used yet.')));
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const items = ( interactedProviders.map(provider => ({
|
|
30
30
|
label: provider.label,
|
|
31
|
-
description: ( localize(
|
|
31
|
+
description: ( localize(4362, 'Client ID: {0}', provider.clientId)),
|
|
32
32
|
provider
|
|
33
33
|
})));
|
|
34
34
|
const selected = await quickInputService.pick(items, {
|
|
35
|
-
placeHolder: ( localize(
|
|
35
|
+
placeHolder: ( localize(4363, 'Select a dynamic authentication provider to remove')),
|
|
36
36
|
canPickMany: true
|
|
37
37
|
});
|
|
38
38
|
if (!selected || selected.length === 0) {
|
|
@@ -41,12 +41,12 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
41
41
|
const providerNames = ( selected.map(item => item.provider.label)).join(', ');
|
|
42
42
|
const message = selected.length === 1
|
|
43
43
|
? ( localize(
|
|
44
|
-
|
|
44
|
+
4364,
|
|
45
45
|
'Are you sure you want to remove the dynamic authentication provider "{0}"?',
|
|
46
46
|
providerNames
|
|
47
47
|
))
|
|
48
48
|
: ( localize(
|
|
49
|
-
|
|
49
|
+
4365,
|
|
50
50
|
'Are you sure you want to remove {0} dynamic authentication providers: {1}?',
|
|
51
51
|
selected.length,
|
|
52
52
|
providerNames
|
|
@@ -54,10 +54,10 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
54
54
|
const result = await dialogService.confirm({
|
|
55
55
|
message,
|
|
56
56
|
detail: ( localize(
|
|
57
|
-
|
|
57
|
+
4366,
|
|
58
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(
|
|
60
|
+
primaryButton: ( localize(4367, 'Remove')),
|
|
61
61
|
type: 'warning'
|
|
62
62
|
});
|
|
63
63
|
if (!result.confirmed) {
|
|
@@ -18,8 +18,8 @@ class ManageTrustedExtensionsForAccountAction extends Action2 {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
super({
|
|
20
20
|
id: '_manageTrustedExtensionsForAccount',
|
|
21
|
-
title: ( localize2(
|
|
22
|
-
category: ( localize2(
|
|
21
|
+
title: ( localize2(4368, "Manage Trusted Extensions For Account")),
|
|
22
|
+
category: ( localize2(4369, "Accounts")),
|
|
23
23
|
f1: true
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -57,7 +57,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
57
57
|
}
|
|
58
58
|
const accounts = await this._getAllAvailableAccounts();
|
|
59
59
|
const pick = await this._quickInputService.pick(accounts, {
|
|
60
|
-
placeHolder: ( localize(
|
|
60
|
+
placeHolder: ( localize(4370, "Pick an account to manage trusted extensions for")),
|
|
61
61
|
matchOnDescription: true,
|
|
62
62
|
});
|
|
63
63
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
@@ -101,7 +101,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
101
101
|
};
|
|
102
102
|
}));
|
|
103
103
|
if (!filteredExtensions.length) {
|
|
104
|
-
this._dialogService.info(( localize(
|
|
104
|
+
this._dialogService.info(( localize(4371, "This account has not been used by any extensions.")));
|
|
105
105
|
return [];
|
|
106
106
|
}
|
|
107
107
|
const trustedExtensions = filteredExtensions.filter(e => e.trusted);
|
|
@@ -109,20 +109,20 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
109
109
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
110
110
|
return [
|
|
111
111
|
...( otherExtensions.sort(sortByLastUsed).map(this._toQuickPickItem)),
|
|
112
|
-
{ type: 'separator', label: ( localize(
|
|
112
|
+
{ type: 'separator', label: ( localize(4372, "Trusted by Microsoft")) },
|
|
113
113
|
...( trustedExtensions.sort(sortByLastUsed).map(this._toQuickPickItem))
|
|
114
114
|
];
|
|
115
115
|
}
|
|
116
116
|
_toQuickPickItem(extension) {
|
|
117
117
|
const lastUsed = extension.lastUsed;
|
|
118
118
|
const description = lastUsed
|
|
119
|
-
? ( localize(
|
|
120
|
-
: ( localize(
|
|
119
|
+
? ( localize(4373, "Last used this account {0}", fromNow(lastUsed, true)))
|
|
120
|
+
: ( localize(4374, "Has not used this account"));
|
|
121
121
|
let tooltip;
|
|
122
122
|
let disabled;
|
|
123
123
|
if (extension.trusted) {
|
|
124
124
|
tooltip = ( localize(
|
|
125
|
-
|
|
125
|
+
4375,
|
|
126
126
|
"This extension is trusted by Microsoft and\nalways has access to this account"
|
|
127
127
|
));
|
|
128
128
|
disabled = true;
|
|
@@ -134,7 +134,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
134
134
|
tooltip,
|
|
135
135
|
disabled,
|
|
136
136
|
buttons: [{
|
|
137
|
-
tooltip: ( localize(
|
|
137
|
+
tooltip: ( localize(4376, "Manage account preferences for this extension")),
|
|
138
138
|
iconClass: ThemeIcon.asClassName(Codicon.settingsGear),
|
|
139
139
|
}],
|
|
140
140
|
picked: extension.allowed === undefined || extension.allowed
|
|
@@ -145,9 +145,9 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
145
145
|
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({ useSeparators: true }));
|
|
146
146
|
quickPick.canSelectMany = true;
|
|
147
147
|
quickPick.customButton = true;
|
|
148
|
-
quickPick.customLabel = ( localize(
|
|
149
|
-
quickPick.title = ( localize(
|
|
150
|
-
quickPick.placeholder = ( localize(
|
|
148
|
+
quickPick.customLabel = ( localize(4377, 'Cancel'));
|
|
149
|
+
quickPick.title = ( localize(4378, "Manage Trusted Extensions"));
|
|
150
|
+
quickPick.placeholder = ( localize(4379, "Choose which extensions can access this account"));
|
|
151
151
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
152
152
|
const updatedAllowedList = ( quickPick.items
|
|
153
153
|
.filter((item) => item.type !== 'separator')
|
|
@@ -18,8 +18,8 @@ class ManageTrustedMcpServersForAccountAction extends Action2 {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
super({
|
|
20
20
|
id: '_manageTrustedMCPServersForAccount',
|
|
21
|
-
title: ( localize2(
|
|
22
|
-
category: ( localize2(
|
|
21
|
+
title: ( localize2(4380, "Manage Trusted MCP Servers For Account")),
|
|
22
|
+
category: ( localize2(4381, "Accounts")),
|
|
23
23
|
f1: true
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -57,7 +57,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
57
57
|
}
|
|
58
58
|
const accounts = await this._getAllAvailableAccounts();
|
|
59
59
|
const pick = await this._quickInputService.pick(accounts, {
|
|
60
|
-
placeHolder: ( localize(
|
|
60
|
+
placeHolder: ( localize(4382, "Pick an account to manage trusted MCP servers for")),
|
|
61
61
|
matchOnDescription: true,
|
|
62
62
|
});
|
|
63
63
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
@@ -95,7 +95,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
95
95
|
};
|
|
96
96
|
}));
|
|
97
97
|
if (!filteredMcpServers.length) {
|
|
98
|
-
this._dialogService.info(( localize(
|
|
98
|
+
this._dialogService.info(( localize(4383, "This account has not been used by any MCP servers.")));
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
101
|
const trustedServers = filteredMcpServers.filter(s => s.trusted);
|
|
@@ -103,20 +103,20 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
103
103
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
104
104
|
return [
|
|
105
105
|
...( otherServers.sort(sortByLastUsed).map(this._toQuickPickItem)),
|
|
106
|
-
{ type: 'separator', label: ( localize(
|
|
106
|
+
{ type: 'separator', label: ( localize(4384, "Trusted by Microsoft")) },
|
|
107
107
|
...( trustedServers.sort(sortByLastUsed).map(this._toQuickPickItem))
|
|
108
108
|
];
|
|
109
109
|
}
|
|
110
110
|
_toQuickPickItem(mcpServer) {
|
|
111
111
|
const lastUsed = mcpServer.lastUsed;
|
|
112
112
|
const description = lastUsed
|
|
113
|
-
? ( localize(
|
|
114
|
-
: ( localize(
|
|
113
|
+
? ( localize(4385, "Last used this account {0}", fromNow(lastUsed, true)))
|
|
114
|
+
: ( localize(4386, "Has not used this account"));
|
|
115
115
|
let tooltip;
|
|
116
116
|
let disabled;
|
|
117
117
|
if (mcpServer.trusted) {
|
|
118
118
|
tooltip = ( localize(
|
|
119
|
-
|
|
119
|
+
4387,
|
|
120
120
|
"This MCP server is trusted by Microsoft and\nalways has access to this account"
|
|
121
121
|
));
|
|
122
122
|
disabled = true;
|
|
@@ -128,7 +128,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
128
128
|
tooltip,
|
|
129
129
|
disabled,
|
|
130
130
|
buttons: [{
|
|
131
|
-
tooltip: ( localize(
|
|
131
|
+
tooltip: ( localize(4388, "Manage account preferences for this MCP server")),
|
|
132
132
|
iconClass: ThemeIcon.asClassName(Codicon.settingsGear),
|
|
133
133
|
}],
|
|
134
134
|
picked: mcpServer.allowed === undefined || mcpServer.allowed
|
|
@@ -139,9 +139,9 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
139
139
|
const quickPick = disposableStore.add(this._quickInputService.createQuickPick({ useSeparators: true }));
|
|
140
140
|
quickPick.canSelectMany = true;
|
|
141
141
|
quickPick.customButton = true;
|
|
142
|
-
quickPick.customLabel = ( localize(
|
|
143
|
-
quickPick.title = ( localize(
|
|
144
|
-
quickPick.placeholder = ( localize(
|
|
142
|
+
quickPick.customLabel = ( localize(4389, 'Cancel'));
|
|
143
|
+
quickPick.title = ( localize(4390, "Manage Trusted MCP Servers"));
|
|
144
|
+
quickPick.placeholder = ( localize(4391, "Choose which MCP servers can access this account"));
|
|
145
145
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
146
146
|
quickPick.hide();
|
|
147
147
|
const allServers = ( quickPick.items
|
package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js
CHANGED
|
@@ -11,7 +11,7 @@ class SignOutOfAccountAction extends Action2 {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super({
|
|
13
13
|
id: '_signOutOfAccount',
|
|
14
|
-
title: ( localize(
|
|
14
|
+
title: ( localize(4392, "Sign out of account")),
|
|
15
15
|
f1: false
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -32,13 +32,13 @@ class SignOutOfAccountAction extends Action2 {
|
|
|
32
32
|
type: Severity.Info,
|
|
33
33
|
message: accountUsages.length
|
|
34
34
|
? ( localize(
|
|
35
|
-
|
|
35
|
+
4393,
|
|
36
36
|
"The account '{0}' has been used by: \n\n{1}\n\n Sign out from these extensions?",
|
|
37
37
|
accountLabel,
|
|
38
38
|
( accountUsages.map(usage => usage.extensionName)).join('\n')
|
|
39
39
|
))
|
|
40
|
-
: ( localize(
|
|
41
|
-
primaryButton: ( localize(
|
|
40
|
+
: ( localize(4394, "Sign out of '{0}'?", accountLabel)),
|
|
41
|
+
primaryButton: ( localize(4395, "&&Sign Out"))
|
|
42
42
|
});
|
|
43
43
|
if (confirmed) {
|
|
44
44
|
const removeSessionPromises = ( sessions.map(session => authenticationService.removeSession(providerId, session.id)));
|
package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js
CHANGED
|
@@ -41,9 +41,9 @@ class AuthenticationDataRenderer extends Disposable {
|
|
|
41
41
|
return { data: { headers: [], rows: [] }, dispose: () => { } };
|
|
42
42
|
}
|
|
43
43
|
const headers = [
|
|
44
|
-
( localize(
|
|
45
|
-
( localize(
|
|
46
|
-
( localize(
|
|
44
|
+
( localize(4396, "Label")),
|
|
45
|
+
( localize(4397, "ID")),
|
|
46
|
+
( localize(4398, "MCP Authorization Servers"))
|
|
47
47
|
];
|
|
48
48
|
const rows = ( authentication
|
|
49
49
|
.sort((a, b) => a.label.localeCompare(b.label))
|
|
@@ -65,7 +65,7 @@ class AuthenticationDataRenderer extends Disposable {
|
|
|
65
65
|
}
|
|
66
66
|
const extensionFeature = ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
|
|
67
67
|
id: 'authentication',
|
|
68
|
-
label: ( localize(
|
|
68
|
+
label: ( localize(4399, "Authentication")),
|
|
69
69
|
access: {
|
|
70
70
|
canToggle: false
|
|
71
71
|
},
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
5
5
|
import { IActivityService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service";
|
|
6
6
|
import { IAuthenticationAccessService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service";
|
|
7
7
|
import { IAuthenticationUsageService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service";
|
|
8
|
-
import { AuthenticationSession, AuthenticationSessionAccount } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication";
|
|
8
|
+
import { AuthenticationSession, AuthenticationSessionAccount, IAuthenticationWWWAuthenticateRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication";
|
|
9
9
|
import { IAuthenticationExtensionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
|
|
10
10
|
import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
|
|
11
11
|
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
@@ -31,7 +31,7 @@ export declare class AuthenticationExtensionsService extends Disposable implemen
|
|
|
31
31
|
private _inheritAuthAccountPreferenceChildToParent;
|
|
32
32
|
constructor(activityService: IActivityService, storageService: IStorageService, dialogService: IDialogService, quickInputService: IQuickInputService, _productService: IProductService, _authenticationService: IAuthenticationService, _authenticationUsageService: IAuthenticationUsageService, _authenticationAccessService: IAuthenticationAccessService);
|
|
33
33
|
private registerListeners;
|
|
34
|
-
|
|
34
|
+
updateNewSessionRequests(providerId: string, addedSessions: readonly AuthenticationSession[]): void;
|
|
35
35
|
private updateAccessRequests;
|
|
36
36
|
private updateBadgeCount;
|
|
37
37
|
private removeAccessRequest;
|
|
@@ -47,8 +47,8 @@ export declare class AuthenticationExtensionsService extends Disposable implemen
|
|
|
47
47
|
/**
|
|
48
48
|
* This function should be used only when there are sessions to disambiguate.
|
|
49
49
|
*/
|
|
50
|
-
selectSession(providerId: string, extensionId: string, extensionName: string,
|
|
50
|
+
selectSession(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, availableSessions: AuthenticationSession[]): Promise<AuthenticationSession>;
|
|
51
51
|
private completeSessionAccessRequest;
|
|
52
|
-
requestSessionAccess(providerId: string, extensionId: string, extensionName: string,
|
|
53
|
-
requestNewSession(providerId: string,
|
|
52
|
+
requestSessionAccess(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, possibleSessions: AuthenticationSession[]): void;
|
|
53
|
+
requestNewSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, extensionId: string, extensionName: string): Promise<void>;
|
|
54
54
|
}
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Disposable, MutableDisposable, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { scopesMatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/oauth';
|
|
4
5
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
6
|
import { MenuRegistry, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
6
7
|
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
@@ -10,10 +11,11 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/noti
|
|
|
10
11
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
11
12
|
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
12
13
|
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
13
|
-
import { NumberBadge } from '@codingame/monaco-vscode-
|
|
14
|
+
import { NumberBadge } from '@codingame/monaco-vscode-9a5ab9e7-d838-5831-9eb4-e79ea3764dcb-common/vscode/vs/workbench/services/activity/common/activity';
|
|
14
15
|
import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service';
|
|
15
16
|
import { IAuthenticationAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service';
|
|
16
17
|
import { IAuthenticationUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service';
|
|
18
|
+
import { isAuthenticationWWWAuthenticateRequest } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication';
|
|
17
19
|
import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
18
20
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
19
21
|
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
@@ -47,14 +49,13 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
47
49
|
this.registerListeners();
|
|
48
50
|
}
|
|
49
51
|
registerListeners() {
|
|
50
|
-
this._register(this._authenticationService.onDidChangeSessions(
|
|
52
|
+
this._register(this._authenticationService.onDidChangeSessions(e => {
|
|
51
53
|
if (e.event.added?.length) {
|
|
52
|
-
|
|
54
|
+
this.updateNewSessionRequests(e.providerId, e.event.added);
|
|
53
55
|
}
|
|
54
56
|
if (e.event.removed?.length) {
|
|
55
|
-
|
|
57
|
+
this.updateAccessRequests(e.providerId, e.event.removed);
|
|
56
58
|
}
|
|
57
|
-
this.updateBadgeCount();
|
|
58
59
|
}));
|
|
59
60
|
this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e => {
|
|
60
61
|
const accessRequests = this._sessionAccessRequestItems.get(e.id) || {};
|
|
@@ -63,15 +64,14 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
63
64
|
});
|
|
64
65
|
}));
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
updateNewSessionRequests(providerId, addedSessions) {
|
|
67
68
|
const existingRequestsForProvider = this._signInRequestItems.get(providerId);
|
|
68
69
|
if (!existingRequestsForProvider) {
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
( Object.keys(existingRequestsForProvider)).forEach(requestedScopes => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
))) {
|
|
73
|
+
const requestedScopesArray = requestedScopes.split(SCOPESLIST_SEPARATOR);
|
|
74
|
+
if (( addedSessions.some(session => scopesMatch(session.scopes, requestedScopesArray)))) {
|
|
75
75
|
const sessionRequest = existingRequestsForProvider[requestedScopes];
|
|
76
76
|
sessionRequest?.disposables.forEach(item => item.dispose());
|
|
77
77
|
delete existingRequestsForProvider[requestedScopes];
|
|
@@ -81,10 +81,11 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
81
81
|
else {
|
|
82
82
|
this._signInRequestItems.set(providerId, existingRequestsForProvider);
|
|
83
83
|
}
|
|
84
|
+
this.updateBadgeCount();
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
+
updateAccessRequests(providerId, removedSessions) {
|
|
88
89
|
const providerRequests = this._sessionAccessRequestItems.get(providerId);
|
|
89
90
|
if (providerRequests) {
|
|
90
91
|
( Object.keys(providerRequests)).forEach(extensionId => {
|
|
@@ -112,7 +113,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
112
113
|
numberOfRequests += ( Object.keys(accessRequest)).length;
|
|
113
114
|
});
|
|
114
115
|
if (numberOfRequests > 0) {
|
|
115
|
-
const badge = ( new NumberBadge(numberOfRequests, () => ( localize(
|
|
116
|
+
const badge = ( new NumberBadge(numberOfRequests, () => ( localize(13046, "Sign in requested"))));
|
|
116
117
|
this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({ badge });
|
|
117
118
|
}
|
|
118
119
|
}
|
|
@@ -179,7 +180,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
179
180
|
const { result } = await this.dialogService.prompt({
|
|
180
181
|
type: Severity.Info,
|
|
181
182
|
message: ( localize(
|
|
182
|
-
|
|
183
|
+
13047,
|
|
183
184
|
"The extension '{0}' wants to access the {1} account '{2}'.",
|
|
184
185
|
extensionName,
|
|
185
186
|
provider.label,
|
|
@@ -187,11 +188,11 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
187
188
|
)),
|
|
188
189
|
buttons: [
|
|
189
190
|
{
|
|
190
|
-
label: ( localize(
|
|
191
|
+
label: ( localize(13048, "&&Allow")),
|
|
191
192
|
run: () => SessionPromptChoice.Allow
|
|
192
193
|
},
|
|
193
194
|
{
|
|
194
|
-
label: ( localize(
|
|
195
|
+
label: ( localize(13049, "&&Deny")),
|
|
195
196
|
run: () => SessionPromptChoice.Deny
|
|
196
197
|
}
|
|
197
198
|
],
|
|
@@ -205,7 +206,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
205
206
|
}
|
|
206
207
|
return result === SessionPromptChoice.Allow;
|
|
207
208
|
}
|
|
208
|
-
async selectSession(providerId, extensionId, extensionName,
|
|
209
|
+
async selectSession(providerId, extensionId, extensionName, scopeListOrRequest, availableSessions) {
|
|
209
210
|
const allAccounts = await this._authenticationService.getAccounts(providerId);
|
|
210
211
|
if (!allAccounts.length) {
|
|
211
212
|
throw ( new Error('No accounts available'));
|
|
@@ -227,16 +228,16 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
227
228
|
items.push({ label: account.label, account });
|
|
228
229
|
}
|
|
229
230
|
});
|
|
230
|
-
items.push({ label: ( localize(
|
|
231
|
+
items.push({ label: ( localize(13050, "Sign in to another account")) });
|
|
231
232
|
quickPick.items = items;
|
|
232
233
|
quickPick.title = ( localize(
|
|
233
|
-
|
|
234
|
+
13051,
|
|
234
235
|
"The extension '{0}' wants to access a {1} account",
|
|
235
236
|
extensionName,
|
|
236
237
|
this._authenticationService.getProvider(providerId).label
|
|
237
238
|
));
|
|
238
239
|
quickPick.placeholder = ( localize(
|
|
239
|
-
|
|
240
|
+
13052,
|
|
240
241
|
"Select an account for '{0}' to use or Esc to cancel",
|
|
241
242
|
extensionName
|
|
242
243
|
));
|
|
@@ -247,7 +248,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
247
248
|
if (!session) {
|
|
248
249
|
const account = quickPick.selectedItems[0].account;
|
|
249
250
|
try {
|
|
250
|
-
session = await this._authenticationService.createSession(providerId,
|
|
251
|
+
session = await this._authenticationService.createSession(providerId, scopeListOrRequest, { account });
|
|
251
252
|
}
|
|
252
253
|
catch (e) {
|
|
253
254
|
reject(e);
|
|
@@ -269,7 +270,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
269
270
|
quickPick.show();
|
|
270
271
|
}));
|
|
271
272
|
}
|
|
272
|
-
async completeSessionAccessRequest(provider, extensionId, extensionName,
|
|
273
|
+
async completeSessionAccessRequest(provider, extensionId, extensionName, scopeListOrRequest) {
|
|
273
274
|
const providerRequests = this._sessionAccessRequestItems.get(provider.id) || {};
|
|
274
275
|
const existingRequest = providerRequests[extensionId];
|
|
275
276
|
if (!existingRequest) {
|
|
@@ -282,7 +283,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
282
283
|
let session;
|
|
283
284
|
if (provider.supportsMultipleAccounts) {
|
|
284
285
|
try {
|
|
285
|
-
session = await this.selectSession(provider.id, extensionId, extensionName,
|
|
286
|
+
session = await this.selectSession(provider.id, extensionId, extensionName, scopeListOrRequest, possibleSessions);
|
|
286
287
|
}
|
|
287
288
|
catch (_) {
|
|
288
289
|
}
|
|
@@ -297,7 +298,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
297
298
|
this._authenticationUsageService.addAccountUsage(provider.id, session.account.label, session.scopes, extensionId, extensionName);
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
requestSessionAccess(providerId, extensionId, extensionName,
|
|
301
|
+
requestSessionAccess(providerId, extensionId, extensionName, scopeListOrRequest, possibleSessions) {
|
|
301
302
|
const providerRequests = this._sessionAccessRequestItems.get(providerId) || {};
|
|
302
303
|
const hasExistingRequest = providerRequests[extensionId];
|
|
303
304
|
if (hasExistingRequest) {
|
|
@@ -308,20 +309,20 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
308
309
|
group: '3_accessRequests',
|
|
309
310
|
command: {
|
|
310
311
|
id: `${providerId}${extensionId}Access`,
|
|
311
|
-
title: ( localize(
|
|
312
|
+
title: ( localize(13053, "Grant access to {0} for {1}... (1)", provider.label, extensionName))
|
|
312
313
|
}
|
|
313
314
|
}));
|
|
314
315
|
const accessCommand = CommandsRegistry.registerCommand({
|
|
315
316
|
id: `${providerId}${extensionId}Access`,
|
|
316
317
|
handler: async (accessor) => {
|
|
317
|
-
this.completeSessionAccessRequest(provider, extensionId, extensionName,
|
|
318
|
+
this.completeSessionAccessRequest(provider, extensionId, extensionName, scopeListOrRequest);
|
|
318
319
|
}
|
|
319
320
|
});
|
|
320
321
|
providerRequests[extensionId] = { possibleSessions, disposables: [menuItem, accessCommand] };
|
|
321
322
|
this._sessionAccessRequestItems.set(providerId, providerRequests);
|
|
322
323
|
this.updateBadgeCount();
|
|
323
324
|
}
|
|
324
|
-
async requestNewSession(providerId,
|
|
325
|
+
async requestNewSession(providerId, scopeListOrRequest, extensionId, extensionName) {
|
|
325
326
|
if (!this._authenticationService.isAuthenticationProviderRegistered(providerId)) {
|
|
326
327
|
await ( new Promise((resolve, _) => {
|
|
327
328
|
const dispose = this._authenticationService.onDidRegisterAuthenticationProvider(e => {
|
|
@@ -340,10 +341,12 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
340
341
|
return;
|
|
341
342
|
}
|
|
342
343
|
const providerRequests = this._signInRequestItems.get(providerId);
|
|
343
|
-
const
|
|
344
|
+
const signInRequestKey = isAuthenticationWWWAuthenticateRequest(scopeListOrRequest)
|
|
345
|
+
? `${scopeListOrRequest.wwwAuthenticate}:${scopeListOrRequest.scopes?.join(SCOPESLIST_SEPARATOR) ?? ''}`
|
|
346
|
+
: `${scopeListOrRequest.join(SCOPESLIST_SEPARATOR)}`;
|
|
344
347
|
const extensionHasExistingRequest = providerRequests
|
|
345
|
-
&& providerRequests[
|
|
346
|
-
&& providerRequests[
|
|
348
|
+
&& providerRequests[signInRequestKey]
|
|
349
|
+
&& providerRequests[signInRequestKey].requestingExtensionIds.includes(extensionId);
|
|
347
350
|
if (extensionHasExistingRequest) {
|
|
348
351
|
return;
|
|
349
352
|
}
|
|
@@ -352,21 +355,21 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
352
355
|
group: '2_signInRequests',
|
|
353
356
|
command: {
|
|
354
357
|
id: commandId,
|
|
355
|
-
title: ( localize(
|
|
358
|
+
title: ( localize(13054, "Sign in with {0} to use {1} (1)", provider.label, extensionName))
|
|
356
359
|
}
|
|
357
360
|
}));
|
|
358
361
|
const signInCommand = CommandsRegistry.registerCommand({
|
|
359
362
|
id: commandId,
|
|
360
363
|
handler: async (accessor) => {
|
|
361
364
|
const authenticationService = accessor.get(IAuthenticationService);
|
|
362
|
-
const session = await authenticationService.createSession(providerId,
|
|
365
|
+
const session = await authenticationService.createSession(providerId, scopeListOrRequest);
|
|
363
366
|
this._authenticationAccessService.updateAllowedExtensions(providerId, session.account.label, [{ id: extensionId, name: extensionName, allowed: true }]);
|
|
364
367
|
this._updateAccountAndSessionPreferences(providerId, extensionId, session);
|
|
365
368
|
}
|
|
366
369
|
});
|
|
367
370
|
if (providerRequests) {
|
|
368
|
-
const existingRequest = providerRequests[
|
|
369
|
-
providerRequests[
|
|
371
|
+
const existingRequest = providerRequests[signInRequestKey] || { disposables: [], requestingExtensionIds: [] };
|
|
372
|
+
providerRequests[signInRequestKey] = {
|
|
370
373
|
disposables: [...existingRequest.disposables, menuItem, signInCommand],
|
|
371
374
|
requestingExtensionIds: [...existingRequest.requestingExtensionIds, extensionId]
|
|
372
375
|
};
|
|
@@ -374,7 +377,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
374
377
|
}
|
|
375
378
|
else {
|
|
376
379
|
this._signInRequestItems.set(providerId, {
|
|
377
|
-
[
|
|
380
|
+
[signInRequestKey]: {
|
|
378
381
|
disposables: [menuItem, signInCommand],
|
|
379
382
|
requestingExtensionIds: [extensionId]
|
|
380
383
|
}
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ export declare class AuthenticationUsageService extends Disposable implements IA
|
|
|
23
23
|
extensionUsesAuth(extensionId: string): Promise<boolean>;
|
|
24
24
|
readAccountUsages(providerId: string, accountName: string): IAccountUsage[];
|
|
25
25
|
removeAccountUsage(providerId: string, accountName: string): void;
|
|
26
|
-
addAccountUsage(providerId: string, accountName: string, scopes: string[], extensionId: string, extensionName: string): void;
|
|
26
|
+
addAccountUsage(providerId: string, accountName: string, scopes: string[] | undefined, extensionId: string, extensionName: string): void;
|
|
27
27
|
private _addExtensionsToCache;
|
|
28
28
|
}
|