using Umbraco.Cms.Core.Models.Membership; namespace Umbraco.Cms.Core.Security; public interface IBackOfficeSecurity { /// /// Gets the current user. /// /// The current user that has been authenticated for the request. /// If authentication hasn't taken place this will be null. // TODO: This is used a lot but most of it can be refactored to not use this at all since the IUser instance isn't // needed in most cases. Where an IUser is required this could be an ext method on the ClaimsIdentity/ClaimsPrincipal that passes in // an IUserService, like HttpContext.User.GetUmbracoUser(_userService); // This one isn't as easy to remove as the others below. IUser? CurrentUser { get; } /// /// Gets the current user's id. /// /// The current user's Id that has been authenticated for the request. /// If authentication hasn't taken place this will be unsuccessful. // TODO: This should just be an extension method on ClaimsIdentity [Obsolete("Scheduled for removal in V15")] Attempt GetUserId(); /// /// Checks if the specified user as access to the app /// /// /// /// /// If authentication hasn't taken place this will be unsuccessful. // TODO: Should be part of IBackOfficeUserManager bool UserHasSectionAccess(string section, IUser user); /// /// Ensures that a back office user is logged in /// /// /// This does not force authentication, that must be done before calls to this are made. // TODO: Should be removed, this should not be necessary bool IsAuthenticated(); }