mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
#136424 add to proposed api
This commit is contained in:
parent
f76b133e69
commit
5243c4021a
|
@ -19,7 +19,7 @@ export interface ResolvedAuthority {
|
|||
export interface ResolvedOptions {
|
||||
readonly extensionHostEnv?: { [key: string]: string | null };
|
||||
readonly isTrusted?: boolean;
|
||||
readonly initializeUsingAccount?: { providerId: string, sessionId: string };
|
||||
readonly authenticationSession?: { id: string, providerId: string };
|
||||
}
|
||||
|
||||
export interface TunnelDescription {
|
||||
|
|
|
@ -698,7 +698,8 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
|||
};
|
||||
const options: ResolvedOptions = {
|
||||
extensionHostEnv: result.extensionHostEnv,
|
||||
isTrusted: result.isTrusted
|
||||
isTrusted: result.isTrusted,
|
||||
authenticationSession: result.authenticationSession ? { id: result.authenticationSession.id, providerId: result.authenticationSession.providerId } : undefined
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
@ -67,20 +67,20 @@ export class RemoteExtensionsInitializerContribution implements IWorkbenchContri
|
|||
}
|
||||
// Skip: No account is provided to initialize
|
||||
const resolvedAuthority = await this.remoteAuthorityResolverService.resolveAuthority(connection.remoteAuthority);
|
||||
if (!resolvedAuthority.options?.initializeUsingAccount) {
|
||||
if (!resolvedAuthority.options?.authenticationSession) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sessions = await this.authenticationService.getSessions(resolvedAuthority.options?.initializeUsingAccount.providerId);
|
||||
const session = sessions.find(s => s.id === resolvedAuthority.options?.initializeUsingAccount?.sessionId);
|
||||
const sessions = await this.authenticationService.getSessions(resolvedAuthority.options?.authenticationSession.providerId);
|
||||
const session = sessions.find(s => s.id === resolvedAuthority.options?.authenticationSession?.id);
|
||||
// Skip: Session is not found
|
||||
if (!session) {
|
||||
this.logService.info('Skipping initializing remote extensions because the account with given session id is not found', resolvedAuthority.options.initializeUsingAccount.sessionId);
|
||||
this.logService.info('Skipping initializing remote extensions because the account with given session id is not found', resolvedAuthority.options.authenticationSession.id);
|
||||
return;
|
||||
}
|
||||
|
||||
const userDataSyncStoreClient = this.instantiationService.createInstance(UserDataSyncStoreClient, this.userDataSyncStoreManagementService.userDataSyncStore.url);
|
||||
userDataSyncStoreClient.setAuthToken(session.accessToken, resolvedAuthority.options.initializeUsingAccount.providerId);
|
||||
userDataSyncStoreClient.setAuthToken(session.accessToken, resolvedAuthority.options.authenticationSession.providerId);
|
||||
const userData = await userDataSyncStoreClient.read(SyncResource.Extensions, null);
|
||||
|
||||
const serviceCollection = new ServiceCollection();
|
||||
|
|
|
@ -30,6 +30,13 @@ declare module 'vscode' {
|
|||
extensionHostEnv?: { [key: string]: string | null; };
|
||||
|
||||
isTrusted?: boolean;
|
||||
|
||||
/**
|
||||
* When provided, remote server will be initialized with the data synced using given user account.
|
||||
* **Note:** Initialization happens only when VSCode is opened in Desktop and only extensions are initialized as of now.
|
||||
*/
|
||||
// authenticationSession(ForInitialization|ForInitializingExtensions)?
|
||||
authenticationSession?: AuthenticationSession & { providerId: string };
|
||||
}
|
||||
|
||||
export interface TunnelPrivacy {
|
||||
|
|
Loading…
Reference in a new issue