mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Add AuthenticationType enum to typings (#20699)
* Add AuthenticationType enum to typings * fix * const * Add comments * fix comment * remove unused
This commit is contained in:
@@ -9,6 +9,7 @@ import { ConnectionConfig } from 'sql/platform/connection/common/connectionConfi
|
||||
import { fixupConnectionCredentials } from 'sql/platform/connection/common/connectionInfo';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { AuthenticationType } from 'sql/platform/connection/common/constants';
|
||||
import { IConnectionProfile, ProfileMatcher } from 'sql/platform/connection/common/interfaces';
|
||||
import { ICredentialsService } from 'sql/platform/credentials/common/credentialsService';
|
||||
import { isDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -90,9 +91,9 @@ export class ConnectionStore {
|
||||
}
|
||||
return { profile: credentialsItem, savedCred: !!savedCred };
|
||||
});
|
||||
} else if (credentialsItem.authenticationType === 'AzureMFA' || credentialsItem.authenticationType === 'dstsAuth' && credentialsItem.azureAccount) {
|
||||
} else if (credentialsItem.authenticationType === AuthenticationType.AzureMFA || credentialsItem.authenticationType === AuthenticationType.DSTSAuth && credentialsItem.azureAccount) {
|
||||
return Promise.resolve({ profile: credentialsItem, savedCred: true });
|
||||
} else if (credentialsItem.authenticationType === 'None') {
|
||||
} else if (credentialsItem.authenticationType === AuthenticationType.None) {
|
||||
// Kusto supports no authentication
|
||||
return Promise.resolve({ profile: credentialsItem, savedCred: true });
|
||||
} else {
|
||||
|
||||
@@ -24,12 +24,35 @@ export const passwordChars = '***************';
|
||||
/* default authentication type setting name*/
|
||||
export const defaultAuthenticationType = 'defaultAuthenticationType';
|
||||
|
||||
/* authentication types */
|
||||
export const sqlLogin = 'SqlLogin';
|
||||
export const integrated = 'Integrated';
|
||||
export const azureMFA = 'AzureMFA';
|
||||
export const azureMFAAndUser = 'AzureMFAAndUser';
|
||||
export const dstsAuth = 'dstsAuth';
|
||||
/**
|
||||
* Well-known Authentication types commonly supported by connection providers.
|
||||
*/
|
||||
export enum AuthenticationType {
|
||||
/**
|
||||
* Username and password
|
||||
*/
|
||||
SqlLogin = 'SqlLogin',
|
||||
/**
|
||||
* Windows Authentication
|
||||
*/
|
||||
Integrated = 'Integrated',
|
||||
/**
|
||||
* Azure Active Directory - Universal with MFA support
|
||||
*/
|
||||
AzureMFA = 'AzureMFA',
|
||||
/**
|
||||
* Azure Active Directory - Password
|
||||
*/
|
||||
AzureMFAAndUser = 'AzureMFAAndUser',
|
||||
/**
|
||||
* Datacenter Security Token Service Authentication
|
||||
*/
|
||||
DSTSAuth = 'dstsAuth',
|
||||
/**
|
||||
* No authentication required
|
||||
*/
|
||||
None = 'None'
|
||||
}
|
||||
|
||||
/* CMS constants */
|
||||
export const cmsProviderName = 'MSSQL-CMS';
|
||||
|
||||
@@ -19,7 +19,6 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
options: { [name: string]: any } = {};
|
||||
|
||||
private _providerName?: string;
|
||||
private static readonly SqlAuthentication = 'SqlLogin';
|
||||
public static readonly ProviderPropertyName = 'providerName';
|
||||
|
||||
public constructor(
|
||||
@@ -194,7 +193,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
option => option.specialValueType === ConnectionOptionSpecialType.password)!; // i guess we are going to assume there is a password field
|
||||
let isPasswordRequired = optionMetadata.isRequired;
|
||||
if (this.providerName === Constants.mssqlProviderName) {
|
||||
isPasswordRequired = this.authenticationType === ProviderConnectionInfo.SqlAuthentication && optionMetadata.isRequired;
|
||||
isPasswordRequired = this.authenticationType === Constants.AuthenticationType.SqlLogin && optionMetadata.isRequired;
|
||||
}
|
||||
return isPasswordRequired;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user