mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Fix BDC auth (#16053)
This commit is contained in:
@@ -20,9 +20,7 @@ class SslAuth implements Authentication {
|
||||
constructor() { }
|
||||
|
||||
applyToRequest(requestOptions: request.Options): void {
|
||||
requestOptions['agentOptions'] = {
|
||||
rejectUnauthorized: !getIgnoreSslVerificationConfigSetting()
|
||||
};
|
||||
requestOptions.rejectUnauthorized = !getIgnoreSslVerificationConfigSetting();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -961,7 +961,7 @@ export class WebHDFS {
|
||||
this.unlink(path, recursive, callback);
|
||||
}
|
||||
|
||||
public static createClient(opts: IHdfsOptions, requestParams: IRequestParams): WebHDFS {
|
||||
public static createClient(opts: IHdfsOptions): WebHDFS {
|
||||
return new WebHDFS(
|
||||
Object.assign(
|
||||
{
|
||||
@@ -971,7 +971,7 @@ export class WebHDFS {
|
||||
},
|
||||
opts || {}
|
||||
),
|
||||
requestParams
|
||||
opts.requestParams ?? { }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user