From 156bcdc98a4a73525bdd8c76af1dd2a73378dc55 Mon Sep 17 00:00:00 2001 From: Nicklas Kramer Date: Tue, 26 Aug 2025 12:54:03 +0200 Subject: [PATCH] V17 - Removing obsoleted code from Umbraco.Web (#19983) * Removing obsoleted code from AspNetCoreCookieManager.cs & Dependencies * Removing obosoleted code from AspNetCoreBackOfficeInfo.cs * Removing obosoleted code from PublishedContentExtensions.cs * Removing obosoleted code from UmbracoMvcConfigureOptions.cs * Removing obosoleted code from UmbracoVirtualPageRoute.cs * Removing obsoleted constructor from BasicAuthenticationMiddleware.cs * Removing obsoleted constructors from UmbLoginController.cs * Removing unused constructor --- src/Umbraco.Core/Web/ICookieManager.cs | 22 +---- .../AspNetCore/AspNetCoreBackOfficeInfo.cs | 5 -- .../AspNetCore/AspNetCoreCookieManager.cs | 5 -- .../Extensions/PublishedContentExtensions.cs | 11 --- .../Mvc/UmbracoMvcConfigureOptions.cs | 7 -- .../Routing/UmbracoVirtualPageRoute.cs | 10 --- .../Controllers/UmbLoginController.cs | 84 ------------------- .../BasicAuthenticationMiddleware.cs | 9 -- 8 files changed, 1 insertion(+), 152 deletions(-) diff --git a/src/Umbraco.Core/Web/ICookieManager.cs b/src/Umbraco.Core/Web/ICookieManager.cs index 8893570735..6eaf2aafd9 100644 --- a/src/Umbraco.Core/Web/ICookieManager.cs +++ b/src/Umbraco.Core/Web/ICookieManager.cs @@ -17,23 +17,6 @@ public interface ICookieManager /// The cookie name. string? GetCookieValue(string cookieName); - /// - /// Sets the value of a cookie with the specified name. - /// - /// The cookie name. - /// The cookie value. - [Obsolete("Use overload with the httpOnly parameter instead. Scheduled for removal in V16.")] - void SetCookieValue(string cookieName, string value) => SetCookieValue(cookieName, value, false); - - /// - /// Sets the value of a cookie with the specified name. - /// - /// The cookie name. - /// The cookie value. - /// Indicates whether the created cookie should be marked as HTTP only. - [Obsolete("Use overload with the secure and sameSiteMode parameters instead. Scheduled for removal in V17.")] - void SetCookieValue(string cookieName, string value, bool httpOnly); - /// /// Sets the value of a cookie with the specified name. /// @@ -48,10 +31,7 @@ public interface ICookieManager /// This hasn't been used as the parameter directly to avoid a dependency on Microsoft.AspNetCore.Http in /// the core project. /// - void SetCookieValue(string cookieName, string value, bool httpOnly, bool secure, string sameSiteMode) -#pragma warning disable CS0618 // Type or member is obsolete - => SetCookieValue(cookieName, value, httpOnly); -#pragma warning restore CS0618 // Type or member is obsolete + void SetCookieValue(string cookieName, string value, bool httpOnly, bool secure, string sameSiteMode); /// /// Determines whether a cookie with the specified name exists. diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs index b1351d4d3d..2e893a2993 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs @@ -14,11 +14,6 @@ public class AspNetCoreBackOfficeInfo : IBackOfficeInfo public AspNetCoreBackOfficeInfo(IHostingEnvironment hostingEnviroment) => _hostingEnvironment = hostingEnviroment; - [Obsolete("The globalSettings parameter is not required anymore, use the other constructor instead. Scheduled for removal in Umbraco 17.")] - public AspNetCoreBackOfficeInfo(IOptionsMonitor globalSettings, IHostingEnvironment hostingEnviroment) - : this(hostingEnviroment) - { } - public string GetAbsoluteUrl { get diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreCookieManager.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreCookieManager.cs index 81a9aef5ea..854699cd29 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreCookieManager.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreCookieManager.cs @@ -41,11 +41,6 @@ public class AspNetCoreCookieManager : ICookieManager /// public string? GetCookieValue(string cookieName) => _httpContextAccessor.HttpContext?.Request.Cookies[cookieName]; - /// - [Obsolete("Use overload with the secure and sameSiteMode parameters instead. Scheduled for removal in V17.")] - public void SetCookieValue(string cookieName, string value, bool httpOnly) => - SetCookieValue(cookieName, value, httpOnly, false, SameSiteMode.Unspecified.ToString()); - /// public void SetCookieValue(string cookieName, string value, bool httpOnly, bool secure, string sameSiteMode) { diff --git a/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs b/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs index 640d73ad10..d4cde7a5cf 100644 --- a/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs @@ -17,17 +17,6 @@ public static class PublishedContentExtensions { #region Variations - [Obsolete("Use the overload with IPublishedStatusFilteringService, scheduled for removal in v17")] - public static string? GetCultureFromDomains( - this IPublishedContent content, - IUmbracoContextAccessor umbracoContextAccessor, - ISiteDomainMapper siteDomainHelper, - Uri? current = null) - { - IUmbracoContext umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext(); - return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper); - } - public static string? GetCultureFromDomains( this IPublishedContent content, IUmbracoContextAccessor umbracoContextAccessor, diff --git a/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs b/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs index 32769f6138..48493d4840 100644 --- a/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs +++ b/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs @@ -16,13 +16,6 @@ namespace Umbraco.Cms.Web.Common.Mvc; /// public class UmbracoMvcConfigureOptions : IConfigureOptions { - public UmbracoMvcConfigureOptions() - { } - - [Obsolete("The global settings is not required anymore, use the default constructor instead. Scheduled for removal in Umbraco 17.")] - public UmbracoMvcConfigureOptions(IOptions globalSettings) - { } - /// public void Configure(MvcOptions options) { diff --git a/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs b/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs index f8bbd8ec76..1a15961222 100644 --- a/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs +++ b/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs @@ -47,16 +47,6 @@ public class UmbracoVirtualPageRoute : IUmbracoVirtualPageRoute _umbracoContextAccessor = umbracoContextAccessor; } - [Obsolete("Please use constructor that takes an IUmbracoContextAccessor instead, scheduled for removal in v17")] - public UmbracoVirtualPageRoute( - EndpointDataSource endpointDataSource, - LinkParser linkParser, - UriUtility uriUtility, - IPublishedRouter publishedRouter) - : this(endpointDataSource, linkParser, uriUtility, publishedRouter, StaticServiceProvider.Instance.GetRequiredService()) - { - } - /// /// This sets up the virtual page route for the current request if a mtahcing endpoint is found. /// diff --git a/src/Umbraco.Web.Website/Controllers/UmbLoginController.cs b/src/Umbraco.Web.Website/Controllers/UmbLoginController.cs index ecad1a3484..3e415d1d09 100644 --- a/src/Umbraco.Web.Website/Controllers/UmbLoginController.cs +++ b/src/Umbraco.Web.Website/Controllers/UmbLoginController.cs @@ -26,7 +26,6 @@ public class UmbLoginController : SurfaceController private readonly IDocumentNavigationQueryService _navigationQueryService; private readonly IPublishedContentStatusFilteringService _publishedContentStatusFilteringService; - [ActivatorUtilitiesConstructor] public UmbLoginController( IUmbracoContextAccessor umbracoContextAccessor, IUmbracoDatabaseFactory databaseFactory, @@ -48,89 +47,6 @@ public class UmbLoginController : SurfaceController _publishedContentStatusFilteringService = publishedContentStatusFilteringService; } - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UmbLoginController( - IUmbracoContextAccessor umbracoContextAccessor, - IUmbracoDatabaseFactory databaseFactory, - ServiceContext services, - AppCaches appCaches, - IProfilingLogger profilingLogger, - IPublishedUrlProvider publishedUrlProvider, - IMemberSignInManager signInManager, - IMemberManager memberManager, - ITwoFactorLoginService twoFactorLoginService, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService) - : this( - umbracoContextAccessor, - databaseFactory, - services, - appCaches, - profilingLogger, - publishedUrlProvider, - signInManager, - memberManager, - twoFactorLoginService, - navigationQueryService, - publishedContentStatusFilteringService) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UmbLoginController( - IUmbracoContextAccessor umbracoContextAccessor, - IUmbracoDatabaseFactory databaseFactory, - ServiceContext services, - AppCaches appCaches, - IProfilingLogger profilingLogger, - IPublishedUrlProvider publishedUrlProvider, - IMemberSignInManager signInManager, - IMemberManager memberManager, - ITwoFactorLoginService twoFactorLoginService, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService) - : this( - umbracoContextAccessor, - databaseFactory, - services, - appCaches, - profilingLogger, - publishedUrlProvider, - signInManager, - memberManager, - twoFactorLoginService, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UmbLoginController( - IUmbracoContextAccessor umbracoContextAccessor, - IUmbracoDatabaseFactory databaseFactory, - ServiceContext services, - AppCaches appCaches, - IProfilingLogger profilingLogger, - IPublishedUrlProvider publishedUrlProvider, - IMemberSignInManager signInManager, - IMemberManager memberManager, - ITwoFactorLoginService twoFactorLoginService) - : this( - umbracoContextAccessor, - databaseFactory, - services, - appCaches, - profilingLogger, - publishedUrlProvider, - signInManager, - memberManager, - twoFactorLoginService, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()) - { - } - [HttpPost] [ValidateAntiForgeryToken] [ValidateUmbracoFormRouteString] diff --git a/src/Umbraco.Web.Website/Middleware/BasicAuthenticationMiddleware.cs b/src/Umbraco.Web.Website/Middleware/BasicAuthenticationMiddleware.cs index f473cf3677..58a88f31e2 100644 --- a/src/Umbraco.Web.Website/Middleware/BasicAuthenticationMiddleware.cs +++ b/src/Umbraco.Web.Website/Middleware/BasicAuthenticationMiddleware.cs @@ -34,15 +34,6 @@ public class BasicAuthenticationMiddleware : IMiddleware _backOfficePath = hostingEnvironment.GetBackOfficePath(); } - [Obsolete("The globalSettings parameter is not required anymore, use the other constructor instead. Scheduled for removal in Umbraco 17.")] - public BasicAuthenticationMiddleware( - IRuntimeState runtimeState, - IBasicAuthService basicAuthService, - IOptionsMonitor globalSettings, - IHostingEnvironment hostingEnvironment) - : this(runtimeState, basicAuthService, hostingEnvironment) - { } - /// public async Task InvokeAsync(HttpContext context, RequestDelegate next) {