Skip to content

Commit cd5b4a7

Browse files
author
Rachel Macfarlane
committed
Emit activation event for auth providers when getSession is called
1 parent c24e471 commit cd5b4a7

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

extensions/github-authentication/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"Other"
1313
],
1414
"activationEvents": [
15-
"*"
15+
"*",
16+
"onAuthenticationRequest:github"
1617
],
1718
"contributes": {
1819
"commands": [

extensions/microsoft-authentication/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
],
1313
"enableProposedApi": true,
1414
"activationEvents": [
15-
"*"
15+
"*",
16+
"onAuthenticationRequest:microsoft"
1617
],
1718
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
1819
"main": "./out/extension.js",

src/vs/workbench/api/browser/mainThreadAuthentication.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
1717
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
1818
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
1919
import { fromNow } from 'vs/base/common/date';
20+
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2021

2122
const VSO_ALLOWED_EXTENSIONS = ['github.vscode-pull-request-github', 'github.vscode-pull-request-github-insiders', 'vscode.git', 'ms-vsonline.vsonline', 'vscode.github-browser'];
2223

@@ -213,7 +214,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
213214
@INotificationService private readonly notificationService: INotificationService,
214215
@IStorageKeysSyncRegistryService private readonly storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
215216
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
216-
@IQuickInputService private readonly quickInputService: IQuickInputService
217+
@IQuickInputService private readonly quickInputService: IQuickInputService,
218+
@IExtensionService private readonly extensionService: IExtensionService
217219
) {
218220
super();
219221
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostAuthentication);
@@ -378,6 +380,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
378380
}
379381

380382
async $getSessionsPrompt(providerId: string, accountName: string, providerName: string, extensionId: string, extensionName: string): Promise<boolean> {
383+
await this.extensionService.activateByEvent(`onAuthenticationRequest:${providerId}`);
384+
381385
const allowList = readAllowedExtensions(this.storageService, providerId, accountName);
382386
const extensionData = allowList.find(extension => extension.id === extensionId);
383387
if (extensionData) {

0 commit comments

Comments
 (0)