From de60815446d78a9a09cd67560e598b183d663d54 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Mon, 7 Oct 2024 04:20:23 +0300 Subject: [PATCH] Don't use JsonObject.Merge() in Azure AD Deployment Source (#16841) --- .../Deployment/AzureADDeploymentSource.cs | 13 ++++++------- .../MicrosoftAccountStartup.cs | 13 +++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentSource.cs index efb866c0195..5c000df3863 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentSource.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentSource.cs @@ -1,4 +1,3 @@ -using System.Text.Json; using System.Text.Json.Nodes; using OrchardCore.Deployment; using OrchardCore.Microsoft.Authentication.Services; @@ -22,12 +21,12 @@ public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlan return; } - var settings = await _azureADService.GetSettingsAsync(); + var azureADSettings = await _azureADService.GetSettingsAsync(); - var obj = new JsonObject { ["name"] = nameof(AzureADSettings) }; - - obj.Merge(JObject.FromObject(settings, JOptions.Default)); - - result.Steps.Add(obj); + result.Steps.Add(new JsonObject + { + ["name"] = "Settings", + [nameof(AzureADSettings)] = JObject.FromObject(azureADSettings), + }); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs index c2356113657..ba0e26b5a84 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs @@ -32,16 +32,9 @@ public override void ConfigureServices(IServiceCollection services) services.AddRecipeExecutionStep(); services.AddTransient, MicrosoftAccountSettingsConfiguration>(); - - // Register the options initializers required by the Microsoft Account Handler. - services.TryAddEnumerable(new[] - { - // Orchard-specific initializers: - ServiceDescriptor.Transient, MicrosoftAccountOptionsConfiguration>(), - ServiceDescriptor.Transient, MicrosoftAccountOptionsConfiguration>(), - // Built-in initializers: - ServiceDescriptor.Transient, OAuthPostConfigureOptions>() - }); + services.AddTransient, MicrosoftAccountOptionsConfiguration>(); + services.AddTransient, MicrosoftAccountOptionsConfiguration>(); + services.AddTransient, OAuthPostConfigureOptions>(); } }