AuthMvcRoleRequirementFilter

An AuthorizationFilter that sets a ViewResult when the user is not authorized.

Namespace:
Inetdev.AspNetCore.Authorization
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Inherits from:
System.Object
Implements:
Microsoft.AspNetCore.Mvc.Filters.IAuthorizationFilter, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata

Constructors

AuthMvcRoleRequirementFilter

Initializes a new instance of AuthMvcRoleRequirementFilter.

Signature:
public Void AuthMvcRoleRequirementFilter(auth, requiredRoles, roleProvider)
Parameters
Name Type Summary
auth AuthMvcAttribute The AuthMvcAttribute that initializes this filter.
requiredRoles String[] A collection of roles required to access the controller of action.
roleProvider IRoleProvider An IRoleProvider that provides application Roles.

Properties

AuthMvc

The AuthMvcAttribute that initializes this filter.

Signature:
public AuthMvcAttribute AuthMvc { get; }

ForbiddenViewName

The name of the view to return if the user is not authorized.

Signature:
public String ForbiddenViewName { get; }

RequiredRoles

A collection of roles required to access the controller or action.

Signature:
public String[] RequiredRoles { get; set; }

RoleProvider

An IRoleProvider that provides application Roles.

Signature:
public IRoleProvider RoleProvider { get; }

Methods

OnAuthorization

Process the authorization logic.

Signature:
public Void OnAuthorization(context)
Parameters
Name Type Summary
context AuthorizationFilterContext Am AuthorizationFilterContext.