Fix/controller ad (#7445)

Reapply my previous commit
add kerberos to excludes in the webpack for the extension
Fixes #7443
Verified on Windows and MacOS
This commit is contained in:
Kevin Cunnane
2019-10-01 14:52:09 -07:00
committed by GitHub
parent 7162272f1e
commit ee98ce5c18
16 changed files with 2245 additions and 107 deletions

View File

@@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as kerberos from 'kerberos';
import * as vscode from 'vscode';
export async function authenticateKerberos(hostname: string): Promise<string> {
const service = 'HTTP' + (process.platform === 'win32' ? '/' : '@') + hostname;
const mechOID = kerberos.GSS_MECH_OID_KRB5;
let client = await kerberos.initializeClient(service, { mechOID });
let response = await client.step('');
return response;
}
export type HostAndIp = { host: string, port: string };
export function getHostAndPortFromEndpoint(endpoint: string): HostAndIp {
let authority = vscode.Uri.parse(endpoint).authority;
let hostAndPortRegex = /^(.*)([,:](\d+))/g;
let match = hostAndPortRegex.exec(authority);
if (match) {
return {
host: match[1],
port: match[3]
};
}
return {
host: authority,
port: undefined
};
}