disable askpass, terminal and github auth when git is disabled

fixes #97320
This commit is contained in:
João Moreno 2020-05-12 13:37:00 +02:00
parent 07a951e056
commit 5185d7e6f8
3 changed files with 12 additions and 3 deletions

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { window, InputBoxOptions, Uri, OutputChannel, Disposable } from 'vscode';
import { window, InputBoxOptions, Uri, OutputChannel, Disposable, workspace } from 'vscode';
import { IDisposable, EmptyDisposable, toDisposable } from './util';
import * as path from 'path';
import { IIPCHandler, IIPCServer, createIPCServer } from './ipc/ipcServer';
@ -31,6 +31,13 @@ export class Askpass implements IIPCHandler {
}
async handle({ request, host }: { request: string, host: string }): Promise<string> {
const config = workspace.getConfiguration('git', null);
const enabled = config.get<boolean>('enabled');
if (!enabled) {
return '';
}
const uri = Uri.parse(host);
const authority = uri.authority.replace(/^.*@/, '');
const password = /password/i.test(request);

View file

@ -56,7 +56,8 @@ export class GithubCredentialProviderManager {
}
private refresh(): void {
this.enabled = workspace.getConfiguration('git', null).get('githubAuthentication', true);
const config = workspace.getConfiguration('git', null);
this.enabled = config.get<boolean>('enabled', true) && config.get('githubAuthentication', true);
}
dispose(): void {

View file

@ -34,7 +34,8 @@ export class TerminalEnvironmentManager {
}
private refresh(): void {
this.enabled = workspace.getConfiguration('git', null).get('terminalAuthentication', true);
const config = workspace.getConfiguration('git', null);
this.enabled = config.get<boolean>('enabled', true) && config.get('terminalAuthentication', true);
}
dispose(): void {