https://github.com/burakkontas/asp.net-custom-authorize-attribute
CustomAttribute PermissionAuthorizeAttribute for ASP.NET Core applications.
https://github.com/burakkontas/asp.net-custom-authorize-attribute
aspnetcore attributes custom-attributes microservices-architecture permissions security
Last synced: over 1 year ago
JSON representation
CustomAttribute PermissionAuthorizeAttribute for ASP.NET Core applications.
- Host: GitHub
- URL: https://github.com/burakkontas/asp.net-custom-authorize-attribute
- Owner: BurakKontas
- License: mit
- Created: 2024-03-30T13:51:46.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-30T13:53:55.000Z (over 2 years ago)
- Last Synced: 2025-01-30T14:40:54.730Z (over 1 year ago)
- Topics: aspnetcore, attributes, custom-attributes, microservices-architecture, permissions, security
- Language: C#
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
This repository contains a custom attribute for ASP.NET Core applications named PermissionAuthorizeAttribute. This attribute extends the AuthorizeAttribute class and provides a way to authorize actions based on permissions and permission modes.
The PermissionAuthorizeAttribute allows specifying the required permissions and the mode of permission verification for authorized actions. It can be applied to controller actions or entire controller classes.
To use this attribute, simply decorate your controller actions or classes with [PermissionAuthorize] and provide the necessary permissions. By default, the attribute accepts an array of permissions and verifies them in "Any" mode.
Example usage:
```csharp
[HttpGet]
[PermissionAuthorize(permissions: [Permissions.Read, Permissions.Write], mode: PermissionMode.All)]
public IActionResult MyAction()
{
// Action logic here
}