From 9d91e629c6cfb069e8f74be22a5d34101bf76b19 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 15 Sep 2020 10:13:05 +0200 Subject: [PATCH] Bugfix in CheckIfUserTicketDataIsStaleAttribute --- .../Controllers/UmbracoAuthorizedApiController.cs | 2 +- .../Filters/CheckIfUserTicketDataIsStaleAttribute.cs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Controllers/UmbracoAuthorizedApiController.cs b/src/Umbraco.Web.BackOffice/Controllers/UmbracoAuthorizedApiController.cs index c3e1a71b86..85c92d1139 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/UmbracoAuthorizedApiController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/UmbracoAuthorizedApiController.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.BackOffice.Controllers [UmbracoAuthorize] [DisableBrowserCache] [UmbracoWebApiRequireHttps] - //[CheckIfUserTicketDataIsStale] //TODO reintroduce + [CheckIfUserTicketDataIsStale] //[UnhandedExceptionLoggerConfiguration] //TODO reintroduce //[EnableDetailedErrors] //TODO reintroduce public abstract class UmbracoAuthorizedApiController : UmbracoApiController diff --git a/src/Umbraco.Web.BackOffice/Filters/CheckIfUserTicketDataIsStaleAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/CheckIfUserTicketDataIsStaleAttribute.cs index c3bc1a56db..fd82b498bb 100644 --- a/src/Umbraco.Web.BackOffice/Filters/CheckIfUserTicketDataIsStaleAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/CheckIfUserTicketDataIsStaleAttribute.cs @@ -67,7 +67,7 @@ namespace Umbraco.Web.BackOffice.Filters await CheckStaleData(actionContext); //we need new tokens and append the custom header if changes have been made - if (!(_requestCache.Get(nameof(CheckIfUserTicketDataIsStaleFilter)) is null)) + if (_requestCache.Get(nameof(CheckIfUserTicketDataIsStaleFilter)) is null) return; var tokenFilter = @@ -83,10 +83,7 @@ namespace Umbraco.Web.BackOffice.Filters private async Task CheckStaleData(ActionExecutingContext actionContext) { - if (actionContext == null - || actionContext.HttpContext.Request == null - || actionContext.HttpContext.User == null - || actionContext.HttpContext.User.Identity == null) + if (actionContext?.HttpContext.Request == null || actionContext.HttpContext.User?.Identity == null) { return; }