mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix BDC auth (#16053)
This commit is contained in:
@@ -20,9 +20,7 @@ class SslAuth implements Authentication {
|
|||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
applyToRequest(requestOptions: request.Options): void {
|
applyToRequest(requestOptions: request.Options): void {
|
||||||
requestOptions['agentOptions'] = {
|
requestOptions.rejectUnauthorized = !getIgnoreSslVerificationConfigSetting();
|
||||||
rejectUnauthorized: !getIgnoreSslVerificationConfigSetting()
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -961,7 +961,7 @@ export class WebHDFS {
|
|||||||
this.unlink(path, recursive, callback);
|
this.unlink(path, recursive, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createClient(opts: IHdfsOptions, requestParams: IRequestParams): WebHDFS {
|
public static createClient(opts: IHdfsOptions): WebHDFS {
|
||||||
return new WebHDFS(
|
return new WebHDFS(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{
|
{
|
||||||
@@ -971,7 +971,7 @@ export class WebHDFS {
|
|||||||
},
|
},
|
||||||
opts || {}
|
opts || {}
|
||||||
),
|
),
|
||||||
requestParams
|
opts.requestParams ?? { }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import * as nls from 'vscode-nls';
|
|||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import * as constants from '../constants';
|
import * as constants from '../constants';
|
||||||
|
import { getIgnoreSslVerificationConfigSetting } from '../util/auth';
|
||||||
import { IFileSource, IHdfsOptions, FileSourceFactory } from './fileSources';
|
import { IFileSource, IHdfsOptions, FileSourceFactory } from './fileSources';
|
||||||
|
|
||||||
export class SqlClusterConnection {
|
export class SqlClusterConnection {
|
||||||
@@ -56,6 +57,7 @@ export class SqlClusterConnection {
|
|||||||
user: this.user,
|
user: this.user,
|
||||||
path: 'gateway/default/webhdfs/v1',
|
path: 'gateway/default/webhdfs/v1',
|
||||||
requestParams: {
|
requestParams: {
|
||||||
|
rejectUnauthorized: !getIgnoreSslVerificationConfigSetting()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (this.isIntegratedAuth()) {
|
if (this.isIntegratedAuth()) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { WebHDFS, HdfsError } from '../hdfs/webhdfs';
|
|||||||
import { PermissionStatus } from '../hdfs/aclEntry';
|
import { PermissionStatus } from '../hdfs/aclEntry';
|
||||||
import { Mount, MountStatus } from '../hdfs/mount';
|
import { Mount, MountStatus } from '../hdfs/mount';
|
||||||
import { FileStatus, hdfsFileTypeToFileType } from '../hdfs/fileStatus';
|
import { FileStatus, hdfsFileTypeToFileType } from '../hdfs/fileStatus';
|
||||||
import { getIgnoreSslVerificationConfigSetting } from '../util/auth';
|
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -129,6 +128,7 @@ export interface IRequestParams {
|
|||||||
timeout?: number;
|
timeout?: number;
|
||||||
agent?: https.Agent;
|
agent?: https.Agent;
|
||||||
headers?: {};
|
headers?: {};
|
||||||
|
rejectUnauthorized?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileSourceFactory {
|
export class FileSourceFactory {
|
||||||
@@ -143,19 +143,7 @@ export class FileSourceFactory {
|
|||||||
|
|
||||||
public async createHdfsFileSource(options: IHdfsOptions): Promise<IFileSource> {
|
public async createHdfsFileSource(options: IHdfsOptions): Promise<IFileSource> {
|
||||||
options = options && options.host ? FileSourceFactory.removePortFromHost(options) : options;
|
options = options && options.host ? FileSourceFactory.removePortFromHost(options) : options;
|
||||||
let requestParams: IRequestParams = options.requestParams ? options.requestParams : {};
|
return new HdfsFileSource(WebHDFS.createClient(options));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove port from host when port is specified after a comma or colon
|
// remove port from host when port is specified after a comma or colon
|
||||||
|
|||||||
Reference in New Issue
Block a user