@codingame/monaco-vscode-authentication-service-override 7.1.0 → 8.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@8.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Disposable, MutableDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import {
|
|
3
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
6
6
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
@@ -16,7 +16,6 @@ import { IAuthenticationUsageService } from 'vscode/vscode/vs/workbench/services
|
|
|
16
16
|
import { IAuthenticationService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
17
17
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
18
18
|
|
|
19
|
-
const _moduleId = "vs/workbench/services/authentication/browser/authenticationExtensionsService";
|
|
20
19
|
const SCOPESLIST_SEPARATOR = ' ';
|
|
21
20
|
let AuthenticationExtensionsService = class AuthenticationExtensionsService extends Disposable {
|
|
22
21
|
constructor(activityService, storageService, dialogService, quickInputService, _authenticationService, _authenticationUsageService, _authenticationAccessService) {
|
|
@@ -99,7 +98,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
99
98
|
numberOfRequests += ( (Object.keys(accessRequest))).length;
|
|
100
99
|
});
|
|
101
100
|
if (numberOfRequests > 0) {
|
|
102
|
-
const badge = ( (new NumberBadge(numberOfRequests, () => (
|
|
101
|
+
const badge = ( (new NumberBadge(numberOfRequests, () => ( localize(1663, "Sign in requested")))));
|
|
103
102
|
this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({ badge });
|
|
104
103
|
}
|
|
105
104
|
}
|
|
@@ -134,9 +133,8 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
134
133
|
})(SessionPromptChoice || (SessionPromptChoice = {}))));
|
|
135
134
|
const { result } = await this.dialogService.prompt({
|
|
136
135
|
type: Severity$1.Info,
|
|
137
|
-
message: (
|
|
138
|
-
|
|
139
|
-
1,
|
|
136
|
+
message: ( localize(
|
|
137
|
+
1664,
|
|
140
138
|
"The extension '{0}' wants to access the {1} account '{2}'.",
|
|
141
139
|
extensionName,
|
|
142
140
|
provider.label,
|
|
@@ -144,11 +142,11 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
144
142
|
)),
|
|
145
143
|
buttons: [
|
|
146
144
|
{
|
|
147
|
-
label: (
|
|
145
|
+
label: ( localize(1665, "&&Allow")),
|
|
148
146
|
run: () => SessionPromptChoice.Allow
|
|
149
147
|
},
|
|
150
148
|
{
|
|
151
|
-
label: (
|
|
149
|
+
label: ( localize(1666, "&&Deny")),
|
|
152
150
|
run: () => SessionPromptChoice.Deny
|
|
153
151
|
}
|
|
154
152
|
],
|
|
@@ -163,64 +161,61 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
163
161
|
return result === SessionPromptChoice.Allow;
|
|
164
162
|
}
|
|
165
163
|
async selectSession(providerId, extensionId, extensionName, scopes, availableSessions) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
quickPick.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
try {
|
|
202
|
-
session = await this._authenticationService.createSession(providerId, scopes);
|
|
203
|
-
}
|
|
204
|
-
catch (e) {
|
|
205
|
-
reject(e);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
164
|
+
const allAccounts = await this._authenticationService.getAccounts(providerId);
|
|
165
|
+
if (!allAccounts.length) {
|
|
166
|
+
throw ( (new Error('No accounts available')));
|
|
167
|
+
}
|
|
168
|
+
const quickPick = this.quickInputService.createQuickPick();
|
|
169
|
+
quickPick.ignoreFocusOut = true;
|
|
170
|
+
const items = ( (availableSessions.map(session => {
|
|
171
|
+
return {
|
|
172
|
+
label: session.account.label,
|
|
173
|
+
session: session
|
|
174
|
+
};
|
|
175
|
+
})));
|
|
176
|
+
const accountsWithSessions = ( (new Set( (availableSessions.map(session => session.account.label)))));
|
|
177
|
+
allAccounts.forEach(account => {
|
|
178
|
+
if (!( (accountsWithSessions.has(account.label)))) {
|
|
179
|
+
items.push({ label: account.label, account });
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
items.push({ label: ( localize(1667, "Sign in to another account")) });
|
|
183
|
+
quickPick.items = items;
|
|
184
|
+
quickPick.title = ( localize(
|
|
185
|
+
1668,
|
|
186
|
+
"The extension '{0}' wants to access a {1} account",
|
|
187
|
+
extensionName,
|
|
188
|
+
this._authenticationService.getProvider(providerId).label
|
|
189
|
+
));
|
|
190
|
+
quickPick.placeholder = ( localize(1669, "Select an account for '{0}' to use or Esc to cancel", extensionName));
|
|
191
|
+
return await ( (new Promise((resolve, reject) => {
|
|
192
|
+
quickPick.onDidAccept(async (_) => {
|
|
193
|
+
quickPick.dispose();
|
|
194
|
+
let session = quickPick.selectedItems[0].session;
|
|
195
|
+
if (!session) {
|
|
196
|
+
const account = quickPick.selectedItems[0].account;
|
|
197
|
+
try {
|
|
198
|
+
session = await this._authenticationService.createSession(providerId, scopes, { account });
|
|
208
199
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.removeAccessRequest(providerId, extensionId);
|
|
213
|
-
resolve(session);
|
|
214
|
-
});
|
|
215
|
-
quickPick.onDidHide(_ => {
|
|
216
|
-
quickPick.dispose();
|
|
217
|
-
if (!quickPick.selectedItems[0]) {
|
|
218
|
-
reject('User did not consent to account access');
|
|
200
|
+
catch (e) {
|
|
201
|
+
reject(e);
|
|
202
|
+
return;
|
|
219
203
|
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
204
|
+
}
|
|
205
|
+
const accountName = session.account.label;
|
|
206
|
+
this._authenticationAccessService.updateAllowedExtensions(providerId, accountName, [{ id: extensionId, name: extensionName, allowed: true }]);
|
|
207
|
+
this.updateSessionPreference(providerId, extensionId, session);
|
|
208
|
+
this.removeAccessRequest(providerId, extensionId);
|
|
209
|
+
resolve(session);
|
|
210
|
+
});
|
|
211
|
+
quickPick.onDidHide(_ => {
|
|
212
|
+
quickPick.dispose();
|
|
213
|
+
if (!quickPick.selectedItems[0]) {
|
|
214
|
+
reject('User did not consent to account access');
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
quickPick.show();
|
|
218
|
+
})));
|
|
224
219
|
}
|
|
225
220
|
async completeSessionAccessRequest(provider, extensionId, extensionName, scopes) {
|
|
226
221
|
const providerRequests = this._sessionAccessRequestItems.get(provider.id) || {};
|
|
@@ -261,13 +256,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
261
256
|
group: '3_accessRequests',
|
|
262
257
|
command: {
|
|
263
258
|
id: `${providerId}${extensionId}Access`,
|
|
264
|
-
title: (
|
|
265
|
-
_moduleId,
|
|
266
|
-
7,
|
|
267
|
-
"Grant access to {0} for {1}... (1)",
|
|
268
|
-
provider.label,
|
|
269
|
-
extensionName
|
|
270
|
-
))
|
|
259
|
+
title: ( localize(1670, "Grant access to {0} for {1}... (1)", provider.label, extensionName))
|
|
271
260
|
}
|
|
272
261
|
})));
|
|
273
262
|
const accessCommand = CommandsRegistry.registerCommand({
|
|
@@ -311,13 +300,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
311
300
|
group: '2_signInRequests',
|
|
312
301
|
command: {
|
|
313
302
|
id: commandId,
|
|
314
|
-
title: (
|
|
315
|
-
_moduleId,
|
|
316
|
-
8,
|
|
317
|
-
"Sign in with {0} to use {1} (1)",
|
|
318
|
-
provider.label,
|
|
319
|
-
extensionName
|
|
320
|
-
))
|
|
303
|
+
title: ( localize(1671, "Sign in with {0} to use {1} (1)", provider.label, extensionName))
|
|
321
304
|
}
|
|
322
305
|
})));
|
|
323
306
|
const signInCommand = CommandsRegistry.registerCommand({
|