diff --git a/src/vs/platform/auth/common/authTokenService.ts b/src/vs/platform/auth/common/authTokenService.ts index 3f2878311af3aadf2d21560cc0e3feb1a59fa1e5..322ecfb2b09ceeef1fb70f611edd9a258fab1c7b 100644 --- a/src/vs/platform/auth/common/authTokenService.ts +++ b/src/vs/platform/auth/common/authTokenService.ts @@ -8,6 +8,7 @@ import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { Disposable } from 'vs/base/common/lifecycle'; import { IProductService } from 'vs/platform/product/common/productService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const SERVICE_NAME = 'VS Code'; const ACCOUNT = 'MyAccount'; @@ -23,9 +24,10 @@ export class AuthTokenService extends Disposable implements IAuthTokenService { constructor( @ICredentialsService private readonly credentialsService: ICredentialsService, @IProductService productService: IProductService, + @IConfigurationService configurationService: IConfigurationService, ) { super(); - if (productService.settingsSyncStoreUrl) { + if (productService.settingsSyncStoreUrl && configurationService.getValue('configurationSync.enableAuth')) { this._status = AuthTokenStatus.Inactive; this.getToken().then(token => { if (token) { diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index 942a4a3b318a8bb74e257c0ca9612c0d40570f16..6578b2a30b12b30d267f2cac7c0246c171a02386 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -63,6 +63,12 @@ export function registerConfiguration(): IDisposable { $ref: ignoredSettingsSchemaId, additionalProperties: true, uniqueItems: true + }, + 'configurationSync.enableAuth': { + 'type': 'boolean', + description: localize('configurationSync.enableAuth', "Enables authentication and requires VS Code restart when changed"), + 'default': false, + 'scope': ConfigurationScope.APPLICATION } } }); diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 7384ae902f001fbf34ac0099f6bffb02fd5fda29..9f01d0a244504c98bdb6668e7ec345cb03e70f09 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -26,6 +26,7 @@ interface IConfiguration extends IWindowsConfiguration { telemetry: { enableCrashReporter: boolean }; workbench: { list: { horizontalScrolling: boolean } }; debug: { console: { wordWrap: boolean } }; + configurationSync: { enableAuth: boolean }; } export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution { @@ -38,6 +39,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo private enableCrashReporter: boolean | undefined; private treeHorizontalScrolling: boolean | undefined; private debugConsoleWordWrap: boolean | undefined; + private enableConfigSyncAuth: boolean | undefined; constructor( @IHostService private readonly hostService: IHostService, @@ -105,6 +107,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo } } + // Configuration Sync Auth + if (config.configurationSync && typeof config.configurationSync.enableAuth === 'boolean' && config.configurationSync.enableAuth !== this.enableConfigSyncAuth) { + this.enableConfigSyncAuth = config.configurationSync.enableAuth; + changed = true; + } + // Notify only when changed and we are the focused window (avoids notification spam across windows) if (notify && changed) { this.doConfirm(