diff --git a/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs b/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
index b388579687..45d6498ff4 100644
--- a/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
+++ b/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
@@ -4,7 +4,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Configuration.UmbracoSettings;
using ConnectionStrings = Umbraco.Configuration.Models.ConnectionStrings;
-using CoreDebugSettings = Umbraco.Configuration.Models.CoreDebugSettings;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Configuration
{
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentSectionExtensions.cs b/src/Umbraco.Core/Configuration/ContentSettingsExtensions.cs
similarity index 74%
rename from src/Umbraco.Core/Configuration/UmbracoSettings/ContentSectionExtensions.cs
rename to src/Umbraco.Core/Configuration/ContentSettingsExtensions.cs
index d100eb0a74..1c24d0eb6c 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentSectionExtensions.cs
+++ b/src/Umbraco.Core/Configuration/ContentSettingsExtensions.cs
@@ -1,9 +1,11 @@
using System;
using System.Linq;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Configuration.UmbracoSettings;
-namespace Umbraco.Core.Configuration.UmbracoSettings
+namespace Umbraco.Core.Configuration
{
- public static class ContentSectionExtensions
+ public static class ContentSettingsExtensions
{
///
/// Gets a value indicating whether the file extension corresponds to an image.
@@ -11,12 +13,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
/// The file extension.
///
/// A value indicating whether the file extension corresponds to an image.
- public static bool IsImageFile(this IContentSettings contentConfig, string extension)
+ public static bool IsImageFile(this ContentSettings contentConfig, string extension)
{
if (contentConfig == null) throw new ArgumentNullException(nameof(contentConfig));
if (extension == null) return false;
extension = extension.TrimStart('.');
- return contentConfig.ImageFileTypes.InvariantContains(extension);
+ return contentConfig.Imaging.ImageFileTypes.InvariantContains(extension);
}
///
@@ -24,7 +26,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
/// held in settings.
/// Allow upload if extension is whitelisted OR if there is no whitelist and extension is NOT blacklisted.
///
- public static bool IsFileAllowedForUpload(this IContentSettings contentSettings, string extension)
+ public static bool IsFileAllowedForUpload(this ContentSettings contentSettings, string extension)
{
return contentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)) ||
(contentSettings.AllowedUploadFiles.Any() == false &&
@@ -37,9 +39,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
///
/// The property type alias.
/// The auto-fill configuration for the specified property alias, or null.
- public static IImagingAutoFillUploadField GetConfig(this IContentSettings contentSettings, string propertyTypeAlias)
+ public static IImagingAutoFillUploadField GetConfig(this ContentSettings contentSettings, string propertyTypeAlias)
{
- var autoFillConfigs = contentSettings.ImageAutoFillProperties;
+ var autoFillConfigs = contentSettings.Imaging.ImageAutoFillProperties;
return autoFillConfigs?.FirstOrDefault(x => x.Alias == propertyTypeAlias);
}
}
diff --git a/src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs
similarity index 81%
rename from src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs
rename to src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs
index d7d2de1490..4eb2c774bf 100644
--- a/src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ActiveDirectorySettings
{
diff --git a/src/Umbraco.Configuration/Models/ContentImagingSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs
similarity index 96%
rename from src/Umbraco.Configuration/Models/ContentImagingSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs
index f38e4194e8..7ec8bf219f 100644
--- a/src/Umbraco.Configuration/Models/ContentImagingSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs
@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
using Umbraco.Core;
using Umbraco.Core.Configuration.UmbracoSettings;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ContentImagingSettings
{
diff --git a/src/Umbraco.Configuration/Models/ContentNotificationSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs
similarity index 79%
rename from src/Umbraco.Configuration/Models/ContentNotificationSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs
index 96f6baddff..0ae1ffd991 100644
--- a/src/Umbraco.Configuration/Models/ContentNotificationSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ContentNotificationSettings
{
diff --git a/src/Umbraco.Configuration/Models/ContentSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs
similarity index 92%
rename from src/Umbraco.Configuration/Models/ContentSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ContentSettings.cs
index 945dc14728..d1664c2985 100644
--- a/src/Umbraco.Configuration/Models/ContentSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs
@@ -1,19 +1,13 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text.Json.Serialization;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Macros;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ContentSettings
{
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Content:";
- private const string NotificationsPrefix = Prefix + "Notifications:";
- private const string ImagingPrefix = Prefix + "Imaging:";
private const string DefaultPreviewBadge =
@"";
@@ -47,6 +41,7 @@ namespace Umbraco.Configuration.Models
public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg";
+ /*
private class ContentErrorPage : IContentErrorPage
{
public ContentErrorPage(IConfigurationSection configurationSection)
@@ -78,5 +73,6 @@ namespace Umbraco.Configuration.Models
public bool HasContentKey { get; }
public string Culture { get; set; }
}
+ */
}
}
diff --git a/src/Umbraco.Configuration/Models/CoreDebugSettings.cs b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs
similarity index 79%
rename from src/Umbraco.Configuration/Models/CoreDebugSettings.cs
rename to src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs
index e95a432dd4..2b13609509 100644
--- a/src/Umbraco.Configuration/Models/CoreDebugSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class CoreDebugSettings
{
diff --git a/src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs
similarity index 69%
rename from src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs
index d5fe64abce..6b8f74bef0 100644
--- a/src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ExceptionFilterSettings
{
diff --git a/src/Umbraco.Configuration/Models/GlobalSettings.cs b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs
similarity index 98%
rename from src/Umbraco.Configuration/Models/GlobalSettings.cs
rename to src/Umbraco.Core/Configuration/Models/GlobalSettings.cs
index fcedd504c9..6a7411c733 100644
--- a/src/Umbraco.Configuration/Models/GlobalSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
///
/// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information
diff --git a/src/Umbraco.Configuration/Models/HostingSettings.cs b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs
similarity index 84%
rename from src/Umbraco.Configuration/Models/HostingSettings.cs
rename to src/Umbraco.Core/Configuration/Models/HostingSettings.cs
index e096a207da..a774a948ea 100644
--- a/src/Umbraco.Configuration/Models/HostingSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs
@@ -1,9 +1,6 @@
using System.Text.Json.Serialization;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class HostingSettings
{
diff --git a/src/Umbraco.Configuration/Models/ImagingCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs
similarity index 89%
rename from src/Umbraco.Configuration/Models/ImagingCacheSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs
index 05e3cb4677..9c2fd4bf37 100644
--- a/src/Umbraco.Configuration/Models/ImagingCacheSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ImagingCacheSettings
{
diff --git a/src/Umbraco.Configuration/Models/ImagingResizeSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs
similarity index 74%
rename from src/Umbraco.Configuration/Models/ImagingResizeSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs
index 1d7424c4f2..6b445d8c40 100644
--- a/src/Umbraco.Configuration/Models/ImagingResizeSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs
@@ -1,6 +1,7 @@
-using System.Text.Json.Serialization;
+
+using System.Text.Json.Serialization;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ImagingResizeSettings
{
diff --git a/src/Umbraco.Configuration/Models/ImagingSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs
similarity index 77%
rename from src/Umbraco.Configuration/Models/ImagingSettings.cs
rename to src/Umbraco.Core/Configuration/Models/ImagingSettings.cs
index 36a63d7766..afc55561bb 100644
--- a/src/Umbraco.Configuration/Models/ImagingSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class ImagingSettings
{
diff --git a/src/Umbraco.Configuration/Models/IndexCreatorSettings.cs b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
similarity index 70%
rename from src/Umbraco.Configuration/Models/IndexCreatorSettings.cs
rename to src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
index 7738527ed7..fcc22de9a3 100644
--- a/src/Umbraco.Configuration/Models/IndexCreatorSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class IndexCreatorSettings
{
diff --git a/src/Umbraco.Configuration/Models/KeepAliveSettings.cs b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs
similarity index 86%
rename from src/Umbraco.Configuration/Models/KeepAliveSettings.cs
rename to src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs
index c6f0b9a98c..188c4c5739 100644
--- a/src/Umbraco.Configuration/Models/KeepAliveSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs
@@ -1,6 +1,6 @@
using Umbraco.Core.Configuration.UmbracoSettings;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class KeepAliveSettings : IKeepAliveSettings
{
diff --git a/src/Umbraco.Configuration/Models/LoggingSettings.cs b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs
similarity index 67%
rename from src/Umbraco.Configuration/Models/LoggingSettings.cs
rename to src/Umbraco.Core/Configuration/Models/LoggingSettings.cs
index 9cc0a084d2..414ff06b57 100644
--- a/src/Umbraco.Configuration/Models/LoggingSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class LoggingSettings
{
diff --git a/src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs
similarity index 77%
rename from src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs
rename to src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs
index 32bed610fb..1f2808ef7e 100644
--- a/src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs
@@ -1,8 +1,9 @@
using Umbraco.Core;
+using Umbraco.Core.Configuration;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
- public class MemberPasswordConfigurationSettings
+ public class MemberPasswordConfigurationSettings : IPasswordConfiguration
{
public int RequiredLength { get; set; } = 10;
diff --git a/src/Umbraco.Configuration/Models/ModelsBuilderConfig.cs b/src/Umbraco.Core/Configuration/Models/ModelsBuilderConfig.cs
similarity index 95%
rename from src/Umbraco.Configuration/Models/ModelsBuilderConfig.cs
rename to src/Umbraco.Core/Configuration/Models/ModelsBuilderConfig.cs
index d580ba1b7c..e99557755c 100644
--- a/src/Umbraco.Configuration/Models/ModelsBuilderConfig.cs
+++ b/src/Umbraco.Core/Configuration/Models/ModelsBuilderConfig.cs
@@ -1,8 +1,6 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
+using Umbraco.Configuration;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
///
/// Represents the models builder configuration.
diff --git a/src/Umbraco.Configuration/Models/NuCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
similarity index 68%
rename from src/Umbraco.Configuration/Models/NuCacheSettings.cs
rename to src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
index 0077146620..a2bc7d3561 100644
--- a/src/Umbraco.Configuration/Models/NuCacheSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class NuCacheSettings
{
diff --git a/src/Umbraco.Configuration/Models/RuntimeSettings.cs b/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs
similarity index 76%
rename from src/Umbraco.Configuration/Models/RuntimeSettings.cs
rename to src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs
index 367a6c53a3..f93530b490 100644
--- a/src/Umbraco.Configuration/Models/RuntimeSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class RuntimeSettings
{
diff --git a/src/Umbraco.Configuration/Models/SecuritySettings.cs b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
similarity index 90%
rename from src/Umbraco.Configuration/Models/SecuritySettings.cs
rename to src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
index 12ea6b7c17..5295abb368 100644
--- a/src/Umbraco.Configuration/Models/SecuritySettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class SecuritySettings
{
diff --git a/src/Umbraco.Configuration/Models/SmtpSettings.cs b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs
similarity index 90%
rename from src/Umbraco.Configuration/Models/SmtpSettings.cs
rename to src/Umbraco.Core/Configuration/Models/SmtpSettings.cs
index c4a874c5ae..a507f8a62f 100644
--- a/src/Umbraco.Configuration/Models/SmtpSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs
@@ -1,6 +1,6 @@
using System.Net.Mail;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class SmtpSettings
{
diff --git a/src/Umbraco.Configuration/Models/TourSettings.cs b/src/Umbraco.Core/Configuration/Models/TourSettings.cs
similarity index 68%
rename from src/Umbraco.Configuration/Models/TourSettings.cs
rename to src/Umbraco.Core/Configuration/Models/TourSettings.cs
index a9cfaa8987..895eff6dee 100644
--- a/src/Umbraco.Configuration/Models/TourSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/TourSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class TourSettings
{
diff --git a/src/Umbraco.Configuration/Models/TypeFinderSettings.cs b/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs
similarity index 72%
rename from src/Umbraco.Configuration/Models/TypeFinderSettings.cs
rename to src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs
index 65690f9668..c5210f6c8e 100644
--- a/src/Umbraco.Configuration/Models/TypeFinderSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class TypeFinderSettings
{
diff --git a/src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs
similarity index 82%
rename from src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs
rename to src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs
index 81724f9259..a0c26b2410 100644
--- a/src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs
@@ -1,9 +1,9 @@
using Umbraco.Core;
using Umbraco.Core.Configuration;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
- public class UserPasswordConfigurationSettings
+ public class UserPasswordConfigurationSettings : IPasswordConfiguration
{
public int RequiredLength { get; set; } = 10;
diff --git a/src/Umbraco.Configuration/Models/WebRoutingSettings.cs b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs
similarity index 93%
rename from src/Umbraco.Configuration/Models/WebRoutingSettings.cs
rename to src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs
index d0e36b4241..7e0c4d5d8c 100644
--- a/src/Umbraco.Configuration/Models/WebRoutingSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs
@@ -1,6 +1,6 @@
using Umbraco.Core.Models.PublishedContent;
-namespace Umbraco.Configuration.Models
+namespace Umbraco.Core.Configuration.Models
{
public class WebRoutingSettings
{
diff --git a/src/Umbraco.Core/Editors/BackOfficeModel.cs b/src/Umbraco.Core/Editors/BackOfficeModel.cs
deleted file mode 100644
index be91654d9e..0000000000
--- a/src/Umbraco.Core/Editors/BackOfficeModel.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
-using Umbraco.Web.Features;
-using Umbraco.Web.Trees;
-
-namespace Umbraco.Web.Editors
-{
- // TODO: Almost nothing here needs to exist since we can inject these into the view
- public class BackOfficeModel
- {
- public BackOfficeModel(UmbracoFeatures features, IGlobalSettings globalSettings, IUmbracoVersion umbracoVersion,
- IContentSettings contentSettings,
- IHostingEnvironment hostingEnvironment,
- IRuntimeSettings runtimeSettings, ISecuritySettings securitySettings)
- {
- Features = features;
- GlobalSettings = globalSettings;
- UmbracoVersion = umbracoVersion;
- ContentSettings = contentSettings;
- HostingEnvironment = hostingEnvironment;
- RuntimeSettings = runtimeSettings;
- SecuritySettings = securitySettings;
- BackOfficePath = GlobalSettings.GetBackOfficePath(HostingEnvironment);
- }
-
- public UmbracoFeatures Features { get; }
- public IGlobalSettings GlobalSettings { get; }
- public IUmbracoVersion UmbracoVersion { get; }
- public IContentSettings ContentSettings { get; }
- public IHostingEnvironment HostingEnvironment { get; }
- public IRuntimeSettings RuntimeSettings { get; set; }
- public ISecuritySettings SecuritySettings { get; set; }
-
- public string BackOfficePath { get; }
- }
-}
diff --git a/src/Umbraco.Core/Models/MediaExtensions.cs b/src/Umbraco.Core/Models/MediaExtensions.cs
index ffcc2c2a92..aa7a48d8f4 100644
--- a/src/Umbraco.Core/Models/MediaExtensions.cs
+++ b/src/Umbraco.Core/Models/MediaExtensions.cs
@@ -1,5 +1,5 @@
using System.Linq;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Models
@@ -27,9 +27,9 @@ namespace Umbraco.Core.Models
///
/// Gets the urls of a media item.
///
- public static string[] GetUrls(this IMedia media, IContentSettings contentSettings, MediaUrlGeneratorCollection mediaUrlGenerators)
+ public static string[] GetUrls(this IMedia media, ContentSettings contentSettings, MediaUrlGeneratorCollection mediaUrlGenerators)
{
- return contentSettings.ImageAutoFillProperties
+ return contentSettings.Imaging.ImageAutoFillProperties
.Select(field => media.GetUrl(field.Alias, mediaUrlGenerators))
.Where(link => string.IsNullOrWhiteSpace(link) == false)
.ToArray();
diff --git a/src/Umbraco.Core/Scheduling/KeepAlive.cs b/src/Umbraco.Core/Scheduling/KeepAlive.cs
index a47080912c..d085569e97 100644
--- a/src/Umbraco.Core/Scheduling/KeepAlive.cs
+++ b/src/Umbraco.Core/Scheduling/KeepAlive.cs
@@ -2,8 +2,9 @@
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Sync;
@@ -13,13 +14,19 @@ namespace Umbraco.Web.Scheduling
{
private readonly IRequestAccessor _requestAccessor;
private readonly IMainDom _mainDom;
- private readonly IKeepAliveSettings _keepAliveSettings;
+ private readonly KeepAliveSettings _keepAliveSettings;
private readonly IProfilingLogger _logger;
private readonly IServerRegistrar _serverRegistrar;
private static HttpClient _httpClient;
public KeepAlive(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds,
- IRequestAccessor requestAccessor, IMainDom mainDom, IKeepAliveSettings keepAliveSettings, IProfilingLogger logger, IServerRegistrar serverRegistrar)
+ IRequestAccessor requestAccessor, IMainDom mainDom, IOptionsSnapshot keepAliveSettings, IProfilingLogger logger, IServerRegistrar serverRegistrar)
+ : this(runner, delayMilliseconds, periodMilliseconds, requestAccessor, mainDom, keepAliveSettings.Value, logger, serverRegistrar)
+ {
+ }
+
+ public KeepAlive(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds,
+ IRequestAccessor requestAccessor, IMainDom mainDom, KeepAliveSettings keepAliveSettings, IProfilingLogger logger, IServerRegistrar serverRegistrar)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_requestAccessor = requestAccessor;
@@ -28,7 +35,9 @@ namespace Umbraco.Web.Scheduling
_logger = logger;
_serverRegistrar = serverRegistrar;
if (_httpClient == null)
+ {
_httpClient = new HttpClient();
+ }
}
public override async Task PerformRunAsync(CancellationToken token)
diff --git a/src/Umbraco.Core/Templates/HtmlUrlParser.cs b/src/Umbraco.Core/Templates/HtmlUrlParser.cs
index 566fce8b87..8a6baa0aa3 100644
--- a/src/Umbraco.Core/Templates/HtmlUrlParser.cs
+++ b/src/Umbraco.Core/Templates/HtmlUrlParser.cs
@@ -1,5 +1,6 @@
using System.Text.RegularExpressions;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -7,16 +8,16 @@ namespace Umbraco.Web.Templates
{
public sealed class HtmlUrlParser
{
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IIOHelper _ioHelper;
private readonly IProfilingLogger _logger;
private static readonly Regex ResolveUrlPattern = new Regex("(=[\"\']?)(\\W?\\~(?:.(?![\"\']?\\s+(?:\\S+)=|[>\"\']))+.)[\"\']?",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
- public HtmlUrlParser(IContentSettings contentSettings, IProfilingLogger logger, IIOHelper ioHelper)
+ public HtmlUrlParser(IOptionsSnapshot contentSettings, IProfilingLogger logger, IIOHelper ioHelper)
{
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_ioHelper = ioHelper;
_logger = logger;
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index b5e553a78e..3b7ccb1775 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -15,10 +15,12 @@
+
+
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserManager.cs b/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserManager.cs
index c901c14ee1..6e11e20c8f 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserManager.cs
+++ b/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserManager.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Security;
using Umbraco.Extensions;
using Umbraco.Net;
@@ -26,7 +27,7 @@ namespace Umbraco.Core.BackOffice
BackOfficeIdentityErrorDescriber errors,
IServiceProvider services,
ILogger> logger,
- IUserPasswordConfiguration passwordConfiguration)
+ IOptions passwordConfiguration)
: base(ipResolver, store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger, passwordConfiguration)
{
}
@@ -48,11 +49,11 @@ namespace Umbraco.Core.BackOffice
BackOfficeIdentityErrorDescriber errors,
IServiceProvider services,
ILogger> logger,
- IUserPasswordConfiguration passwordConfiguration)
+ IOptions passwordConfiguration)
: base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
{
IpResolver = ipResolver ?? throw new ArgumentNullException(nameof(ipResolver));
- PasswordConfiguration = passwordConfiguration ?? throw new ArgumentNullException(nameof(passwordConfiguration));
+ PasswordConfiguration = passwordConfiguration.Value ?? throw new ArgumentNullException(nameof(passwordConfiguration));
}
#region What we do not currently support
diff --git a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
index 646df5124d..17b0fc3505 100644
--- a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
+++ b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.FileProviders;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+
namespace Umbraco.Core.Configuration
{
public class JsonConfigManipulator : IConfigManipulator
diff --git a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
index 0240d60f29..5ddf9aa288 100644
--- a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
+++ b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
@@ -2,11 +2,11 @@
using System.Net.Mail;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.HealthChecks;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Logging;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.NotificationMethods
@@ -18,9 +18,15 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
private readonly IRequestAccessor _requestAccessor;
private readonly IGlobalSettings _globalSettings;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public EmailNotificationMethod(ILocalizedTextService textService, IRequestAccessor requestAccessor, IGlobalSettings globalSettings, IHealthChecksSettings healthChecksSettings, IContentSettings contentSettings) : base(healthChecksSettings)
+ public EmailNotificationMethod(
+ ILocalizedTextService textService,
+ IRequestAccessor requestAccessor,
+ IGlobalSettings globalSettings,
+ IHealthChecksSettings healthChecksSettings,
+ IOptionsSnapshot contentSettings)
+ : base(healthChecksSettings)
{
var recipientEmail = Settings?["recipientEmail"]?.Value;
if (string.IsNullOrWhiteSpace(recipientEmail))
@@ -34,7 +40,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
_textService = textService ?? throw new ArgumentNullException(nameof(textService));
_requestAccessor = requestAccessor;
_globalSettings = globalSettings;
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
}
public string RecipientEmail { get; }
@@ -73,7 +79,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
private MailMessage CreateMailMessage(string subject, string message)
{
- var to = _contentSettings.NotificationEmailAddress;
+ var to = _contentSettings.Notifications.NotificationEmailAddress;
if (string.IsNullOrWhiteSpace(subject))
subject = "Umbraco Health Check Status";
diff --git a/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
index a240eaf104..f3765493d9 100644
--- a/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
+++ b/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
@@ -3,15 +3,16 @@ using System.Collections.Specialized;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Umbraco.Core;
+using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Migrations.Install;
using Umbraco.Core.Services;
-using Umbraco.Web.Install.Models;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Extensions;
+using Umbraco.Web.Install.Models;
namespace Umbraco.Web.Install.InstallSteps
{
@@ -30,19 +31,27 @@ namespace Umbraco.Web.Install.InstallSteps
private readonly DatabaseBuilder _databaseBuilder;
private static HttpClient _httpClient;
private readonly IGlobalSettings _globalSettings;
- private readonly IUserPasswordConfiguration _passwordConfiguration;
- private readonly ISecuritySettings _securitySettings;
+ private readonly UserPasswordConfigurationSettings _passwordConfiguration;
+ private readonly SecuritySettings _securitySettings;
private readonly IConnectionStrings _connectionStrings;
private readonly ICookieManager _cookieManager;
private readonly BackOfficeUserManager _userManager;
- public NewInstallStep(IUserService userService, DatabaseBuilder databaseBuilder, IGlobalSettings globalSettings, IUserPasswordConfiguration passwordConfiguration, ISecuritySettings securitySettings, IConnectionStrings connectionStrings, ICookieManager cookieManager, BackOfficeUserManager userManager)
+ public NewInstallStep(
+ IUserService userService,
+ DatabaseBuilder databaseBuilder,
+ IGlobalSettings globalSettings,
+ IOptionsSnapshot passwordConfiguration,
+ IOptionsSnapshot securitySettings,
+ IConnectionStrings connectionStrings,
+ ICookieManager cookieManager,
+ BackOfficeUserManager userManager)
{
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
_databaseBuilder = databaseBuilder ?? throw new ArgumentNullException(nameof(databaseBuilder));
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
- _passwordConfiguration = passwordConfiguration ?? throw new ArgumentNullException(nameof(passwordConfiguration));
- _securitySettings = securitySettings ?? throw new ArgumentNullException(nameof(securitySettings));
+ _passwordConfiguration = passwordConfiguration.Value ?? throw new ArgumentNullException(nameof(passwordConfiguration));
+ _securitySettings = securitySettings.Value ?? throw new ArgumentNullException(nameof(securitySettings));
_connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings));
_cookieManager = cookieManager;
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/ThreadAbortExceptionEnricher.cs b/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/ThreadAbortExceptionEnricher.cs
index 1f495d3a50..c9386ea210 100644
--- a/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/ThreadAbortExceptionEnricher.cs
+++ b/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/ThreadAbortExceptionEnricher.cs
@@ -1,11 +1,12 @@
using System;
using System.Reflection;
using System.Threading;
+using Microsoft.Extensions.Options;
using Serilog.Core;
using Serilog.Events;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Diagnostics;
using Umbraco.Core.Hosting;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Infrastructure.Logging.Serilog.Enrichers
{
@@ -14,13 +15,13 @@ namespace Umbraco.Infrastructure.Logging.Serilog.Enrichers
///
public class ThreadAbortExceptionEnricher : ILogEventEnricher
{
- private readonly ICoreDebugSettings _coreDebugSettings;
+ private readonly CoreDebugSettings _coreDebugSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IMarchal _marchal;
- public ThreadAbortExceptionEnricher(ICoreDebugSettings coreDebugSettings, IHostingEnvironment hostingEnvironment, IMarchal marchal)
+ public ThreadAbortExceptionEnricher(IOptionsSnapshot coreDebugSettings, IHostingEnvironment hostingEnvironment, IMarchal marchal)
{
- _coreDebugSettings = coreDebugSettings;
+ _coreDebugSettings = coreDebugSettings.Value;
_hostingEnvironment = hostingEnvironment;
_marchal = marchal;
}
diff --git a/src/Umbraco.Infrastructure/Media/UploadAutoFillProperties.cs b/src/Umbraco.Infrastructure/Media/UploadAutoFillProperties.cs
index 05d4744526..38c77aefb5 100644
--- a/src/Umbraco.Infrastructure/Media/UploadAutoFillProperties.cs
+++ b/src/Umbraco.Infrastructure/Media/UploadAutoFillProperties.cs
@@ -1,8 +1,10 @@
using System;
using System.Drawing;
using System.IO;
-using System.Linq;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -17,9 +19,20 @@ namespace Umbraco.Web.Media
{
private readonly IMediaFileSystem _mediaFileSystem;
private readonly ILogger _logger;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public UploadAutoFillProperties(IMediaFileSystem mediaFileSystem, ILogger logger, IContentSettings contentSettings)
+ public UploadAutoFillProperties(
+ IMediaFileSystem mediaFileSystem,
+ ILogger logger,
+ IOptionsSnapshot contentSettings)
+ : this(mediaFileSystem, logger, contentSettings.Value)
+ {
+ }
+
+ public UploadAutoFillProperties(
+ IMediaFileSystem mediaFileSystem,
+ ILogger logger,
+ ContentSettings contentSettings)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
diff --git a/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs b/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs
index 0bd6d54c08..069333e55d 100644
--- a/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs
+++ b/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
@@ -15,13 +16,13 @@ namespace Umbraco.Web.Models.Mapping
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly ILogger _logger;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public DataTypeMapDefinition(PropertyEditorCollection propertyEditors, ILogger logger, IContentSettings contentSettings)
+ public DataTypeMapDefinition(PropertyEditorCollection propertyEditors, ILogger logger, IOptionsSnapshot contentSettings)
{
_propertyEditors = propertyEditors;
_logger = logger;
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
}
private static readonly int[] SystemIds =
diff --git a/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs b/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs
index 9045be20aa..b77214fac5 100644
--- a/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs
+++ b/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Dictionary;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
+using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Core.Dictionary;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Security;
namespace Umbraco.Web.Models.Mapping
@@ -28,7 +29,7 @@ namespace Umbraco.Web.Models.Mapping
private readonly IMemberTypeService _memberTypeService;
private readonly IMemberService _memberService;
private readonly IMemberGroupService _memberGroupService;
- private readonly IMemberPasswordConfiguration _memberPasswordConfiguration;
+ private readonly MemberPasswordConfigurationSettings _memberPasswordConfiguration;
private readonly PropertyEditorCollection _propertyEditorCollection;
public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary,
@@ -37,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping
IMemberTypeService memberTypeService,
IMemberService memberService,
IMemberGroupService memberGroupService,
- IMemberPasswordConfiguration memberPasswordConfiguration,
+ IOptionsSnapshot memberPasswordConfiguration,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
PropertyEditorCollection propertyEditorCollection)
: base(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider)
@@ -47,7 +48,7 @@ namespace Umbraco.Web.Models.Mapping
_memberTypeService = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
_memberService = memberService ?? throw new ArgumentNullException(nameof(memberService));
_memberGroupService = memberGroupService ?? throw new ArgumentNullException(nameof(memberGroupService));
- _memberPasswordConfiguration = memberPasswordConfiguration;
+ _memberPasswordConfiguration = memberPasswordConfiguration.Value;
_propertyEditorCollection = propertyEditorCollection;
}
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
index e191ac08bf..bd11127296 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
+using Microsoft.Extensions.Options;
using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
@@ -25,7 +27,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
private readonly IMapperCollection _mapperCollection;
private readonly IGlobalSettings _globalSettings;
- private readonly IUserPasswordConfiguration _passwordConfiguration;
+ private readonly UserPasswordConfigurationSettings _passwordConfiguration;
private readonly IJsonSerializer _jsonSerializer;
private string _passwordConfigJson;
private bool _passwordConfigInitialized;
@@ -40,7 +42,36 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// A dictionary specifying the configuration for user passwords. If this is null then no password configuration will be persisted or read.
///
///
- public UserRepository(IScopeAccessor scopeAccessor, AppCaches appCaches, ILogger logger, IMapperCollection mapperCollection, IGlobalSettings globalSettings, IUserPasswordConfiguration passwordConfiguration, IJsonSerializer jsonSerializer)
+ public UserRepository(
+ IScopeAccessor scopeAccessor,
+ AppCaches appCaches,
+ ILogger logger,
+ IMapperCollection mapperCollection,
+ IGlobalSettings globalSettings,
+ IOptionsSnapshot passwordConfiguration,
+ IJsonSerializer jsonSerializer)
+ : this(scopeAccessor, appCaches, logger, mapperCollection, globalSettings, passwordConfiguration.Value, jsonSerializer)
+ {
+ }
+
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// A dictionary specifying the configuration for user passwords. If this is null then no password configuration will be persisted or read.
+ ///
+ ///
+ public UserRepository(
+ IScopeAccessor scopeAccessor,
+ AppCaches appCaches,
+ ILogger logger,
+ IMapperCollection mapperCollection,
+ IGlobalSettings globalSettings,
+ UserPasswordConfigurationSettings passwordConfiguration,
+ IJsonSerializer jsonSerializer)
: base(scopeAccessor, appCaches, logger)
{
_mapperCollection = mapperCollection ?? throw new ArgumentNullException(nameof(mapperCollection));
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs
index 698fcb10b3..5205cfd15b 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyEditor.cs
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -22,13 +24,32 @@ namespace Umbraco.Web.PropertyEditors
public class FileUploadPropertyEditor : DataEditor, IMediaUrlGenerator
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly UploadAutoFillProperties _uploadAutoFillProperties;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly ILocalizedTextService _localizedTextService;
- public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSettings contentSettings, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ public FileUploadPropertyEditor(
+ ILogger logger,
+ IMediaFileSystem mediaFileSystem,
+ IOptionsSnapshot contentSettings,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : this(logger, mediaFileSystem, contentSettings.Value, dataTypeService, localizationService, localizedTextService, shortStringHelper)
+ {
+ }
+
+ public FileUploadPropertyEditor(
+ ILogger logger,
+ IMediaFileSystem mediaFileSystem,
+ ContentSettings contentSettings,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
: base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
index e45896551c..e518005526 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
@@ -1,7 +1,8 @@
using System;
using System.IO;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
@@ -16,9 +17,28 @@ namespace Umbraco.Web.PropertyEditors
internal class FileUploadPropertyValueEditor : DataValueEditor
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public FileUploadPropertyValueEditor(DataEditorAttribute attribute, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, IContentSettings contentSettings)
+ public FileUploadPropertyValueEditor(
+ DataEditorAttribute attribute,
+ IMediaFileSystem mediaFileSystem,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper,
+ IOptionsSnapshot contentSettings)
+ : this(attribute, mediaFileSystem, dataTypeService, localizationService, localizedTextService, shortStringHelper, contentSettings.Value)
+ {
+ }
+
+ public FileUploadPropertyValueEditor(
+ DataEditorAttribute attribute,
+ IMediaFileSystem mediaFileSystem,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper,
+ ContentSettings contentSettings)
: base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs
index 586a120609..398b7110e3 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -29,7 +31,7 @@ namespace Umbraco.Web.PropertyEditors
public class ImageCropperPropertyEditor : DataEditor, IMediaUrlGenerator
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
@@ -38,8 +40,32 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public ImageCropperPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSettings contentSettings, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper, IShortStringHelper shortStringHelper, ILocalizedTextService localizedTextService)
- : base(logger, dataTypeService, localizationService, localizedTextService,shortStringHelper)
+ public ImageCropperPropertyEditor(
+ ILogger logger,
+ IMediaFileSystem mediaFileSystem,
+ IOptionsSnapshot contentSettings,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ IIOHelper ioHelper,
+ IShortStringHelper shortStringHelper,
+ ILocalizedTextService localizedTextService)
+ : this(logger, mediaFileSystem, contentSettings.Value, dataTypeService, localizationService, ioHelper, shortStringHelper, localizedTextService)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ImageCropperPropertyEditor(
+ ILogger logger,
+ IMediaFileSystem mediaFileSystem,
+ ContentSettings contentSettings,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ IIOHelper ioHelper,
+ IShortStringHelper shortStringHelper,
+ ILocalizedTextService localizedTextService)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
_contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs
index 1c7c8b922a..8f88c301d1 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs
@@ -2,7 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -22,9 +22,17 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly ILogger _logger;
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, IContentSettings contentSettings)
+ public ImageCropperPropertyValueEditor(
+ DataEditorAttribute attribute,
+ ILogger logger,
+ IMediaFileSystem mediaFileSystem,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper,
+ ContentSettings contentSettings)
: base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/UploadFileTypeValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/UploadFileTypeValidator.cs
index b64c52648a..063ac1cc97 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/UploadFileTypeValidator.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/UploadFileTypeValidator.cs
@@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.IO;
using System.Linq;
+using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
-using Umbraco.Composing;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
@@ -16,14 +15,19 @@ namespace Umbraco.Web.PropertyEditors
internal class UploadFileTypeValidator : IValueValidator
{
private readonly ILocalizedTextService _localizedTextService;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
- public UploadFileTypeValidator(ILocalizedTextService localizedTextService, IContentSettings contentSettings)
+ public UploadFileTypeValidator(ILocalizedTextService localizedTextService, ContentSettings contentSettings)
{
_localizedTextService = localizedTextService;
_contentSettings = contentSettings;
}
+ public UploadFileTypeValidator(ILocalizedTextService localizedTextService, IOptionsSnapshot contentSettings)
+ : this(localizedTextService, contentSettings.Value)
+ {
+ }
+
public IEnumerable Validate(object value, string valueType, object dataTypeConfiguration)
{
string selectedFiles = null;
@@ -55,7 +59,7 @@ namespace Umbraco.Web.PropertyEditors
}
}
- internal static bool IsValidFileExtension(string fileName, IContentSettings contentSettings)
+ internal static bool IsValidFileExtension(string fileName, ContentSettings contentSettings)
{
if (fileName.IndexOf('.') <= 0) return false;
var extension = fileName.GetFileExtension().TrimStart(".");
diff --git a/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs
index ac8d0980c4..ae47b85365 100644
--- a/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs
+++ b/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs
@@ -1,8 +1,9 @@
-using Examine;
using System.Globalization;
using System.Linq;
+using Examine;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Services;
@@ -16,14 +17,18 @@ namespace Umbraco.Web.Routing
{
private readonly ILogger _logger;
private readonly IEntityService _entityService;
- private readonly IContentSettings _contentConfigSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IExamineManager _examineManager;
- public ContentFinderByConfigured404(ILogger logger, IEntityService entityService, IContentSettings contentConfigSettings, IExamineManager examineManager)
+ public ContentFinderByConfigured404(
+ ILogger logger,
+ IEntityService entityService,
+ IOptionsSnapshot contentConfigSettings,
+ IExamineManager examineManager)
{
_logger = logger;
_entityService = entityService;
- _contentConfigSettings = contentConfigSettings;
+ _contentSettings = contentConfigSettings.Value;
_examineManager = examineManager;
}
@@ -63,7 +68,7 @@ namespace Umbraco.Web.Routing
}
var error404 = NotFoundHandlerHelper.GetCurrentNotFoundPageId(
- _contentConfigSettings.Error404Collection.ToArray(),
+ _contentSettings.Error404Collection.ToArray(),
_entityService,
new PublishedContentQuery(frequest.UmbracoContext.PublishedSnapshot, frequest.UmbracoContext.VariationContextAccessor, _examineManager),
errorCulture);
diff --git a/src/Umbraco.Infrastructure/Scheduling/LogScrubber.cs b/src/Umbraco.Infrastructure/Scheduling/LogScrubber.cs
index b3e30a7353..2c5d8afbff 100644
--- a/src/Umbraco.Infrastructure/Scheduling/LogScrubber.cs
+++ b/src/Umbraco.Infrastructure/Scheduling/LogScrubber.cs
@@ -1,5 +1,7 @@
using System;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
@@ -8,18 +10,23 @@ using Umbraco.Core.Sync;
namespace Umbraco.Web.Scheduling
{
-
public class LogScrubber : RecurringTaskBase
{
private readonly IMainDom _mainDom;
private readonly IServerRegistrar _serverRegistrar;
private readonly IAuditService _auditService;
- private readonly ILoggingSettings _settings;
+ private readonly LoggingSettings _settings;
private readonly IProfilingLogger _logger;
private readonly IScopeProvider _scopeProvider;
public LogScrubber(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds,
- IMainDom mainDom, IServerRegistrar serverRegistrar, IAuditService auditService, ILoggingSettings settings, IScopeProvider scopeProvider, IProfilingLogger logger)
+ IMainDom mainDom, IServerRegistrar serverRegistrar, IAuditService auditService, IOptionsSnapshot settings, IScopeProvider scopeProvider, IProfilingLogger logger)
+ : this(runner, delayMilliseconds, periodMilliseconds, mainDom, serverRegistrar, auditService, settings.Value, scopeProvider, logger)
+ {
+ }
+
+ public LogScrubber(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds,
+ IMainDom mainDom, IServerRegistrar serverRegistrar, IAuditService auditService, LoggingSettings settings, IScopeProvider scopeProvider, IProfilingLogger logger)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_mainDom = mainDom;
@@ -31,7 +38,7 @@ namespace Umbraco.Web.Scheduling
}
// maximum age, in minutes
- private int GetLogScrubbingMaximumAge(ILoggingSettings settings)
+ private int GetLogScrubbingMaximumAge(LoggingSettings settings)
{
var maximumAge = 24 * 60; // 24 hours, in minutes
try
diff --git a/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs b/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
index a5850719ab..982f8470a7 100644
--- a/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
+++ b/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.HealthChecks;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
@@ -39,8 +39,8 @@ namespace Umbraco.Web.Scheduling
private readonly IHealthChecksSettings _healthChecksSettingsConfig;
private readonly IServerMessenger _serverMessenger;
private readonly IRequestAccessor _requestAccessor;
- private readonly ILoggingSettings _loggingSettings;
- private readonly IKeepAliveSettings _keepAliveSettings;
+ private readonly LoggingSettings _loggingSettings;
+ private readonly KeepAliveSettings _keepAliveSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private BackgroundTaskRunner _keepAliveRunner;
@@ -59,7 +59,7 @@ namespace Umbraco.Web.Scheduling
IScopeProvider scopeProvider, IUmbracoContextFactory umbracoContextFactory, IProfilingLogger logger,
IApplicationShutdownRegistry applicationShutdownRegistry, IHealthChecksSettings healthChecksSettingsConfig,
IServerMessenger serverMessenger, IRequestAccessor requestAccessor,
- ILoggingSettings loggingSettings, IKeepAliveSettings keepAliveSettings,
+ IOptionsSnapshot loggingSettings, IOptionsSnapshot keepAliveSettings,
IHostingEnvironment hostingEnvironment)
{
_runtime = runtime;
@@ -77,8 +77,8 @@ namespace Umbraco.Web.Scheduling
_healthChecksSettingsConfig = healthChecksSettingsConfig ?? throw new ArgumentNullException(nameof(healthChecksSettingsConfig));
_serverMessenger = serverMessenger;
_requestAccessor = requestAccessor;
- _loggingSettings = loggingSettings;
- _keepAliveSettings = keepAliveSettings;
+ _loggingSettings = loggingSettings.Value;
+ _keepAliveSettings = keepAliveSettings.Value;
_hostingEnvironment = hostingEnvironment;
}
@@ -137,7 +137,7 @@ namespace Umbraco.Web.Scheduling
});
}
- private IBackgroundTask RegisterKeepAlive(IKeepAliveSettings keepAliveSettings)
+ private IBackgroundTask RegisterKeepAlive(KeepAliveSettings keepAliveSettings)
{
// ping/keepalive
// on all servers
@@ -181,7 +181,7 @@ namespace Umbraco.Web.Scheduling
return task;
}
- private IBackgroundTask RegisterLogScrubber(ILoggingSettings settings)
+ private IBackgroundTask RegisterLogScrubber(LoggingSettings settings)
{
// log scrubbing
// install on all, will only run on non-replica servers
diff --git a/src/Umbraco.Infrastructure/Scoping/Scope.cs b/src/Umbraco.Infrastructure/Scoping/Scope.cs
index 3b17ae876d..b7ccf539f6 100644
--- a/src/Umbraco.Infrastructure/Scoping/Scope.cs
+++ b/src/Umbraco.Infrastructure/Scoping/Scope.cs
@@ -2,11 +2,11 @@
using System.Data;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Core.Scoping
{
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Scoping
internal class Scope : IScope
{
private readonly ScopeProvider _scopeProvider;
- private readonly ICoreDebugSettings _coreDebugSettings;
+ private readonly CoreDebugSettings _coreDebugSettings;
private readonly IMediaFileSystem _mediaFileSystem;
private readonly ILogger _logger;
private readonly ITypeFinder _typeFinder;
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Scoping
// initializes a new scope
private Scope(ScopeProvider scopeProvider,
- ICoreDebugSettings coreDebugSettings,
+ CoreDebugSettings coreDebugSettings,
IMediaFileSystem mediaFileSystem,
ILogger logger, ITypeFinder typeFinder, FileSystems fileSystems, Scope parent, IScopeContext scopeContext, bool detachable,
IsolationLevel isolationLevel = IsolationLevel.Unspecified,
@@ -118,7 +118,7 @@ namespace Umbraco.Core.Scoping
// initializes a new scope
public Scope(ScopeProvider scopeProvider,
- ICoreDebugSettings coreDebugSettings,
+ CoreDebugSettings coreDebugSettings,
IMediaFileSystem mediaFileSystem,
ILogger logger, ITypeFinder typeFinder, FileSystems fileSystems, bool detachable, IScopeContext scopeContext,
IsolationLevel isolationLevel = IsolationLevel.Unspecified,
@@ -132,7 +132,7 @@ namespace Umbraco.Core.Scoping
// initializes a new scope in a nested scopes chain, with its parent
public Scope(ScopeProvider scopeProvider,
- ICoreDebugSettings coreDebugSettings,
+ CoreDebugSettings coreDebugSettings,
IMediaFileSystem mediaFileSystem,
ILogger logger, ITypeFinder typeFinder, FileSystems fileSystems, Scope parent,
IsolationLevel isolationLevel = IsolationLevel.Unspecified,
diff --git a/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs b/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs
index 610f308b96..5205a95e8d 100644
--- a/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs
+++ b/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs
@@ -1,14 +1,13 @@
using System;
-using System.Collections.Generic;
using System.Data;
+using Microsoft.Extensions.Options;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
-using Current = Umbraco.Composing.Current;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
#if DEBUG_SCOPES
using System.Linq;
@@ -26,10 +25,15 @@ namespace Umbraco.Core.Scoping
private readonly ITypeFinder _typeFinder;
private readonly IRequestCache _requestCache;
private readonly FileSystems _fileSystems;
- private readonly ICoreDebugSettings _coreDebugSettings;
+ private readonly CoreDebugSettings _coreDebugSettings;
private readonly IMediaFileSystem _mediaFileSystem;
- public ScopeProvider(IUmbracoDatabaseFactory databaseFactory, FileSystems fileSystems, ICoreDebugSettings coreDebugSettings, IMediaFileSystem mediaFileSystem, ILogger logger, ITypeFinder typeFinder, IRequestCache requestCache)
+ public ScopeProvider(IUmbracoDatabaseFactory databaseFactory, FileSystems fileSystems, IOptionsSnapshot coreDebugSettings, IMediaFileSystem mediaFileSystem, ILogger logger, ITypeFinder typeFinder, IRequestCache requestCache)
+ :this(databaseFactory, fileSystems, coreDebugSettings.Value, mediaFileSystem, logger, typeFinder, requestCache)
+ {
+ }
+
+ public ScopeProvider(IUmbracoDatabaseFactory databaseFactory, FileSystems fileSystems, CoreDebugSettings coreDebugSettings, IMediaFileSystem mediaFileSystem, ILogger logger, ITypeFinder typeFinder, IRequestCache requestCache)
{
DatabaseFactory = databaseFactory;
_fileSystems = fileSystems;
diff --git a/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs b/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs
index d6c30b24c6..112ab51bf8 100644
--- a/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs
+++ b/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs
@@ -6,9 +6,9 @@ using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading;
-using Umbraco.Core.Composing;
+using Microsoft.Extensions.Options;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -16,7 +16,6 @@ using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Scoping;
-using Umbraco.Core.Strings;
namespace Umbraco.Core.Services.Implement
{
@@ -28,12 +27,18 @@ namespace Umbraco.Core.Services.Implement
private readonly ILocalizationService _localizationService;
private readonly INotificationsRepository _notificationsRepository;
private readonly IGlobalSettings _globalSettings;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly ILogger _logger;
private readonly IIOHelper _ioHelper;
public NotificationService(IScopeProvider provider, IUserService userService, IContentService contentService, ILocalizationService localizationService,
- ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IGlobalSettings globalSettings, IContentSettings contentSettings)
+ ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IGlobalSettings globalSettings, IOptionsSnapshot contentSettings)
+ : this(provider, userService, contentService, localizationService, logger, ioHelper, notificationsRepository, globalSettings, contentSettings.Value)
+ {
+ }
+
+ public NotificationService(IScopeProvider provider, IUserService userService, IContentService contentService, ILocalizationService localizationService,
+ ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IGlobalSettings globalSettings, ContentSettings contentSettings)
{
_notificationsRepository = notificationsRepository;
_globalSettings = globalSettings;
@@ -302,7 +307,7 @@ namespace Umbraco.Core.Services.Implement
if (content.ContentType.VariesByNothing())
{
- if (!_contentSettings.DisableHtmlEmail)
+ if (!_contentSettings.Notifications.DisableHtmlEmail)
{
//create the HTML summary for invariant content
@@ -344,7 +349,7 @@ namespace Umbraco.Core.Services.Implement
{
//it's variant, so detect what cultures have changed
- if (!_contentSettings.DisableHtmlEmail)
+ if (!_contentSettings.Notifications.DisableHtmlEmail)
{
//Create the HTML based summary (ul of culture names)
@@ -406,13 +411,13 @@ namespace Umbraco.Core.Services.Implement
summary.ToString());
// create the mail message
- var mail = new MailMessage(_contentSettings.NotificationEmailAddress, mailingUser.Email);
+ var mail = new MailMessage(_contentSettings.Notifications.NotificationEmailAddress, mailingUser.Email);
// populate the message
mail.Subject = createSubject((mailingUser, subjectVars));
- if (_contentSettings.DisableHtmlEmail)
+ if (_contentSettings.Notifications.DisableHtmlEmail)
{
mail.IsBodyHtml = false;
mail.Body = createBody((user: mailingUser, body: bodyVars, false));
diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
index adb2a95202..fa0ac89c61 100644
--- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
+++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
@@ -41,7 +41,7 @@
-
+
@@ -97,6 +97,7 @@
+
diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs
index 85a463ddfa..3a6d099e46 100644
--- a/src/Umbraco.Tests.Common/TestHelperBase.cs
+++ b/src/Umbraco.Tests.Common/TestHelperBase.cs
@@ -18,6 +18,7 @@ using Umbraco.Core.Serialization;
using Umbraco.Core.Strings;
using Umbraco.Web;
using Umbraco.Web.Routing;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Tests.Common
{
@@ -82,7 +83,7 @@ namespace Umbraco.Tests.Common
public abstract IDbProviderFactoryCreator DbProviderFactoryCreator { get; }
public abstract IBulkSqlInsertProvider BulkSqlInsertProvider { get; }
public abstract IMarchal Marchal { get; }
- public ICoreDebugSettings CoreDebugSettings { get; } = new CoreDebugSettings();
+ public CoreDebugSettings CoreDebugSettings { get; } = new CoreDebugSettings();
public IIOHelper IOHelper
{
diff --git a/src/Umbraco.Tests.Integration/Persistence/Repositories/UserRepositoryTest.cs b/src/Umbraco.Tests.Integration/Persistence/Repositories/UserRepositoryTest.cs
index dddcff4331..dec3b55c76 100644
--- a/src/Umbraco.Tests.Integration/Persistence/Repositories/UserRepositoryTest.cs
+++ b/src/Umbraco.Tests.Integration/Persistence/Repositories/UserRepositoryTest.cs
@@ -5,6 +5,7 @@ using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Mappers;
@@ -25,7 +26,7 @@ namespace Umbraco.Tests.Persistence.Repositories
private UserRepository CreateRepository(IScopeProvider provider)
{
var accessor = (IScopeAccessor) provider;
- var repository = new UserRepository(accessor, AppCaches.Disabled, Logger, Mappers, GlobalSettings, Mock.Of(), new JsonNetSerializer());
+ var repository = new UserRepository(accessor, AppCaches.Disabled, Logger, Mappers, GlobalSettings, new UserPasswordConfigurationSettings(), new JsonNetSerializer());
return repository;
}
@@ -117,7 +118,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var id = user.Id;
- var repository2 = new UserRepository((IScopeAccessor) provider, AppCaches.Disabled, Logger, Mock.Of(),GlobalSettings, Mock.Of(), new JsonNetSerializer());
+ var repository2 = new UserRepository((IScopeAccessor) provider, AppCaches.Disabled, Logger, Mock.Of(),GlobalSettings, new UserPasswordConfigurationSettings(), new JsonNetSerializer());
repository2.Delete(user);
diff --git a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs
index 436fb45377..31edde3600 100644
--- a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs
+++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs
@@ -2,7 +2,7 @@
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings
{
diff --git a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs
index 21fd59de3a..85dc2f0ea6 100644
--- a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs
+++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs
@@ -1,9 +1,8 @@
using System;
-using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
using Umbraco.Core.Macros;
namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings
diff --git a/src/Umbraco.Tests/Components/ComponentTests.cs b/src/Umbraco.Tests/Components/ComponentTests.cs
index a20b220940..3bd7b0a7cc 100644
--- a/src/Umbraco.Tests/Components/ComponentTests.cs
+++ b/src/Umbraco.Tests/Components/ComponentTests.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Scoping;
using Umbraco.Tests.TestHelpers;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Tests.Components
{
@@ -35,7 +36,7 @@ namespace Umbraco.Tests.Components
var typeFinder = TestHelper.GetTypeFinder();
var f = new UmbracoDatabaseFactory(logger, SettingsForTests.DefaultGlobalSettings, Mock.Of(), new Lazy(() => new MapperCollection(Enumerable.Empty())), TestHelper.DbProviderFactoryCreator);
var fs = new FileSystems(mock.Object, logger, TestHelper.IOHelper, SettingsForTests.GenerateMockGlobalSettings(), TestHelper.GetHostingEnvironment());
- var coreDebug = Mock.Of();
+ var coreDebug = new CoreDebugSettings();
var mediaFileSystem = Mock.Of();
var p = new ScopeProvider(f, fs, coreDebug, mediaFileSystem, logger, typeFinder, NoAppCache.Instance);
diff --git a/src/Umbraco.Tests/Models/MediaXmlTest.cs b/src/Umbraco.Tests/Models/MediaXmlTest.cs
index 632f433c5b..1dd9f3d7cb 100644
--- a/src/Umbraco.Tests/Models/MediaXmlTest.cs
+++ b/src/Umbraco.Tests/Models/MediaXmlTest.cs
@@ -3,6 +3,7 @@ using System.Xml.Linq;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -31,7 +32,7 @@ namespace Umbraco.Tests.Models
// and then, this will reset the width, height... because the file does not exist, of course ;-(
var logger = Mock.Of();
var scheme = Mock.Of();
- var config = Mock.Of();
+ var config = new ContentSettings();
var mediaFileSystem = new MediaFileSystem(Mock.Of(), scheme, logger, ShortStringHelper);
var ignored = new FileUploadPropertyEditor(Mock.Of(), mediaFileSystem, config, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs
index a14eea1d91..03fc77572a 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs
@@ -15,6 +15,7 @@ using Umbraco.Core.PropertyEditors;
using System;
using Umbraco.Core.Configuration;
using Umbraco.Core.Serialization;
+using Umbraco.Core.Configuration.Models;
namespace Umbraco.Tests.Persistence.Repositories
{
@@ -68,7 +69,7 @@ namespace Umbraco.Tests.Persistence.Repositories
private UserRepository CreateRepository(IScopeProvider provider)
{
var accessor = (IScopeAccessor) provider;
- var repository = new UserRepository(accessor, AppCaches.Disabled, Logger, Mappers, TestObjects.GetGlobalSettings(), Mock.Of(), new JsonNetSerializer());
+ var repository = new UserRepository(accessor, AppCaches.Disabled, Logger, Mappers, TestObjects.GetGlobalSettings(), new UserPasswordConfigurationSettings(), new JsonNetSerializer());
return repository;
}
diff --git a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
index e55a22065b..c191bc1b43 100644
--- a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
+++ b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
@@ -4,6 +4,7 @@ using Moq;
using Newtonsoft.Json;
using NUnit.Framework;
using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -34,12 +35,12 @@ namespace Umbraco.Tests.Routing
var logger = Mock.Of();
var mediaFileSystemMock = Mock.Of();
- var contentSection = Mock.Of();
+ var contentSettings = new ContentSettings();
var dataTypeService = Mock.Of();
var propertyEditors = new MediaUrlGeneratorCollection(new IMediaUrlGenerator[]
{
- new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper),
- new ImageCropperPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, IOHelper, ShortStringHelper, LocalizedTextService),
+ new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSettings, dataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper),
+ new ImageCropperPropertyEditor(logger, mediaFileSystemMock, contentSettings, dataTypeService, LocalizationService, IOHelper, ShortStringHelper, LocalizedTextService),
});
_mediaUrlProvider = new DefaultMediaUrlProvider(propertyEditors, UriUtility);
}
diff --git a/src/Umbraco.Tests/Security/BackOfficeOwinUserManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeOwinUserManagerTests.cs
index 8958eabd42..d2a17d1004 100644
--- a/src/Umbraco.Tests/Security/BackOfficeOwinUserManagerTests.cs
+++ b/src/Umbraco.Tests/Security/BackOfficeOwinUserManagerTests.cs
@@ -9,6 +9,7 @@ using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Net;
using Umbraco.Web.Security;
@@ -23,18 +24,19 @@ namespace Umbraco.Tests.Security
const string v7Hash = "7Uob6fMTTxDIhWGebYiSxg==P+hgvWlXLbDd4cFLADn811KOaVI/9pg1PNvTuG5NklY=";
const string plaintext = "4XxzH3s3&J";
- var mockPasswordConfiguration = new Mock();
+ var passwordConfiguration = new UserPasswordConfigurationSettings
+ {
+ HashAlgorithmType = Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName
+ };
var mockIpResolver = new Mock();
var mockUserStore = new Mock>();
var mockDataProtectionProvider = new Mock();
mockDataProtectionProvider.Setup(x => x.Create(It.IsAny()))
.Returns(new Mock().Object);
- mockPasswordConfiguration.Setup(x => x.HashAlgorithmType)
- .Returns(Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName);
var userManager = BackOfficeOwinUserManager.Create(
- mockPasswordConfiguration.Object,
+ passwordConfiguration,
mockIpResolver.Object,
mockUserStore.Object,
null,
diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs
index 5512f50254..e9f05f43fc 100644
--- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs
+++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs
@@ -33,6 +33,7 @@ using Umbraco.Web;
using Umbraco.Web.Hosting;
using Umbraco.Web.Routing;
using File = System.IO.File;
+using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
namespace Umbraco.Tests.TestHelpers
{
@@ -94,7 +95,7 @@ namespace Umbraco.Tests.TestHelpers
public static IDbProviderFactoryCreator DbProviderFactoryCreator => _testHelperInternal.DbProviderFactoryCreator;
public static IBulkSqlInsertProvider BulkSqlInsertProvider => _testHelperInternal.BulkSqlInsertProvider;
public static IMarchal Marchal => _testHelperInternal.Marchal;
- public static ICoreDebugSettings CoreDebugSettings => _testHelperInternal.CoreDebugSettings;
+ public static CoreDebugSettings CoreDebugSettings => _testHelperInternal.CoreDebugSettings;
public static IIOHelper IOHelper => _testHelperInternal.IOHelper;
diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs
index 7e8914f78e..5077563e78 100644
--- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs
+++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs
@@ -7,6 +7,7 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Events;
using Umbraco.Core.Hosting;
@@ -95,7 +96,7 @@ namespace Umbraco.Tests.TestHelpers
ILogger logger,
IIOHelper ioHelper,
IGlobalSettings globalSettings,
- IContentSettings contentSettings,
+ ContentSettings contentSettings,
IEventMessagesFactory eventMessagesFactory,
UrlSegmentProviderCollection urlSegmentProviders,
IUmbracoVersion umbracoVersion,
diff --git a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
index 4faac5ce52..a82dda52c7 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
@@ -1,17 +1,17 @@
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Routing;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
@@ -46,10 +46,10 @@ namespace Umbraco.Web.BackOffice.Controllers
private readonly ILocalizedTextService _textService;
private readonly UmbracoMapper _umbracoMapper;
private readonly IGlobalSettings _globalSettings;
- private readonly ISecuritySettings _securitySettings;
+ private readonly SecuritySettings _securitySettings;
private readonly ILogger _logger;
private readonly IIpResolver _ipResolver;
- private readonly IUserPasswordConfiguration _passwordConfiguration;
+ private readonly UserPasswordConfigurationSettings _passwordConfiguration;
private readonly IEmailSender _emailSender;
private readonly Core.Hosting.IHostingEnvironment _hostingEnvironment;
private readonly IRequestAccessor _requestAccessor;
@@ -65,10 +65,10 @@ namespace Umbraco.Web.BackOffice.Controllers
ILocalizedTextService textService,
UmbracoMapper umbracoMapper,
IGlobalSettings globalSettings,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot securitySettings,
ILogger logger,
IIpResolver ipResolver,
- IUserPasswordConfiguration passwordConfiguration,
+ IOptionsSnapshot passwordConfiguration,
IEmailSender emailSender,
Core.Hosting.IHostingEnvironment hostingEnvironment,
IRequestAccessor requestAccessor)
@@ -80,10 +80,10 @@ namespace Umbraco.Web.BackOffice.Controllers
_textService = textService;
_umbracoMapper = umbracoMapper;
_globalSettings = globalSettings;
- _securitySettings = securitySettings;
+ _securitySettings = securitySettings.Value;
_logger = logger;
_ipResolver = ipResolver;
- _passwordConfiguration = passwordConfiguration;
+ _passwordConfiguration = passwordConfiguration.Value;
_emailSender = emailSender;
_hostingEnvironment = hostingEnvironment;
_requestAccessor = requestAccessor;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
index f3d11dea78..2768770e65 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
@@ -1,16 +1,15 @@
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
-using System.Text;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.WebAssets;
using Umbraco.Extensions;
@@ -19,10 +18,8 @@ using Umbraco.Web.BackOffice.PropertyEditors;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Editors;
using Umbraco.Web.Features;
-using Umbraco.Web.HealthCheck;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Trees;
-using Umbraco.Web.WebApi;
namespace Umbraco.Web.BackOffice.Controllers
{
@@ -36,12 +33,12 @@ namespace Umbraco.Web.BackOffice.Controllers
private readonly UmbracoFeatures _features;
private readonly IGlobalSettings _globalSettings;
private readonly IUmbracoVersion _umbracoVersion;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly TreeCollection _treeCollection;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IHostingEnvironment _hostingEnvironment;
- private readonly IRuntimeSettings _settings;
- private readonly ISecuritySettings _securitySettings;
+ private readonly RuntimeSettings _runtimeSettings;
+ private readonly SecuritySettings _securitySettings;
private readonly IRuntimeMinifier _runtimeMinifier;
private readonly IAuthenticationSchemeProvider _authenticationSchemeProvider;
@@ -51,12 +48,12 @@ namespace Umbraco.Web.BackOffice.Controllers
UmbracoFeatures features,
IGlobalSettings globalSettings,
IUmbracoVersion umbracoVersion,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
IHttpContextAccessor httpContextAccessor,
TreeCollection treeCollection,
IHostingEnvironment hostingEnvironment,
- IRuntimeSettings settings,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot runtimeSettings,
+ IOptionsSnapshot securitySettings,
IRuntimeMinifier runtimeMinifier,
IAuthenticationSchemeProvider authenticationSchemeProvider)
{
@@ -65,12 +62,12 @@ namespace Umbraco.Web.BackOffice.Controllers
_features = features;
_globalSettings = globalSettings;
_umbracoVersion = umbracoVersion;
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
_httpContextAccessor = httpContextAccessor;
_treeCollection = treeCollection ?? throw new ArgumentNullException(nameof(treeCollection));
_hostingEnvironment = hostingEnvironment;
- _settings = settings;
- _securitySettings = securitySettings;
+ _runtimeSettings = runtimeSettings.Value;
+ _securitySettings = securitySettings.Value;
_runtimeMinifier = runtimeMinifier;
_authenticationSchemeProvider = authenticationSchemeProvider;
}
@@ -362,7 +359,7 @@ namespace Umbraco.Web.BackOffice.Controllers
{"appPluginsPath", _hostingEnvironment.ToAbsolute(Constants.SystemDirectories.AppPlugins).TrimEnd('/')},
{
"imageFileTypes",
- string.Join(",", _contentSettings.ImageFileTypes)
+ string.Join(",", _contentSettings.Imaging.ImageFileTypes)
},
{
"disallowedUploadFiles",
@@ -509,7 +506,7 @@ namespace Umbraco.Web.BackOffice.Controllers
private string GetMaxRequestLength()
{
- return _settings.MaxRequestLength.HasValue ? _settings.MaxRequestLength.Value.ToString() : string.Empty;
+ return _runtimeSettings.MaxRequestLength.HasValue ? _runtimeSettings.MaxRequestLength.Value.ToString() : string.Empty;
}
}
}
diff --git a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
index 69b566d0cd..ff0eacb9bb 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
@@ -1,31 +1,30 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Umbraco.Core.Services;
-using Umbraco.Web.Models;
-using Umbraco.Web.Models.ContentEditing;
using System.Linq;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
-using Umbraco.Core.IO;
-using Umbraco.Web.WebApi.Filters;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
+using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Media;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.Security;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
+using Umbraco.Web.Models;
+using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Security;
namespace Umbraco.Web.BackOffice.Controllers
@@ -37,7 +36,7 @@ namespace Umbraco.Web.BackOffice.Controllers
public class CurrentUserController : UmbracoAuthorizedJsonController
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IImageUrlGenerator _imageUrlGenerator;
private readonly IWebSecurity _webSecurity;
@@ -51,7 +50,7 @@ namespace Umbraco.Web.BackOffice.Controllers
public CurrentUserController(
IMediaFileSystem mediaFileSystem,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
IHostingEnvironment hostingEnvironment,
IImageUrlGenerator imageUrlGenerator,
IWebSecurity webSecurity,
@@ -64,7 +63,7 @@ namespace Umbraco.Web.BackOffice.Controllers
IShortStringHelper shortStringHelper)
{
_mediaFileSystem = mediaFileSystem;
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_hostingEnvironment = hostingEnvironment;
_imageUrlGenerator = imageUrlGenerator;
_webSecurity = webSecurity;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/DataTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/DataTypeController.cs
index 194029db4b..d049dbebbb 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/DataTypeController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/DataTypeController.cs
@@ -4,20 +4,21 @@ using System.Data;
using System.Linq;
using System.Net;
using System.Net.Mime;
+using System.Text;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
-using Umbraco.Web.Models.ContentEditing;
-using System.Text;
-using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Mapping;
-using Microsoft.AspNetCore.Mvc;
-using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Editors;
+using Umbraco.Web.Models.ContentEditing;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.BackOffice.Controllers
{
@@ -34,7 +35,7 @@ namespace Umbraco.Web.BackOffice.Controllers
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly IDataTypeService _dataTypeService;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly UmbracoMapper _umbracoMapper;
private readonly PropertyEditorCollection _propertyEditorCollection;
private readonly IContentTypeService _contentTypeService;
@@ -46,7 +47,7 @@ namespace Umbraco.Web.BackOffice.Controllers
public DataTypeController(
PropertyEditorCollection propertyEditors,
IDataTypeService dataTypeService,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
UmbracoMapper umbracoMapper,
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
@@ -57,7 +58,7 @@ namespace Umbraco.Web.BackOffice.Controllers
{
_propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
_dataTypeService = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService));
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
_propertyEditorCollection = propertyEditorCollection ?? throw new ArgumentNullException(nameof(propertyEditorCollection));
_contentTypeService = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
diff --git a/src/Umbraco.Web.BackOffice/Controllers/ImagesController.cs b/src/Umbraco.Web.BackOffice/Controllers/ImagesController.cs
index 6ce6d3a1c6..f909313dff 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/ImagesController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/ImagesController.cs
@@ -1,8 +1,10 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Media;
using Umbraco.Core.Models;
@@ -18,13 +20,13 @@ namespace Umbraco.Web.BackOffice.Controllers
public class ImagesController : UmbracoAuthorizedApiController
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IImageUrlGenerator _imageUrlGenerator;
- public ImagesController(IMediaFileSystem mediaFileSystem, IContentSettings contentSettings, IImageUrlGenerator imageUrlGenerator)
+ public ImagesController(IMediaFileSystem mediaFileSystem, IOptionsSnapshot contentSettings, IImageUrlGenerator imageUrlGenerator)
{
_mediaFileSystem = mediaFileSystem;
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_imageUrlGenerator = imageUrlGenerator;
}
diff --git a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
index 6bb68248b1..9a339a18b8 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
@@ -3,35 +3,30 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Http;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Membership;
-using Umbraco.Core.Services;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Events;
using Umbraco.Core.Hosting;
+using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Mapping;
+using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
-using Umbraco.Core.Models.Editors;
using Umbraco.Core.Models.Entities;
+using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Validation;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.PropertyEditors;
-using Umbraco.Web.ContentApps;
-using Umbraco.Web.WebApi.Filters;
-using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Mapping;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Filters;
@@ -39,7 +34,11 @@ using Umbraco.Web.BackOffice.ModelBinders;
using Umbraco.Web.Common.ActionResults;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
+using Umbraco.Web.ContentApps;
+using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Security;
+using Umbraco.Web.WebApi.Filters;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.BackOffice.Controllers
{
@@ -52,7 +51,7 @@ namespace Umbraco.Web.BackOffice.Controllers
public class MediaController : ContentControllerBase
{
private readonly IShortStringHelper _shortStringHelper;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IMediaTypeService _mediaTypeService;
private readonly IMediaService _mediaService;
private readonly IEntityService _entityService;
@@ -69,7 +68,7 @@ namespace Umbraco.Web.BackOffice.Controllers
IShortStringHelper shortStringHelper,
IEventMessagesFactory eventMessages,
ILocalizedTextService localizedTextService,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
IMediaTypeService mediaTypeService,
IMediaService mediaService,
IEntityService entityService,
@@ -85,7 +84,7 @@ namespace Umbraco.Web.BackOffice.Controllers
: base(cultureDictionary, logger, shortStringHelper, eventMessages, localizedTextService)
{
_shortStringHelper = shortStringHelper;
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_mediaTypeService = mediaTypeService;
_mediaService = mediaService;
_entityService = entityService;
@@ -742,7 +741,7 @@ namespace Umbraco.Web.BackOffice.Controllers
if (contentTypeAlias == Constants.Conventions.MediaTypes.AutoSelect)
{
- if (_contentSettings.ImageFileTypes.Contains(ext))
+ if (_contentSettings.Imaging.ImageFileTypes.Contains(ext))
{
mediaType = Constants.Conventions.MediaTypes.Image;
}
diff --git a/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs b/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
index 9627c96e24..41aa693c0f 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
@@ -8,23 +8,20 @@ using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
+using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Security;
+using Umbraco.Core.Serialization;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
-using Umbraco.Web.ContentApps;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.WebApi.Filters;
-using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Mapping;
-using Umbraco.Core.Serialization;
using Umbraco.Core.Strings;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Filters;
@@ -32,7 +29,11 @@ using Umbraco.Web.BackOffice.ModelBinders;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Common.Filters;
+using Umbraco.Web.ContentApps;
+using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Security;
+using Umbraco.Web.WebApi.Filters;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.BackOffice.Controllers
{
@@ -45,8 +46,7 @@ namespace Umbraco.Web.BackOffice.Controllers
[OutgoingNoHyphenGuidFormat]
public class MemberController : ContentControllerBase
{
-
- private readonly IMemberPasswordConfiguration _passwordConfig;
+ private readonly MemberPasswordConfigurationSettings _passwordConfig;
private readonly PropertyEditorCollection _propertyEditors;
private readonly LegacyPasswordSecurity _passwordSecurity;
private readonly UmbracoMapper _umbracoMapper;
@@ -63,7 +63,7 @@ namespace Umbraco.Web.BackOffice.Controllers
IShortStringHelper shortStringHelper,
IEventMessagesFactory eventMessages,
ILocalizedTextService localizedTextService,
- IMemberPasswordConfiguration passwordConfig,
+ IOptionsSnapshot passwordConfig,
PropertyEditorCollection propertyEditors,
LegacyPasswordSecurity passwordSecurity,
UmbracoMapper umbracoMapper,
@@ -74,7 +74,7 @@ namespace Umbraco.Web.BackOffice.Controllers
IJsonSerializer jsonSerializer)
: base(cultureDictionary, logger, shortStringHelper, eventMessages, localizedTextService)
{
- _passwordConfig = passwordConfig;
+ _passwordConfig = passwordConfig.Value;
_propertyEditors = propertyEditors;
_passwordSecurity = passwordSecurity;
_umbracoMapper = umbracoMapper;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/TinyMceController.cs b/src/Umbraco.Web.BackOffice/Controllers/TinyMceController.cs
index dd7c539922..5a28a228f3 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/TinyMceController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/TinyMceController.cs
@@ -6,8 +6,10 @@ using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Strings;
@@ -28,19 +30,19 @@ namespace Umbraco.Web.BackOffice.Controllers
{
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IShortStringHelper _shortStringHelper;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IIOHelper _ioHelper;
public TinyMceController(
IHostingEnvironment hostingEnvironment,
IShortStringHelper shortStringHelper,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
IIOHelper ioHelper
)
{
_hostingEnvironment = hostingEnvironment;
_shortStringHelper = shortStringHelper;
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_ioHelper = ioHelper;
}
@@ -76,7 +78,7 @@ namespace Umbraco.Web.BackOffice.Controllers
var safeFileName = fileName.ToSafeFileName(_shortStringHelper);
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
- if (_contentSettings.IsFileAllowedForUpload(ext) == false || _contentSettings.ImageFileTypes.Contains(ext) == false)
+ if (_contentSettings.IsFileAllowedForUpload(ext) == false || _contentSettings.Imaging.ImageFileTypes.Contains(ext) == false)
{
// Throw some error - to say can't upload this IMG type
return new UmbracoProblemResult("This is not an image filetype extension that is approved", HttpStatusCode.BadRequest);
diff --git a/src/Umbraco.Web.BackOffice/Controllers/TourController.cs b/src/Umbraco.Web.BackOffice/Controllers/TourController.cs
index c74cf41daf..106d520743 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/TourController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/TourController.cs
@@ -4,9 +4,8 @@ using System.IO;
using System.Linq;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
-using Umbraco.Configuration.Models;
using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.Services;
using Umbraco.Web.Common.Attributes;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
index fff609322c..07c2cab1c7 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Http;
using System.Net.Mail;
using System.Runtime.Serialization;
using System.Security.Cryptography;
@@ -11,27 +10,22 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
+using Umbraco.Core.Mapping;
+using Umbraco.Core.Media;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
-using Umbraco.Web.Models;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.WebApi.Filters;
-using Constants = Umbraco.Core.Constants;
-using IUser = Umbraco.Core.Models.Membership.IUser;
-using Task = System.Threading.Tasks.Task;
-using Umbraco.Core.Mapping;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.Media;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.Security;
@@ -39,7 +33,13 @@ using Umbraco.Web.Common.ActionResults;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Editors;
+using Umbraco.Web.Models;
+using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Security;
+using Umbraco.Web.WebApi.Filters;
+using Constants = Umbraco.Core.Constants;
+using IUser = Umbraco.Core.Models.Membership.IUser;
+using Task = System.Threading.Tasks.Task;
namespace Umbraco.Web.BackOffice.Controllers
{
@@ -50,11 +50,11 @@ namespace Umbraco.Web.BackOffice.Controllers
public class UsersController : UmbracoAuthorizedJsonController
{
private readonly IMediaFileSystem _mediaFileSystem;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly ISqlContext _sqlContext;
private readonly IImageUrlGenerator _imageUrlGenerator;
- private readonly ISecuritySettings _securitySettings;
+ private readonly SecuritySettings _securitySettings;
private readonly IRequestAccessor _requestAccessor;
private readonly IEmailSender _emailSender;
private readonly IWebSecurity _webSecurity;
@@ -73,11 +73,11 @@ namespace Umbraco.Web.BackOffice.Controllers
public UsersController(
IMediaFileSystem mediaFileSystem,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
IHostingEnvironment hostingEnvironment,
ISqlContext sqlContext,
IImageUrlGenerator imageUrlGenerator,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot securitySettings,
IRequestAccessor requestAccessor,
IEmailSender emailSender,
IWebSecurity webSecurity,
@@ -95,11 +95,11 @@ namespace Umbraco.Web.BackOffice.Controllers
LinkGenerator linkGenerator)
{
_mediaFileSystem = mediaFileSystem;
- _contentSettings = contentSettings;
+ _contentSettings = contentSettings.Value;
_hostingEnvironment = hostingEnvironment;
_sqlContext = sqlContext;
_imageUrlGenerator = imageUrlGenerator;
- _securitySettings = securitySettings;
+ _securitySettings = securitySettings.Value;
_requestAccessor = requestAccessor;
_emailSender = emailSender;
_webSecurity = webSecurity;
@@ -137,7 +137,7 @@ namespace Umbraco.Web.BackOffice.Controllers
return await PostSetAvatarInternal(files, _userService, _appCaches.RuntimeCache, _mediaFileSystem, _shortStringHelper, _contentSettings, _hostingEnvironment, _imageUrlGenerator, id);
}
- internal static async Task PostSetAvatarInternal(IList files, IUserService userService, IAppCache cache, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper, IContentSettings contentSettings, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, int id)
+ internal static async Task PostSetAvatarInternal(IList files, IUserService userService, IAppCache cache, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper, ContentSettings contentSettings, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, int id)
{
if (files is null)
{
diff --git a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs
index 2c7db69b84..c9e53b1b82 100644
--- a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs
@@ -2,9 +2,10 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Security;
using Umbraco.Core.Serialization;
using Umbraco.Net;
@@ -73,7 +74,7 @@ namespace Umbraco.Extensions
services.TryAddScoped, PasswordValidator>();
services.TryAddScoped>(
services => new BackOfficePasswordHasher(
- new LegacyPasswordSecurity(services.GetRequiredService()),
+ new LegacyPasswordSecurity(services.GetRequiredService>().Value),
services.GetRequiredService()));
services.TryAddScoped, DefaultUserConfirmation>();
services.TryAddScoped, UserClaimsPrincipalFactory>();
diff --git a/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs b/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs
index 0a7bdb0026..b05a05c167 100644
--- a/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs
+++ b/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs
@@ -1,14 +1,14 @@
-using Umbraco.Core;
+using System;
+using Microsoft.Extensions.Options;
+using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Dictionary;
-using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Trees;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using System;
namespace Umbraco.Web.Models.Mapping
{
@@ -23,17 +23,17 @@ namespace Umbraco.Web.Models.Mapping
private readonly IMediaTypeService _mediaTypeService;
private readonly MediaUrlGeneratorCollection _mediaUrlGenerators;
private readonly TabsAndPropertiesMapper _tabsAndPropertiesMapper;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
public MediaMapDefinition(ICultureDictionary cultureDictionary, CommonMapper commonMapper, CommonTreeNodeMapper commonTreeNodeMapper, IMediaService mediaService, IMediaTypeService mediaTypeService,
- ILocalizedTextService localizedTextService, MediaUrlGeneratorCollection mediaUrlGenerators, IContentSettings contentSettings, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
+ ILocalizedTextService localizedTextService, MediaUrlGeneratorCollection mediaUrlGenerators, IOptionsSnapshot contentSettings, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
{
_commonMapper = commonMapper;
_commonTreeNodeMapper = commonTreeNodeMapper;
_mediaService = mediaService;
_mediaTypeService = mediaTypeService;
_mediaUrlGenerators = mediaUrlGenerators;
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
_tabsAndPropertiesMapper = new TabsAndPropertiesMapper(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider);
}
diff --git a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs
index d51db33a55..70cdf05dc5 100644
--- a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs
+++ b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs
@@ -5,20 +5,20 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
-using Umbraco.Core.Services;
-using Umbraco.Net;
using Umbraco.Core.Security;
+using Umbraco.Core.Services;
using Umbraco.Extensions;
-using Microsoft.Extensions.DependencyInjection;
+using Umbraco.Net;
using Umbraco.Web.Common.Security;
-using Microsoft.AspNetCore.Routing;
namespace Umbraco.Web.BackOffice.Security
{
@@ -28,7 +28,7 @@ namespace Umbraco.Web.BackOffice.Security
public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
- private readonly ISecuritySettings _securitySettings;
+ private readonly SecuritySettings _securitySettings;
private readonly IGlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IRuntimeState _runtimeState;
@@ -42,7 +42,7 @@ namespace Umbraco.Web.BackOffice.Security
public ConfigureBackOfficeCookieOptions(
IUmbracoContextAccessor umbracoContextAccessor,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot securitySettings,
IGlobalSettings globalSettings,
IHostingEnvironment hostingEnvironment,
IRuntimeState runtimeState,
@@ -55,7 +55,7 @@ namespace Umbraco.Web.BackOffice.Security
LinkGenerator linkGenerator)
{
_umbracoContextAccessor = umbracoContextAccessor;
- _securitySettings = securitySettings;
+ _securitySettings = securitySettings.Value;
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnvironment;
_runtimeState = runtimeState;
@@ -230,7 +230,7 @@ namespace Umbraco.Web.BackOffice.Security
}
///
- /// Ensures the ticket is renewed if the is set to true
+ /// Ensures the ticket is renewed if the is set to true
/// and the current request is for the get user seconds endpoint
///
///
diff --git a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
index 13d608bd9b..5dd80411eb 100644
--- a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
+++ b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
namespace Umbraco.Web.BackOffice.Security
{
@@ -13,11 +14,11 @@ namespace Umbraco.Web.BackOffice.Security
///
public class ConfigureBackOfficeIdentityOptions : IConfigureOptions
{
- private readonly IUserPasswordConfiguration _userPasswordConfiguration;
+ private readonly UserPasswordConfigurationSettings _userPasswordConfiguration;
- public ConfigureBackOfficeIdentityOptions(IUserPasswordConfiguration userPasswordConfiguration)
+ public ConfigureBackOfficeIdentityOptions(IOptionsSnapshot userPasswordConfiguration)
{
- _userPasswordConfiguration = userPasswordConfiguration;
+ _userPasswordConfiguration = userPasswordConfiguration.Value;
}
public void Configure(BackOfficeIdentityOptions options)
diff --git a/src/Umbraco.Web.Common/AspNetCore/UmbracoViewPage.cs b/src/Umbraco.Web.Common/AspNetCore/UmbracoViewPage.cs
index e72b62b006..88e361029f 100644
--- a/src/Umbraco.Web.Common/AspNetCore/UmbracoViewPage.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/UmbracoViewPage.cs
@@ -3,9 +3,10 @@ using System.Text;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
@@ -25,7 +26,7 @@ namespace Umbraco.Web.Common.AspNetCore
private IUmbracoContext _umbracoContext;
private IUmbracoContextAccessor UmbracoContextAccessor => Context.RequestServices.GetRequiredService();
private IGlobalSettings GlobalSettings => Context.RequestServices.GetRequiredService();
- private IContentSettings ContentSettings => Context.RequestServices.GetRequiredService();
+ private ContentSettings ContentSettings => Context.RequestServices.GetRequiredService>().Value;
private IProfilerHtml ProfilerHtml => Context.RequestServices.GetRequiredService();
private IIOHelper IOHelper => Context.RequestServices.GetRequiredService();
diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
index cbc374f93b..7a02b53724 100644
--- a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
@@ -112,7 +112,7 @@ namespace Umbraco.Extensions
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "ExceptionFilter:"));
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "ActiveDirectory:"));
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Runtime:"));
- services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "TypeFinder:"));
+ services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "TypeFinder:"));
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "NuCache:"));
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "WebRouting:"));
services.Configure(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Examine:"));
diff --git a/src/Umbraco.Web.Common/Filters/ModelBindingExceptionFilter.cs b/src/Umbraco.Web.Common/Filters/ModelBindingExceptionFilter.cs
index 559a02e149..76e462843e 100644
--- a/src/Umbraco.Web.Common/Filters/ModelBindingExceptionFilter.cs
+++ b/src/Umbraco.Web.Common/Filters/ModelBindingExceptionFilter.cs
@@ -4,8 +4,9 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Common.ModelBinders;
@@ -22,12 +23,12 @@ namespace Umbraco.Web.Common.Filters
{
private static readonly Regex _getPublishedModelsTypesRegex = new Regex("Umbraco.Web.PublishedModels.(\\w+)", RegexOptions.Compiled);
- private readonly IExceptionFilterSettings _exceptionFilterSettings;
+ private readonly ExceptionFilterSettings _exceptionFilterSettings;
private readonly IPublishedModelFactory _publishedModelFactory;
- public ModelBindingExceptionFilter(IExceptionFilterSettings exceptionFilterSettings, IPublishedModelFactory publishedModelFactory)
+ public ModelBindingExceptionFilter(IOptionsSnapshot exceptionFilterSettings, IPublishedModelFactory publishedModelFactory)
{
- _exceptionFilterSettings = exceptionFilterSettings;
+ _exceptionFilterSettings = exceptionFilterSettings.Value;
_publishedModelFactory = publishedModelFactory ?? throw new ArgumentNullException(nameof(publishedModelFactory));
}
diff --git a/src/Umbraco.Web.Common/Macros/MacroRenderer.cs b/src/Umbraco.Web.Common/Macros/MacroRenderer.cs
index 8685c0b8b1..eae771b930 100644
--- a/src/Umbraco.Web.Common/Macros/MacroRenderer.cs
+++ b/src/Umbraco.Web.Common/Macros/MacroRenderer.cs
@@ -4,9 +4,10 @@ using System.IO;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -22,7 +23,7 @@ namespace Umbraco.Web.Macros
{
private readonly IProfilingLogger _plogger;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
- private readonly IContentSettings _contentSettings;
+ private readonly ContentSettings _contentSettings;
private readonly ILocalizedTextService _textService;
private readonly AppCaches _appCaches;
private readonly IMacroService _macroService;
@@ -33,11 +34,10 @@ namespace Umbraco.Web.Macros
private readonly IRequestAccessor _requestAccessor;
private readonly IHttpContextAccessor _httpContextAccessor;
-
public MacroRenderer(
IProfilingLogger plogger,
IUmbracoContextAccessor umbracoContextAccessor,
- IContentSettings contentSettings,
+ IOptionsSnapshot contentSettings,
ILocalizedTextService textService,
AppCaches appCaches,
IMacroService macroService,
@@ -50,7 +50,7 @@ namespace Umbraco.Web.Macros
{
_plogger = plogger ?? throw new ArgumentNullException(nameof(plogger));
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
- _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
+ _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
_textService = textService;
_appCaches = appCaches ?? throw new ArgumentNullException(nameof(appCaches));
_macroService = macroService ?? throw new ArgumentNullException(nameof(macroService));
diff --git a/src/Umbraco.Web.Common/Runtime/AspNetCoreComposer.cs b/src/Umbraco.Web.Common/Runtime/AspNetCoreComposer.cs
index 959c4c27a2..a0a84e893f 100644
--- a/src/Umbraco.Web.Common/Runtime/AspNetCoreComposer.cs
+++ b/src/Umbraco.Web.Common/Runtime/AspNetCoreComposer.cs
@@ -26,6 +26,8 @@ using Umbraco.Web.Common.Templates;
using Umbraco.Web.Common.Security;
using Umbraco.Web.Security;
using Umbraco.Web.Templates;
+using Umbraco.Configuration.Models;
+using Microsoft.Extensions.Options;
namespace Umbraco.Web.Common.Runtime
{
@@ -96,7 +98,7 @@ namespace Umbraco.Web.Common.Runtime
composition.RegisterUnique();
composition.RegisterUnique();
- composition.RegisterUnique(factory => new LegacyPasswordSecurity(factory.GetInstance()));
+ composition.RegisterUnique(factory => new LegacyPasswordSecurity(factory.GetInstance>().Value));
}
diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs
index e4773a85d5..73fa53f7bc 100644
--- a/src/Umbraco.Web/Editors/AuthenticationController.cs
+++ b/src/Umbraco.Web/Editors/AuthenticationController.cs
@@ -1,35 +1,30 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
-using System.Collections.Generic;
-using System.Net.Mail;
using System.Security.Principal;
using System.Threading.Tasks;
-using System.Web;
using System.Web.Http;
-using System.Web.Mvc;
using Microsoft.AspNetCore.Identity;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Models;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Hosting;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Mapping;
+using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
using Umbraco.Web.Models;
-using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
+using Umbraco.Web.Routing;
using Umbraco.Web.Security;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Persistence;
-using IUser = Umbraco.Core.Models.Membership.IUser;
-using Umbraco.Core.Mapping;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Hosting;
-using Umbraco.Extensions;
-using Umbraco.Web.Routing;
using Constants = Umbraco.Core.Constants;
+using IUser = Umbraco.Core.Models.Membership.IUser;
namespace Umbraco.Web.Editors
{
@@ -47,7 +42,7 @@ namespace Umbraco.Web.Editors
private readonly IUserPasswordConfiguration _passwordConfiguration;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IRuntimeState _runtimeState;
- private readonly ISecuritySettings _securitySettings;
+ private readonly SecuritySettings _securitySettings;
private readonly IRequestAccessor _requestAccessor;
private readonly IEmailSender _emailSender;
@@ -62,7 +57,7 @@ namespace Umbraco.Web.Editors
IProfilingLogger logger,
IRuntimeState runtimeState,
UmbracoMapper umbracoMapper,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot securitySettings,
IPublishedUrlProvider publishedUrlProvider,
IRequestAccessor requestAccessor,
IEmailSender emailSender)
@@ -71,7 +66,7 @@ namespace Umbraco.Web.Editors
_passwordConfiguration = passwordConfiguration ?? throw new ArgumentNullException(nameof(passwordConfiguration));
_hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
_runtimeState = runtimeState ?? throw new ArgumentNullException(nameof(runtimeState));
- _securitySettings = securitySettings ?? throw new ArgumentNullException(nameof(securitySettings));
+ _securitySettings = securitySettings.Value ?? throw new ArgumentNullException(nameof(securitySettings));
_requestAccessor = requestAccessor ?? throw new ArgumentNullException(nameof(securitySettings));
_emailSender = emailSender;
}
diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs
index b963871a58..4258267421 100644
--- a/src/Umbraco.Web/Editors/BackOfficeController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeController.cs
@@ -4,19 +4,21 @@ using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNetCore.Identity;
+using Microsoft.Extensions.Options;
using Microsoft.Owin.Security;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using Umbraco.Web.Mvc;
-using Umbraco.Core.Services;
-using Umbraco.Web.Features;
-using Umbraco.Web.Security;
-using Constants = Umbraco.Core.Constants;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Hosting;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Services;
+using Umbraco.Web.Features;
+using Umbraco.Web.Mvc;
+using Umbraco.Web.Security;
using BackOfficeIdentityUser = Umbraco.Core.BackOffice.BackOfficeIdentityUser;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Editors
{
@@ -34,8 +36,8 @@ namespace Umbraco.Web.Editors
private readonly IUmbracoVersion _umbracoVersion;
private readonly IContentSettings _contentSettings;
private readonly IHostingEnvironment _hostingEnvironment;
- private readonly IRuntimeSettings _runtimeSettings;
- private readonly ISecuritySettings _securitySettings;
+ private readonly RuntimeSettings _runtimeSettings;
+ private readonly SecuritySettings _securitySettings;
public BackOfficeController(
UmbracoFeatures features,
@@ -47,17 +49,16 @@ namespace Umbraco.Web.Editors
IUmbracoVersion umbracoVersion,
IContentSettings contentSettings,
IHostingEnvironment hostingEnvironment,
- IRuntimeSettings settings,
- ISecuritySettings securitySettings)
+ IOptionsSnapshot runtimeSettings,
+ IOptionsSnapshot securitySettings)
: base(globalSettings, umbracoContextAccessor, services, appCaches, profilingLogger)
-
{
_features = features;
_umbracoVersion = umbracoVersion;
_contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
_hostingEnvironment = hostingEnvironment;
- _runtimeSettings = settings;
- _securitySettings = securitySettings;
+ _runtimeSettings = runtimeSettings.Value;
+ _securitySettings = securitySettings.Value;
}
protected BackOfficeSignInManager SignInManager => _signInManager ?? (_signInManager = OwinContext.GetBackOfficeSignInManager());
diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs
index 454338112c..0dd232cbfb 100644
--- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs
@@ -5,18 +5,18 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using System.Web.Mvc;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Web.Features;
-using Umbraco.Web.HealthCheck;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.Mvc;
-using Umbraco.Web.Trees;
-using Constants = Umbraco.Core.Constants;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Hosting;
using Umbraco.Core.WebAssets;
+using Umbraco.Web.Features;
+using Umbraco.Web.Mvc;
using Umbraco.Web.Security;
+using Umbraco.Web.Trees;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Editors
{
@@ -34,8 +34,8 @@ namespace Umbraco.Web.Editors
private readonly TreeCollection _treeCollection;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IHostingEnvironment _hostingEnvironment;
- private readonly IRuntimeSettings _settings;
- private readonly ISecuritySettings _securitySettings;
+ private readonly RuntimeSettings _runtimeSettings;
+ private readonly SecuritySettings _securitySettings;
private readonly IRuntimeMinifier _runtimeMinifier;
internal BackOfficeServerVariables(
@@ -47,8 +47,8 @@ namespace Umbraco.Web.Editors
IContentSettings contentSettings,
TreeCollection treeCollection,
IHostingEnvironment hostingEnvironment,
- IRuntimeSettings settings,
- ISecuritySettings securitySettings,
+ IOptionsSnapshot runtimeSettings,
+ IOptionsSnapshot securitySettings,
IRuntimeMinifier runtimeMinifier)
{
_urlHelper = urlHelper;
@@ -59,8 +59,8 @@ namespace Umbraco.Web.Editors
_contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
_treeCollection = treeCollection ?? throw new ArgumentNullException(nameof(treeCollection));
_hostingEnvironment = hostingEnvironment;
- _settings = settings;
- _securitySettings = securitySettings;
+ _runtimeSettings = runtimeSettings.Value;
+ _securitySettings = securitySettings.Value;
_runtimeMinifier = runtimeMinifier;
}
@@ -288,7 +288,7 @@ namespace Umbraco.Web.Editors
private string GetMaxRequestLength()
{
- return _settings.MaxRequestLength.HasValue ? _settings.MaxRequestLength.Value.ToString() : string.Empty;
+ return _runtimeSettings.MaxRequestLength.HasValue ? _runtimeSettings.MaxRequestLength.Value.ToString() : string.Empty;
}
}
}
diff --git a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs
index 26b85d6c39..8a093f1943 100644
--- a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs
+++ b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs
@@ -1,15 +1,10 @@
-using System;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.Owin;
+using Microsoft.Extensions.Options;
using Microsoft.Owin.Security.Cookies;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Services;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
-using Umbraco.Core.Security;
+using Umbraco.Core.Services;
namespace Umbraco.Web.Security
{
@@ -21,24 +16,25 @@ namespace Umbraco.Web.Security
private readonly IRuntimeState _runtimeState;
private readonly IGlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
- private readonly ISecuritySettings _securitySettings;
+ private readonly SecuritySettings _securitySettings;
- public BackOfficeCookieAuthenticationProvider(IUserService userService, IRuntimeState runtimeState, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment, ISecuritySettings securitySettings)
+ public BackOfficeCookieAuthenticationProvider(
+ IUserService userService,
+ IRuntimeState runtimeState,
+ IGlobalSettings globalSettings,
+ IHostingEnvironment hostingEnvironment,
+ IOptionsSnapshot securitySettings)
{
_userService = userService;
_runtimeState = runtimeState;
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnvironment;
- _securitySettings = securitySettings;
+ _securitySettings = securitySettings.Value;
}
public override void ResponseSignOut(CookieResponseSignOutContext context)
- {
-
+ {
}
-
-
-
}
}
diff --git a/src/Umbraco.Web/Security/BackOfficeOwinUserManager.cs b/src/Umbraco.Web/Security/BackOfficeOwinUserManager.cs
index 771c3239b6..da3500fb25 100644
--- a/src/Umbraco.Web/Security/BackOfficeOwinUserManager.cs
+++ b/src/Umbraco.Web/Security/BackOfficeOwinUserManager.cs
@@ -8,6 +8,7 @@ using Microsoft.Owin.Security.DataProtection;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Mapping;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
@@ -20,7 +21,7 @@ namespace Umbraco.Web.Security
public const string OwinMarkerKey = "Umbraco.Web.Security.Identity.BackOfficeUserManagerMarker";
public BackOfficeOwinUserManager(
- IUserPasswordConfiguration passwordConfiguration,
+ IOptions passwordConfiguration,
IIpResolver ipResolver,
IUserStore store,
IOptions optionsAccessor,
@@ -32,7 +33,7 @@ namespace Umbraco.Web.Security
ILogger> logger)
: base(ipResolver, store, optionsAccessor, null, userValidators, passwordValidators, keyNormalizer, errors, null, logger, passwordConfiguration)
{
- PasswordConfiguration = passwordConfiguration;
+ PasswordConfiguration = passwordConfiguration.Value;
InitUserManager(this, dataProtectionProvider);
}
@@ -47,7 +48,7 @@ namespace Umbraco.Web.Security
IExternalLoginService externalLoginService,
IGlobalSettings globalSettings,
UmbracoMapper mapper,
- IUserPasswordConfiguration passwordConfiguration,
+ UserPasswordConfigurationSettings passwordConfiguration,
IIpResolver ipResolver,
BackOfficeIdentityErrorDescriber errors,
IDataProtectionProvider dataProtectionProvider,
@@ -68,7 +69,7 @@ namespace Umbraco.Web.Security
/// Creates a BackOfficeUserManager instance with all default options and a custom BackOfficeUserManager instance
///
public static BackOfficeOwinUserManager Create(
- IUserPasswordConfiguration passwordConfiguration,
+ UserPasswordConfigurationSettings passwordConfiguration,
IIpResolver ipResolver,
IUserStore customUserStore,
BackOfficeIdentityErrorDescriber errors,
@@ -103,7 +104,7 @@ namespace Umbraco.Web.Security
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromDays(30);
return new BackOfficeOwinUserManager(
- passwordConfiguration,
+ new OptionsWrapper(passwordConfiguration),
ipResolver,
customUserStore,
new OptionsWrapper(options),
diff --git a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs
index 3ab37f0f70..0bf83efd34 100644
--- a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs
+++ b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs
@@ -3,14 +3,13 @@ using System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks;
using System.Web;
+using Microsoft.Extensions.Options;
using Microsoft.Owin;
using Microsoft.Owin.Logging;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
-using Umbraco.Core.Security;
namespace Umbraco.Web.Security
{
@@ -26,7 +25,7 @@ namespace Umbraco.Web.Security
{
private readonly UmbracoBackOfficeCookieAuthOptions _authOptions;
private readonly IGlobalSettings _globalSettings;
- private readonly ISecuritySettings _security;
+ private readonly SecuritySettings _securitySettings;
private readonly ILogger _logger;
private readonly IHostingEnvironment _hostingEnvironment;
@@ -34,14 +33,14 @@ namespace Umbraco.Web.Security
OwinMiddleware next,
UmbracoBackOfficeCookieAuthOptions authOptions,
IGlobalSettings globalSettings,
- ISecuritySettings security,
+ IOptionsSnapshot securitySettings,
ILogger logger,
IHostingEnvironment hostingEnvironment)
: base(next)
{
_authOptions = authOptions ?? throw new ArgumentNullException(nameof(authOptions));
_globalSettings = globalSettings;
- _security = security;
+ _securitySettings = securitySettings.Value;
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_hostingEnvironment = hostingEnvironment;
}
@@ -55,7 +54,7 @@ namespace Umbraco.Web.Security
&& request.Uri.AbsolutePath.InvariantEquals(
$"{_globalSettings.GetBackOfficePath(_hostingEnvironment)}/backoffice/UmbracoApi/Authentication/GetRemainingTimeoutSeconds"))
{
- var cookie = _authOptions.CookieManager.GetRequestCookie(context, _security.AuthCookieName);
+ var cookie = _authOptions.CookieManager.GetRequestCookie(context, _securitySettings.AuthCookieName);
if (cookie.IsNullOrWhiteSpace() == false)
{
var ticket = _authOptions.TicketDataFormat.Unprotect(cookie);
@@ -75,7 +74,7 @@ namespace Umbraco.Web.Security
//Ok, so here we need to check if we want to process/renew the auth ticket for each
// of these requests. If that is the case, the user will really never be logged out until they
// close their browser (there will be edge cases of that, especially when debugging)
- if (_security.KeepUserLoggedIn)
+ if (_securitySettings.KeepUserLoggedIn)
{
var currentUtc = _authOptions.SystemClock.UtcNow;
var issuedUtc = ticket.Properties.IssuedUtc;
diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs
index 600b58cf06..af10009a0e 100644
--- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs
+++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs
@@ -1,20 +1,20 @@
using System;
+using Microsoft.Extensions.Options;
using Microsoft.Owin;
using Owin;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Mapping;
-using Umbraco.Net;
using Umbraco.Core.Services;
+using Umbraco.Net;
using Umbraco.Web;
using Umbraco.Web.Composing;
using Umbraco.Web.Security;
-
[assembly: OwinStartup("UmbracoDefaultOwinStartup", typeof(UmbracoDefaultOwinStartup))]
namespace Umbraco.Web
@@ -30,7 +30,7 @@ namespace Umbraco.Web
protected IUmbracoContextAccessor UmbracoContextAccessor => Current.UmbracoContextAccessor;
protected IGlobalSettings GlobalSettings => Current.Factory.GetInstance();
protected IContentSettings ContentSettings => Current.Factory.GetInstance();
- protected ISecuritySettings SecuritySettings => Current.Factory.GetInstance();
+ protected SecuritySettings SecuritySettings => Current.Factory.GetInstance>().Value;
protected IUserPasswordConfiguration UserPasswordConfig => Current.Factory.GetInstance();
protected IRuntimeState RuntimeState => Current.RuntimeState;
protected ServiceContext Services => Current.Services;
diff --git a/src/Umbraco.Web/WebAssets/CDF/ClientDependencyComponent.cs b/src/Umbraco.Web/WebAssets/CDF/ClientDependencyComponent.cs
index 0d8d4b8bf2..9a8da5a7eb 100644
--- a/src/Umbraco.Web/WebAssets/CDF/ClientDependencyComponent.cs
+++ b/src/Umbraco.Web/WebAssets/CDF/ClientDependencyComponent.cs
@@ -3,9 +3,11 @@ using System.Collections.Specialized;
using System.IO;
using ClientDependency.Core.CompositeFiles.Providers;
using ClientDependency.Core.Config;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Web.Runtime;
@@ -16,16 +18,16 @@ namespace Umbraco.Web.WebAssets.CDF
{
private readonly IHostingSettings _hostingSettings;
private readonly IHostingEnvironment _hostingEnvironment;
- private readonly IRuntimeSettings _settings;
+ private readonly RuntimeSettings _runtimeSettings;
public ClientDependencyComponent(
IHostingSettings hostingSettings,
IHostingEnvironment hostingEnvironment,
- IRuntimeSettings settings)
+ IOptionsSnapshot runtimeSettings)
{
_hostingSettings = hostingSettings;
_hostingEnvironment = hostingEnvironment;
- _settings = settings;
+ _runtimeSettings = runtimeSettings.Value;
}
public void Initialize()
@@ -54,10 +56,10 @@ namespace Umbraco.Web.WebAssets.CDF
= Path.Combine(cachePath, "ClientDependency");
}
- if (_settings.MaxQueryStringLength.HasValue || _settings.MaxRequestLength.HasValue)
+ if (_runtimeSettings.MaxQueryStringLength.HasValue || _runtimeSettings.MaxRequestLength.HasValue)
{
//set the max url length for CDF to be the smallest of the max query length, max request length
- ClientDependency.Core.CompositeFiles.CompositeDependencyHandler.MaxHandlerUrlLength = Math.Min(_settings.MaxQueryStringLength.GetValueOrDefault(), _settings.MaxRequestLength.GetValueOrDefault());
+ ClientDependency.Core.CompositeFiles.CompositeDependencyHandler.MaxHandlerUrlLength = Math.Min(_runtimeSettings.MaxQueryStringLength.GetValueOrDefault(), _runtimeSettings.MaxRequestLength.GetValueOrDefault());
}
//Register a custom renderer - used to process property editor dependencies