From 67c0acb99f4eed8b9fff54f8198701fb8adb6426 Mon Sep 17 00:00:00 2001 From: Parker Bibus Date: Tue, 9 Jul 2024 16:37:29 -0700 Subject: [PATCH] Update packages to get orchardcore building again. Also fixed two build errors from using updated SDK including disabling SYSLIB0057 for X509Certificate2 initialization and specified AllowAnonymous attributes. --- src/OrchardCore.Build/Dependencies.props | 30 ++++++++++--------- .../Controllers/ContentApiController.cs | 4 ++- .../OrchardCore.MiniProfiler.csproj | 1 + .../Services/OpenIdServerService.cs | 6 ++-- .../OrchardCore.Queries.csproj | 2 +- .../OrchardCore.Data.YesSql.csproj | 1 + 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/OrchardCore.Build/Dependencies.props b/src/OrchardCore.Build/Dependencies.props index 7b4e58c58e2..7d4b8861777 100644 --- a/src/OrchardCore.Build/Dependencies.props +++ b/src/OrchardCore.Build/Dependencies.props @@ -29,30 +29,31 @@ - + - + - + - - + + - + + @@ -64,20 +65,21 @@ - + - - + + + - - - - - + + + + + diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/Controllers/ContentApiController.cs b/src/OrchardCore.Modules/OrchardCore.Demo/Controllers/ContentApiController.cs index 09ba8def915..42cccaa112d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/Controllers/ContentApiController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Demo/Controllers/ContentApiController.cs @@ -7,7 +7,7 @@ namespace OrchardCore.Demo.Controllers { [Route("api/demo")] - [Authorize(AuthenticationSchemes = "Api"), IgnoreAntiforgeryToken, AllowAnonymous] + [Authorize(AuthenticationSchemes = "Api"), IgnoreAntiforgeryToken] [ApiController] public class ContentApiController : Controller { @@ -20,6 +20,7 @@ public ContentApiController(IAuthorizationService authorizationService, IContent _contentManager = contentManager; } + [AllowAnonymous] public async Task GetById(string id) { var contentItem = await _contentManager.GetAsync(id); @@ -32,6 +33,7 @@ public async Task GetById(string id) return new ObjectResult(contentItem); } + [AllowAnonymous] public async Task GetAuthorizedById(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.DemoAPIAccess)) diff --git a/src/OrchardCore.Modules/OrchardCore.MiniProfiler/OrchardCore.MiniProfiler.csproj b/src/OrchardCore.Modules/OrchardCore.MiniProfiler/OrchardCore.MiniProfiler.csproj index 3aff8584cac..a3a1a1b6699 100644 --- a/src/OrchardCore.Modules/OrchardCore.MiniProfiler/OrchardCore.MiniProfiler.csproj +++ b/src/OrchardCore.Modules/OrchardCore.MiniProfiler/OrchardCore.MiniProfiler.csproj @@ -21,6 +21,7 @@ + diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs index 381f4185c9c..b8d0f2d731a 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs @@ -522,8 +522,9 @@ async Task GetCertificateAsync(string path) var flags = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? X509KeyStorageFlags.EphemeralKeySet : X509KeyStorageFlags.MachineKeySet; - + #pragma warning disable SYSLIB0057 // Warning disabled per https://github.com/dotnet/docs/issues/41662, TODO: Update to use X509CertificateLoader.LoadPkcs12FromFile we are able to use it (will need to version block with this regardless). return new X509Certificate2(path, password, flags); + #pragma warning restore SYSLIB0057 } // Some cloud platforms (e.g Azure App Service/Antares) are known to fail to import .pfx files if the // private key is not persisted or marked as exportable. To ensure X.509 certificates can be correctly @@ -533,11 +534,12 @@ async Task GetCertificateAsync(string path) { _logger.LogDebug(exception, "A first-chance exception occurred while trying to extract " + "a X.509 certificate with the default key storage options."); - + #pragma warning disable SYSLIB0057 // Warning disabled per https://github.com/dotnet/docs/issues/41662, TODO: Update to use X509CertificateLoader.LoadPkcs12FromFile we are able to use it (will need to version block with this regardless). return new X509Certificate2(path, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); + #pragma warning restore SYSLIB0057 } // Don't swallow exceptions thrown from the catch handler to ensure unrecoverable exceptions // (e.g caused by malformed X.509 certificates or invalid password) are correctly logged. diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/OrchardCore.Queries.csproj b/src/OrchardCore.Modules/OrchardCore.Queries/OrchardCore.Queries.csproj index 9a57b3388ca..56031665529 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/OrchardCore.Queries.csproj +++ b/src/OrchardCore.Modules/OrchardCore.Queries/OrchardCore.Queries.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCore.Data.YesSql.csproj b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCore.Data.YesSql.csproj index a65f4fd132c..975802e05ec 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCore.Data.YesSql.csproj +++ b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCore.Data.YesSql.csproj @@ -26,6 +26,7 @@ +