Skip to content

Commit

Permalink
master: azure active directory askForPassword. Fixes #375
Browse files Browse the repository at this point in the history
  • Loading branch information
mtxr committed Sep 28, 2019
1 parent 14c00f3 commit 2eb5efa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/dialect/mssql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as Utils from '@sqltools/core/utils';
import queries from './queries';
import GenericDialect from '@sqltools/core/dialect/generic';
import { DatabaseInterface } from '@sqltools/core/plugin-api';
import get from 'lodash/get';

export default class MSSQL extends GenericDialect<MSSQLLib.ConnectionPool> implements ConnectionDialect {
queries = queries;
Expand All @@ -28,6 +29,12 @@ export default class MSSQL extends GenericDialect<MSSQLLib.ConnectionPool> imple
encryptAttempt = encryptOverride;
}

if (this.credentials.askForPassword && get(mssqlOptions, 'authentication.type') && get(mssqlOptions, 'authentication.options.userName')) {
mssqlOptions.authentication.options.password = mssqlOptions.authentication.options.password || this.credentials.password;
this.credentials.password = null;
}


const pool = new MSSQLLib.ConnectionPool(this.credentials.connectString || {
database: this.credentials.database,
connectionTimeout: this.credentials.connectionTimeout * 1000,
Expand Down

0 comments on commit 2eb5efa

Please sign in to comment.