Class AuthorizeRolesAttribute
- Namespace
- adas_core.Authentication.Attributes
- Assembly
- adas-core.Authentication.dll
[AttributeUsage(AttributeTargets.Method)]
public class AuthorizeRolesAttribute : Attribute, IAuthorizationFilter, IFilterMetadata
- Inheritance
-
AuthorizeRolesAttribute
- Implements
- Inherited Members
- Extension Methods
Constructors
AuthorizeRolesAttribute(RolesType)
public AuthorizeRolesAttribute(PermissionEnum.RolesType type)
Parameters
typePermissionEnum.RolesType
Methods
OnAuthorization(AuthorizationFilterContext)
Performs authorization by ensuring the current user is authenticated and has a role matching the required permission type. Responds with an unauthorized result when no user is authenticated, bypasses role checking for the AuthSome permission type, and otherwise responds with a forbid result when no user role starts with the permission type value.
public void OnAuthorization(AuthorizationFilterContext context)
Parameters
contextAuthorizationFilterContextThe authorization filter context providing access to the HTTP context and where the authorization result is assigned.