提交 5f8dec83 编写于 作者: S Sandeep Somavarapu

enable auth by config

上级 22caeb97
...@@ -8,6 +8,7 @@ import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth ...@@ -8,6 +8,7 @@ import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth
import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials';
import { Disposable } from 'vs/base/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle';
import { IProductService } from 'vs/platform/product/common/productService'; import { IProductService } from 'vs/platform/product/common/productService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const SERVICE_NAME = 'VS Code'; const SERVICE_NAME = 'VS Code';
const ACCOUNT = 'MyAccount'; const ACCOUNT = 'MyAccount';
...@@ -23,9 +24,10 @@ export class AuthTokenService extends Disposable implements IAuthTokenService { ...@@ -23,9 +24,10 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
constructor( constructor(
@ICredentialsService private readonly credentialsService: ICredentialsService, @ICredentialsService private readonly credentialsService: ICredentialsService,
@IProductService productService: IProductService, @IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
) { ) {
super(); super();
if (productService.settingsSyncStoreUrl) { if (productService.settingsSyncStoreUrl && configurationService.getValue('configurationSync.enableAuth')) {
this._status = AuthTokenStatus.Inactive; this._status = AuthTokenStatus.Inactive;
this.getToken().then(token => { this.getToken().then(token => {
if (token) { if (token) {
......
...@@ -63,6 +63,12 @@ export function registerConfiguration(): IDisposable { ...@@ -63,6 +63,12 @@ export function registerConfiguration(): IDisposable {
$ref: ignoredSettingsSchemaId, $ref: ignoredSettingsSchemaId,
additionalProperties: true, additionalProperties: true,
uniqueItems: 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
} }
} }
}); });
......
...@@ -26,6 +26,7 @@ interface IConfiguration extends IWindowsConfiguration { ...@@ -26,6 +26,7 @@ interface IConfiguration extends IWindowsConfiguration {
telemetry: { enableCrashReporter: boolean }; telemetry: { enableCrashReporter: boolean };
workbench: { list: { horizontalScrolling: boolean } }; workbench: { list: { horizontalScrolling: boolean } };
debug: { console: { wordWrap: boolean } }; debug: { console: { wordWrap: boolean } };
configurationSync: { enableAuth: boolean };
} }
export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution { export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution {
...@@ -38,6 +39,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo ...@@ -38,6 +39,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
private enableCrashReporter: boolean | undefined; private enableCrashReporter: boolean | undefined;
private treeHorizontalScrolling: boolean | undefined; private treeHorizontalScrolling: boolean | undefined;
private debugConsoleWordWrap: boolean | undefined; private debugConsoleWordWrap: boolean | undefined;
private enableConfigSyncAuth: boolean | undefined;
constructor( constructor(
@IHostService private readonly hostService: IHostService, @IHostService private readonly hostService: IHostService,
...@@ -105,6 +107,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo ...@@ -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) // Notify only when changed and we are the focused window (avoids notification spam across windows)
if (notify && changed) { if (notify && changed) {
this.doConfirm( this.doConfirm(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册