Initial AD support for BDCs (#6741)

Partially working AD support for BDCs with some known issues
- Plumbed through kerberos support to Notebooks.
  - Using "gateway-0" for service temporarily as service endpoints API doesn't yet return correct DNS name. Will update in separate PR once available
- Plumbed kerberos auth to HDFS, Spark. Only partially working as we use same token on each call 
  - Will fix in separate PR, as this requires a refactor of WebHDFS library. Will need to either get new token every time or set a cookie, both of which require refactors
- Fixed error when Data Service node expansion failed and blocked all OE expansion
- Support for SqlToolsService change to use new cluster endpoints DMV
  -  Updated API to add new endpoints field to replace IP + port
  - Added logic to handle case where endpoints for Yarn, Grafana etc. are in the list
  - Sort list and use expected new localized strings

- Updated SqlToolsService to include support for new DMV
- Add "gateway-0" handling in Jupyter session as workaround for lack of domain names in endpoints list
This commit is contained in:
Kevin Cunnane
2019-08-14 18:09:41 -07:00
committed by GitHub
parent 4e8c06f36d
commit 52f8984a99
31 changed files with 639 additions and 189 deletions

View File

@@ -232,36 +232,55 @@ export function getUserHome(): string {
return process.env.HOME || process.env.USERPROFILE;
}
export async function getClusterEndpoint(profileId: string, serviceName: string): Promise<IEndpoint> {
export function getClusterEndpoints(serverInfo: azdata.ServerInfo): IEndpoint[] | undefined {
let endpoints: RawEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
if (!endpoints || endpoints.length === 0) { return []; }
let serverInfo: azdata.ServerInfo = await azdata.connection.getServerInfo(profileId);
if (!serverInfo || !serverInfo.options) {
return undefined;
return endpoints.map(e => {
// If endpoint is missing, we're on CTP bits. All endpoints from the CTP serverInfo should be treated as HTTPS
let endpoint = e.endpoint ? e.endpoint : `https://${e.ipAddress}:${e.port}`;
let updatedEndpoint: IEndpoint = {
serviceName: e.serviceName,
description: e.description,
endpoint: endpoint,
protocol: e.protocol
};
return updatedEndpoint;
});
}
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]
};
}
let endpoints: IEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
if (!endpoints || endpoints.length === 0) {
return undefined;
}
let index = endpoints.findIndex(ep => ep.serviceName === serviceName);
if (index === -1) {
return undefined;
}
let clusterEndpoint: IEndpoint = {
serviceName: endpoints[index].serviceName,
ipAddress: endpoints[index].ipAddress,
port: endpoints[index].port,
isHyperlink: false,
hyperlink: null
return {
host: authority,
port: undefined
};
return clusterEndpoint;
}
interface RawEndpoint {
serviceName: string;
description?: string;
endpoint?: string;
protocol?: string;
ipAddress?: string;
port?: number;
}
export interface IEndpoint {
serviceName: string;
ipAddress: string;
port: number;
isHyperlink: boolean;
hyperlink: string;
description: string;
endpoint: string;
protocol: string;
}
export function isValidNumber(maybeNumber: any) {