using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web.WebApi.Filters; using Umbraco.Core.Models.Identity; using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Web.Security; namespace Umbraco.Web.WebApi { /// /// Provides a base class for authorized auto-routed Umbraco API controllers. /// /// /// This controller will also append a custom header to the response if the user /// is logged in using forms authentication which indicates the seconds remaining /// before their timeout expires. /// [IsBackOffice] [UmbracoUserTimeoutFilter] [UmbracoAuthorize] [DisableBrowserCache] [UmbracoWebApiRequireHttps] [CheckIfUserTicketDataIsStale] [UnhandedExceptionLoggerConfiguration] [EnableDetailedErrors] public abstract class UmbracoAuthorizedApiController : UmbracoApiController { private BackOfficeUserManager _userManager; protected UmbracoAuthorizedApiController() { } protected UmbracoAuthorizedApiController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper) { } /// /// Gets the user manager. /// protected BackOfficeUserManager UserManager => _userManager ?? (_userManager = TryGetOwinContext().Result.GetBackOfficeUserManager()); } }