Netcore: Introduce BackofficeSecurityAccessor (#8871)

* Introduced IWebSecurityAccessor

Signed-off-by: Bjarke Berg <mail@bergmania.dk>

* Fixed tests

Signed-off-by: Bjarke Berg <mail@bergmania.dk>

* Renamed WebSecurity to BackofficeSecurity and all related names

* Fixes typos

Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
This commit is contained in:
Bjarke Berg
2020-09-22 10:01:00 +02:00
committed by GitHub
parent 525ca95acf
commit 96facc4d35
84 changed files with 571 additions and 404 deletions

View File

@@ -10,6 +10,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Hosting;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Core.WebAssets;
using Umbraco.Extensions;
@@ -32,8 +33,8 @@ namespace Umbraco.Web.BackOffice.Controllers
private readonly UmbracoFeatures _features;
private readonly GlobalSettings _globalSettings;
private readonly IPublishedSnapshotService _publishedSnapshotService;
private readonly IWebSecurity _webSecurity;
private readonly ILocalizationService _localizationService;
private readonly IBackofficeSecurityAccessor _backofficeSecurityAccessor;
private readonly ILocalizationService _localizationService;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly ICookieManager _cookieManager;
private readonly IRuntimeMinifier _runtimeMinifier;
@@ -43,7 +44,7 @@ namespace Umbraco.Web.BackOffice.Controllers
UmbracoFeatures features,
IOptions<GlobalSettings> globalSettings,
IPublishedSnapshotService publishedSnapshotService,
IWebSecurity webSecurity,
IBackofficeSecurityAccessor backofficeSecurityAccessor,
ILocalizationService localizationService,
IHostingEnvironment hostingEnvironment,
ICookieManager cookieManager,
@@ -53,7 +54,7 @@ namespace Umbraco.Web.BackOffice.Controllers
_features = features;
_globalSettings = globalSettings.Value;
_publishedSnapshotService = publishedSnapshotService;
_webSecurity = webSecurity;
_backofficeSecurityAccessor = backofficeSecurityAccessor;
_localizationService = localizationService;
_hostingEnvironment = hostingEnvironment;
_cookieManager = cookieManager;
@@ -107,7 +108,7 @@ namespace Umbraco.Web.BackOffice.Controllers
[UmbracoAuthorize]
public ActionResult Frame(int id, string culture)
{
var user = _webSecurity.CurrentUser;
var user = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser;
var previewToken = _publishedSnapshotService.EnterPreview(user, id);