mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 17:23:42 -05:00
Validate MSAL library is enabled (#23000)
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { enableSqlAuthenticationProviderConfig, mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { azureAuthenticationLibraryConfig, enableSqlAuthenticationProviderConfig, mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { MSAL_AUTH_LIBRARY } from 'sql/workbench/services/accountManagement/utils';
|
||||
|
||||
/**
|
||||
* Reads setting 'mssql.enableSqlAuthenticationProvider' returns true if it's enabled.
|
||||
@@ -13,6 +14,17 @@ import { enableSqlAuthenticationProviderConfig, mssqlProviderName } from 'sql/pl
|
||||
* @param configService Configuration service instance
|
||||
* @returns True if provider is MSSQL and Sql Auth provider is enabled.
|
||||
*/
|
||||
export function isMssqlAuthProviderEnabled(provider: string, configService: IConfigurationService): boolean {
|
||||
return provider === mssqlProviderName && (configService?.getValue(enableSqlAuthenticationProviderConfig) ?? true);
|
||||
export function isMssqlAuthProviderEnabled(provider: string, configService: IConfigurationService | undefined): boolean {
|
||||
return provider === mssqlProviderName && isMSALAuthLibraryEnabled(configService) && (configService?.getValue(enableSqlAuthenticationProviderConfig) ?? true);
|
||||
}
|
||||
|
||||
/**
|
||||
* We need Azure core extension configuration for fetching Authentication Library setting in use.
|
||||
* This is required for 'enableSqlAuthenticationProvider' to be enabled (as it applies to MSAL only).
|
||||
* This can be removed in future when ADAL support is dropped.
|
||||
* @param configService Configuration Service to use.
|
||||
* @returns true if MSAL_AUTH_LIBRARY is enabled.
|
||||
*/
|
||||
export function isMSALAuthLibraryEnabled(configService: IConfigurationService | undefined): boolean {
|
||||
return configService?.getValue(azureAuthenticationLibraryConfig) === MSAL_AUTH_LIBRARY /*default*/ ?? true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user