Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support active directory pwd authentication #8565

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/mssql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@
{
"displayName": "%mssql.connectionOptions.authType.categoryValues.azureMFA%",
"name": "AzureMFA"
},
{
"displayName": "%mssql.connectionOptions.authType.categoryValues.activeDirectoryPassword%",
"name": "ActiveDirectoryPassword"
}
],
"isRequired": true,
Expand Down
1 change: 1 addition & 0 deletions extensions/mssql/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"mssql.connectionOptions.authType.categoryValues.sqlLogin": "SQL Login",
"mssql.connectionOptions.authType.categoryValues.integrated": "Windows Authentication",
"mssql.connectionOptions.authType.categoryValues.azureMFA": "Azure Active Directory - Universal with MFA support",
"mssql.connectionOptions.authType.categoryValues.activeDirectoryPassword": "Active Directory - Password",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is the "best" name we have for this option? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want a better name! Have any suggestions?

"mssql.connectionOptions.userName.displayName": "User name",
"mssql.connectionOptions.userName.description": "Indicates the user ID to be used when connecting to the data source",
"mssql.connectionOptions.password.displayName": "Password",
Expand Down
1 change: 1 addition & 0 deletions src/sql/platform/connection/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const sqlLogin = 'SqlLogin';
export const integrated = 'Integrated';
export const azureMFA = 'AzureMFA';
export const azureMFAAndUser = 'AzureMFAAndUser';
export const activeDirectoryPassword = 'ActiveDirectoryPassword';

/* CMS constants */
export const cmsProviderName = 'MSSQL-CMS';
Expand Down
13 changes: 11 additions & 2 deletions src/sql/workbench/services/connection/browser/connectionWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export enum AuthenticationType {
SqlLogin = 'SqlLogin',
Integrated = 'Integrated',
AzureMFA = 'AzureMFA',
AzureMFAAndUser = 'AzureMFAAndUser'
AzureMFAAndUser = 'AzureMFAAndUser',
ActiveDirectoryPassword = 'ActiveDirectoryPassword'
}

export class ConnectionWidget extends lifecycle.Disposable {
Expand Down Expand Up @@ -76,7 +77,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
protected _databaseNameInputBox: Dropdown;
protected _advancedButton: Button;
private static readonly _authTypes: AuthenticationType[] =
[AuthenticationType.AzureMFA, AuthenticationType.AzureMFAAndUser, AuthenticationType.Integrated, AuthenticationType.SqlLogin];
[AuthenticationType.AzureMFA, AuthenticationType.AzureMFAAndUser, AuthenticationType.Integrated, AuthenticationType.SqlLogin, AuthenticationType.ActiveDirectoryPassword];
private static readonly _osByName = {
Windows: OperatingSystem.Windows,
Macintosh: OperatingSystem.Macintosh,
Expand Down Expand Up @@ -481,6 +482,14 @@ export class ConnectionWidget extends lifecycle.Disposable {
this._rememberPasswordCheckBox.enabled = true;
}

if (currentAuthType === AuthenticationType.ActiveDirectoryPassword) {
this._userNameInputBox.enable();
this._passwordInputBox.enable();
this._password = '';
this._rememberPasswordCheckBox.checked = false;
this._rememberPasswordCheckBox.enabled = false;
}

if (currentAuthType === AuthenticationType.AzureMFA) {
this.fillInAzureAccountOptions().then(async () => {
// Don't enable the control until we've populated it
Expand Down