Using new `microsoft-authentication.implementation` setting
This commit is contained in:
Tyler James Leonhardt 2024-11-20 13:15:09 -08:00 коммит произвёл GitHub
Родитель 2e93ebce77
Коммит d12854f6ba
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -100,9 +100,18 @@
{
"title": "Microsoft",
"properties": {
"microsoft.useMsal": {
"type": "boolean",
"description": "%useMsal.description%",
"microsoft-authentication.implementation": {
"type": "string",
"default": "msal",
"enum": [
"msal",
"classic"
],
"enumDescriptions": [
"%microsoft-authentication.implementation.enumDescriptions.msal%",
"%microsoft-authentication.implementation.enumDescriptions.classic%"
],
"description": "%microsoft-authentication.implementation.description%",
"tags": [
"onExP",
"preview"

Просмотреть файл

@ -3,7 +3,9 @@
"description": "Microsoft authentication provider",
"signIn": "Sign In",
"signOut": "Sign Out",
"useMsal.description": "Use the Microsoft Authentication Library (MSAL) to sign in with a Microsoft account.",
"microsoft-authentication.implementation.description": "The authentication implementation to use for signing in with a Microsoft account.",
"microsoft-authentication.implementation.enumDescriptions.msal": "Use the Microsoft Authentication Library (MSAL) to sign in with a Microsoft account.",
"microsoft-authentication.implementation.enumDescriptions.classic": "Use the classic authentication flow to sign in with a Microsoft account.",
"microsoft-sovereign-cloud.environment.description": {
"message": "The Sovereign Cloud to use for authentication. If you select `custom`, you must also set the `#microsoft-sovereign-cloud.customEnvironment#` setting.",
"comment": [

Просмотреть файл

@ -13,18 +13,18 @@ import Logger from './logger';
function shouldUseMsal(expService: IExperimentationService): boolean {
// First check if there is a setting value to allow user to override the default
const inspect = workspace.getConfiguration('microsoft').inspect<boolean>('useMsal');
const inspect = workspace.getConfiguration('microsoft-authentication').inspect<'msal' | 'classic'>('implementation');
if (inspect?.workspaceFolderValue !== undefined) {
Logger.debug(`Acquired MSAL enablement value from 'workspaceFolderValue'. Value: ${inspect.workspaceFolderValue}`);
return inspect.workspaceFolderValue;
return inspect.workspaceFolderValue === 'msal';
}
if (inspect?.workspaceValue !== undefined) {
Logger.debug(`Acquired MSAL enablement value from 'workspaceValue'. Value: ${inspect.workspaceValue}`);
return inspect.workspaceValue;
return inspect.workspaceValue === 'msal';
}
if (inspect?.globalValue !== undefined) {
Logger.debug(`Acquired MSAL enablement value from 'globalValue'. Value: ${inspect.globalValue}`);
return inspect.globalValue;
return inspect.globalValue === 'msal';
}
// Then check if the experiment value
@ -36,7 +36,7 @@ function shouldUseMsal(expService: IExperimentationService): boolean {
Logger.debug('Acquired MSAL enablement value from default. Value: false');
// If no setting or experiment value is found, default to false
return false;
return true;
}
let useMsal: boolean | undefined;
@ -50,7 +50,7 @@ export async function activate(context: ExtensionContext) {
useMsal = shouldUseMsal(expService);
context.subscriptions.push(workspace.onDidChangeConfiguration(async e => {
if (!e.affectsConfiguration('microsoft.useMsal') || useMsal === shouldUseMsal(expService)) {
if (!e.affectsConfiguration('microsoft-authentication.implementation') || useMsal === shouldUseMsal(expService)) {
return;
}