diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSecurityStampValidator.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSecurityStampValidator.cs index 577dc8ce08..755367312f 100644 --- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSecurityStampValidator.cs +++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSecurityStampValidator.cs @@ -13,8 +13,8 @@ public class BackOfficeSecurityStampValidator : SecurityStampValidator options, - BackOfficeSignInManager signInManager, ISystemClock clock, ILoggerFactory logger) - : base(options, signInManager, clock, logger) + BackOfficeSignInManager signInManager, ILoggerFactory logger) + : base(options, signInManager, logger) { } } diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs index f0cb1beee5..5078b20d4a 100644 --- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs +++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs @@ -35,15 +35,15 @@ public class BackOfficeSessionIdValidator { public const string CookieName = "UMB_UCONTEXT_C"; private readonly GlobalSettings _globalSettings; - private readonly ISystemClock _systemClock; + private readonly TimeProvider _timeProvider; private readonly IBackOfficeUserManager _userManager; /// /// Initializes a new instance of the class. /// - public BackOfficeSessionIdValidator(ISystemClock systemClock, IOptionsSnapshot globalSettings, IBackOfficeUserManager userManager) + public BackOfficeSessionIdValidator(TimeProvider timeProvider, IOptionsSnapshot globalSettings, IBackOfficeUserManager userManager) { - _systemClock = systemClock; + _timeProvider = timeProvider; _globalSettings = globalSettings.Value; _userManager = userManager; } @@ -55,7 +55,7 @@ public class BackOfficeSessionIdValidator return; } - var valid = await ValidateSessionAsync(validateInterval, context.HttpContext, context.Options.CookieManager, _systemClock, context.Properties.IssuedUtc, context.Principal?.Identity as ClaimsIdentity); + var valid = await ValidateSessionAsync(validateInterval, context.HttpContext, context.Options.CookieManager, _timeProvider, context.Properties.IssuedUtc, context.Principal?.Identity as ClaimsIdentity); if (valid == false) { @@ -68,7 +68,7 @@ public class BackOfficeSessionIdValidator TimeSpan validateInterval, HttpContext httpContext, ICookieManager cookieManager, - ISystemClock systemClock, + TimeProvider timeProvider, DateTimeOffset? authTicketIssueDate, ClaimsIdentity? currentIdentity) { @@ -82,9 +82,9 @@ public class BackOfficeSessionIdValidator throw new ArgumentNullException(nameof(cookieManager)); } - if (systemClock == null) + if (timeProvider == null) { - throw new ArgumentNullException(nameof(systemClock)); + throw new ArgumentNullException(nameof(timeProvider)); } if (currentIdentity == null) @@ -93,7 +93,7 @@ public class BackOfficeSessionIdValidator } DateTimeOffset? issuedUtc = null; - DateTimeOffset currentUtc = systemClock.UtcNow; + DateTimeOffset currentUtc = timeProvider.GetUtcNow(); // read the last checked time from a custom cookie var lastCheckedCookie = cookieManager.GetRequestCookie(httpContext, CookieName); diff --git a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs index ae2312c67e..fea4d3b4a1 100644 --- a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs +++ b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeCookieOptions.cs @@ -31,7 +31,7 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptionsThe /// The /// The - /// The + /// The /// The /// The public ConfigureBackOfficeCookieOptions( @@ -61,7 +61,7 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions @@ -296,7 +296,7 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions options, - MemberSignInManager signInManager, ISystemClock clock, ILoggerFactory logger) - : base(options, signInManager, clock, logger) + MemberSignInManager signInManager, ILoggerFactory logger) + : base(options, signInManager, logger) { } diff --git a/tests/Umbraco.Tests.Integration/TestServerTest/TestAuthHandler.cs b/tests/Umbraco.Tests.Integration/TestServerTest/TestAuthHandler.cs index 5592d7eded..dd8bb3608a 100644 --- a/tests/Umbraco.Tests.Integration/TestServerTest/TestAuthHandler.cs +++ b/tests/Umbraco.Tests.Integration/TestServerTest/TestAuthHandler.cs @@ -27,11 +27,10 @@ public class TestAuthHandler : AuthenticationHandler options, ILoggerFactory logger, UrlEncoder encoder, - ISystemClock clock, IBackOfficeSignInManager backOfficeSignInManager, IUserService userService, IUmbracoMapper umbracoMapper) - : base(options, logger, encoder, clock) + : base(options, logger, encoder) { _backOfficeSignInManager = backOfficeSignInManager;