Revert "Get authentication session info from workbench html in dev mode"

This reverts commit 2e8152ce75.
This commit is contained in:
Sandeep Somavarapu
2020-09-01 12:26:21 +02:00
parent 5f0a1f3b47
commit d1ce0eb43b
2 changed files with 12 additions and 39 deletions
@@ -14,11 +14,8 @@
<!-- Workbench Configuration -->
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONFIGURATION}}">
<!-- running out of sources -->
<!-- Builtin Extensions -->
<!-- Builtin Extensions (running out of sources) -->
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
<!-- Authentication Session Info -->
<meta id="vscode-workbench-authentication-session" data-settings="{{WORKBENCH_AUTHENTICATION_SESSION}}">
<!-- Workarounds/Hacks (remote user data uri) -->
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}">
@@ -19,7 +19,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IRequestService } from 'vs/platform/request/common/request';
import { CONFIGURATION_SYNC_STORE_KEY, IUserDataSyncStoreClient, SyncResource } from 'vs/platform/userDataSync/common/userDataSync';
import { URI } from 'vs/base/common/uri';
import { AuthenticationSessionInfo, getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
import { getSyncAreaLabel } from 'vs/workbench/services/userDataSync/common/userDataSync';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -80,13 +80,18 @@ export class UserDataInitializationService implements IUserDataInitializationSer
return;
}
const authenticationSession = await this.getCurrentAuthenticationSessionInfo();
if (!this.environmentService.options?.credentialsProvider) {
this.logService.trace(`Skipping initializing user data as credentials provider is not provided`);
return;
}
let authenticationSession;
try {
authenticationSession = await getCurrentAuthenticationSessionInfo(this.environmentService, this.productService);
} catch (error) {
this.logService.error(error);
}
if (!authenticationSession) {
if (!this.environmentService.options?.credentialsProvider) {
this.logService.trace(`Skipping initializing user data as credentials provider is not provided`);
return;
}
this.logService.trace(`Skipping initializing user data as authentication session is not set`);
return;
}
@@ -100,35 +105,6 @@ export class UserDataInitializationService implements IUserDataInitializationSer
return this._userDataSyncStoreClientPromise;
}
private async getCurrentAuthenticationSessionInfo(): Promise<AuthenticationSessionInfo | undefined> {
if (this.environmentService.options?.credentialsProvider) {
try {
const currentAuthenticationSessionInfo = await getCurrentAuthenticationSessionInfo(this.environmentService, this.productService);
if (currentAuthenticationSessionInfo) {
return currentAuthenticationSessionInfo;
}
} catch (error) {
this.logService.error(error);
return undefined;
}
}
if (!this.environmentService.isBuilt) {
const authenticationSessionInfoElement = document.getElementById('vscode-workbench-authentication-session');
const authenticationSessionInfoElementAttribute = authenticationSessionInfoElement ? authenticationSessionInfoElement.getAttribute('data-settings') : undefined;
if (authenticationSessionInfoElementAttribute) {
try {
return JSON.parse(authenticationSessionInfoElementAttribute);
} catch (error) {
this.logService.error(error);
return undefined;
}
}
}
return undefined;
}
async initializeRequiredResources(): Promise<void> {
return this.initialize([SyncResource.Settings, SyncResource.GlobalState]);
}