SaaS CMS has officially launched! Learn more now.

Class AuthorizeContentAttribute

When added to an MVC controller this action filter checks authorization for a previously routed node available through the request context.

Inheritance
System.Object
AuthorizeContentAttribute
Implements
Microsoft.AspNetCore.Mvc.Filters.IAuthorizationFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
Namespace: EPiServer.Web.Mvc
Assembly: EPiServer.Cms.AspNetCore.Mvc.dll
Version: 12.0.3
Syntax
public class AuthorizeContentAttribute : ActionFilterAttribute, IAuthorizationFilter, IFilterMetadata
Remarks

Authorization is part of routing to content, this attribute is only for controllers when the default routing is not being used and authorization have to be applied on the controller.

Constructors

AuthorizeContentAttribute()

Creates a AuthorizeContentAttribute attribute.

Declaration
public AuthorizeContentAttribute()

Properties

DisableAccessCheck

Gets or sets a value indicating whether [disable access check] for an action.

Declaration
public bool DisableAccessCheck { get; set; }
Property Value
Type Description
System.Boolean

RequiredLevel

The required access level to execute this controller or action.

Declaration
public AccessLevel RequiredLevel { get; set; }
Property Value
Type Description
AccessLevel

Methods

OnActionExecuting(ActionExecutingContext)

Called by the ASP.NET MVC framework before the action method executes.

Declaration
public override void OnActionExecuting(ActionExecutingContext context)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext context

The filter context.

OnAuthorization(AuthorizationFilterContext)

Authorizes the request and sets the result to Microsoft.AspNetCore.Mvc.UnauthorizedResult if the user doesn't have the required access level.

Declaration
public void OnAuthorization(AuthorizationFilterContext context)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext context

The filter context to set results to.

Implements

Microsoft.AspNetCore.Mvc.Filters.IAuthorizationFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata

Extension Methods