mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fetch password from credential store before connecting to knox endpoint (#10666)
* Fetch password from credential store before connecting to knox endpoint * Add combined code coverage script * Revert "Add combined code coverage script" This reverts commit e538f2fb2a79993a77f749f384fbc306b18b9f64.
This commit is contained in:
@@ -282,6 +282,10 @@ export class JupyterSession implements nb.ISession {
|
|||||||
// %_do_not_call_change_endpoint is a SparkMagic command that lets users change endpoint options,
|
// %_do_not_call_change_endpoint is a SparkMagic command that lets users change endpoint options,
|
||||||
// such as user/profile/host name/auth type
|
// such as user/profile/host name/auth type
|
||||||
|
|
||||||
|
let credentials;
|
||||||
|
if (!this.isIntegratedAuth(connectionProfile)) {
|
||||||
|
credentials = await connection.getCredentials(connectionProfile.id);
|
||||||
|
}
|
||||||
//Update server info with bigdata endpoint - Unified Connection
|
//Update server info with bigdata endpoint - Unified Connection
|
||||||
if (connectionProfile.providerName === SQL_PROVIDER) {
|
if (connectionProfile.providerName === SQL_PROVIDER) {
|
||||||
const endpoints = await this.getClusterEndpoints(connectionProfile.id);
|
const endpoints = await this.getClusterEndpoints(connectionProfile.id);
|
||||||
@@ -296,16 +300,16 @@ export class JupyterSession implements nb.ISession {
|
|||||||
// as a default now we'll still fall back to root if it's empty for some reason. (but the calls below should
|
// as a default now we'll still fall back to root if it's empty for some reason. (but the calls below should
|
||||||
// get the actual correct value regardless)
|
// get the actual correct value regardless)
|
||||||
connectionProfile.options[USER] = connectionProfile.userName || 'root';
|
connectionProfile.options[USER] = connectionProfile.userName || 'root';
|
||||||
|
if (!this.isIntegratedAuth(connectionProfile)) {
|
||||||
try {
|
try {
|
||||||
const bdcApi = <bdc.IExtension>await vscode.extensions.getExtension(bdc.constants.extensionName).activate();
|
const bdcApi = <bdc.IExtension>await vscode.extensions.getExtension(bdc.constants.extensionName).activate();
|
||||||
const controllerEndpoint = endpoints.find(ep => ep.serviceName.toLowerCase() === CONTROLLER_ENDPOINT);
|
const controllerEndpoint = endpoints.find(ep => ep.serviceName.toLowerCase() === CONTROLLER_ENDPOINT);
|
||||||
const controller = bdcApi.getClusterController(controllerEndpoint.endpoint, 'basic', connectionProfile.userName, connectionProfile.password);
|
const controller = bdcApi.getClusterController(controllerEndpoint.endpoint, 'basic', connectionProfile.userName, credentials.password);
|
||||||
connectionProfile.options[USER] = await controller.getKnoxUsername(connectionProfile.userName);
|
connectionProfile.options[USER] = await controller.getKnoxUsername(connectionProfile.userName);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Unexpected error getting Knox username for Spark kernel: ${err}`);
|
console.log(`Unexpected error getting Knox username for Spark kernel: ${err}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
connectionProfile.options[KNOX_ENDPOINT_PORT] = this.getKnoxPortOrDefault(connectionProfile);
|
connectionProfile.options[KNOX_ENDPOINT_PORT] = this.getKnoxPortOrDefault(connectionProfile);
|
||||||
@@ -318,7 +322,7 @@ export class JupyterSession implements nb.ISession {
|
|||||||
if (this.isIntegratedAuth(connectionProfile)) {
|
if (this.isIntegratedAuth(connectionProfile)) {
|
||||||
doNotCallChangeEndpointParams = `%_do_not_call_change_endpoint --server=${server} --auth=Kerberos`;
|
doNotCallChangeEndpointParams = `%_do_not_call_change_endpoint --server=${server} --auth=Kerberos`;
|
||||||
} else {
|
} else {
|
||||||
const credentials = await connection.getCredentials(connectionProfile.id);
|
|
||||||
doNotCallChangeEndpointParams = `%_do_not_call_change_endpoint --username=${connectionProfile.options[USER]} --password=${credentials.password} --server=${server} --auth=Basic_Access`;
|
doNotCallChangeEndpointParams = `%_do_not_call_change_endpoint --username=${connectionProfile.options[USER]} --password=${credentials.password} --server=${server} --auth=Basic_Access`;
|
||||||
}
|
}
|
||||||
let future = this.sessionImpl.kernel.requestExecute({
|
let future = this.sessionImpl.kernel.requestExecute({
|
||||||
|
|||||||
Reference in New Issue
Block a user