Fix BDC auth (#16053)

This commit is contained in:
Charles Gagnon
2021-07-09 11:56:54 -07:00
committed by GitHub
parent 27823e9900
commit 0045193262
4 changed files with 7 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as constants from '../constants';
import { getIgnoreSslVerificationConfigSetting } from '../util/auth';
import { IFileSource, IHdfsOptions, FileSourceFactory } from './fileSources';
export class SqlClusterConnection {
@@ -56,6 +57,7 @@ export class SqlClusterConnection {
user: this.user,
path: 'gateway/default/webhdfs/v1',
requestParams: {
rejectUnauthorized: !getIgnoreSslVerificationConfigSetting()
}
};
if (this.isIntegratedAuth()) {

View File

@@ -18,7 +18,6 @@ import { WebHDFS, HdfsError } from '../hdfs/webhdfs';
import { PermissionStatus } from '../hdfs/aclEntry';
import { Mount, MountStatus } from '../hdfs/mount';
import { FileStatus, hdfsFileTypeToFileType } from '../hdfs/fileStatus';
import { getIgnoreSslVerificationConfigSetting } from '../util/auth';
const localize = nls.loadMessageBundle();
@@ -129,6 +128,7 @@ export interface IRequestParams {
timeout?: number;
agent?: https.Agent;
headers?: {};
rejectUnauthorized?: boolean;
}
export class FileSourceFactory {
@@ -143,19 +143,7 @@ export class FileSourceFactory {
public async createHdfsFileSource(options: IHdfsOptions): Promise<IFileSource> {
options = options && options.host ? FileSourceFactory.removePortFromHost(options) : options;
let requestParams: IRequestParams = options.requestParams ? options.requestParams : {};
if (requestParams.auth || requestParams.isKerberos) {
let agentOptions = {
host: options.host,
port: options.port,
path: constants.hdfsRootPath,
rejectUnauthorized: !getIgnoreSslVerificationConfigSetting()
};
let agent = new https.Agent(agentOptions);
requestParams['agent'] = agent;
}
return new HdfsFileSource(WebHDFS.createClient(options, requestParams));
return new HdfsFileSource(WebHDFS.createClient(options));
}
// remove port from host when port is specified after a comma or colon