Security.RBAC 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Security.RBAC --version 1.0.0
                    
NuGet\Install-Package Security.RBAC -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Security.RBAC" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Security.RBAC" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Security.RBAC" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Security.RBAC --version 1.0.0
                    
#r "nuget: Security.RBAC, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Security.RBAC@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Security.RBAC&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Security.RBAC&version=1.0.0
                    
Install as a Cake Tool

Security.RBAC NuGet Package

Reusable RBAC (Role-Based Access Control) package for ASP.NET Core with permission-based authorization.

Features

  • Attribute-based permission checks [HasPermissions].
  • Policy provider and handler wired into ASP.NET Core's authorization system.
  • Easy integration with ASP.NET Identity.

Installation

To use Security.RBAC in your ASP.NET Core project, you can install the package via NuGet Package Manager or by using the .NET CLI:

Using NuGet Package Manager

Install-Package Security.RBAC

Using .NET CLI

dotnet add package Security.RBAC

Using PackageReference

Add the following line to your .csproj file:

<PackageReference Include="Security.RBAC" Version="1.0.0" />

Getting Started

  1. Add the necessary services in your Startup.cs or Program.cs file:
services.AddRbacAuthorization();
  1. Use the [HasPermissions] attribute on your controllers or actions to enforce permission checks:
public class UsersController : Controller
{
	[HasPermissions("Users.Create", "Users.Update")]
	public IActionResult Upsert() => Ok();
}

Using Permission Store and Manager (Optional)

If you need to manage permissions in a table:

  1. Register a custom or default permission type in Program.cs or Startup.cs:
services.AddRbac(typeof(MyCustomPermission)) // or simply use IdentityPermission
	.AddRbacPermissionStore<MyPermissionStore>()
	.AddRbacPermissionValidator<MyPermissionValidator>()
	.AddRbacPermissionManager<MyPermissionManager>();

Or use the default built-in setup:

services.AddRbac().AddDefaultRbacPermission();
  1. Implement the following interfaces based on your permission entity:
  • IPermissionStore<TPermission>
  • IPermissionValidator<TPermission>
  • PermissionManager<TPermission>

Example:

public class MyPermissionStore : IPermissionStore<IdentityPermission>
{
	// Implement your logic to fetch permissions from the database
}

Example Permission Entity:

You can use the built-in IdentityPermission or define your own:

public class MyCustomPermission : IdentityPermission
{
	// Add additional fields if needed
}

Integration with ASP.NET Identity

Security.RBAC is designed to work seamlessly with ASP.NET Identity. You can store permissions in your Identity database or a separate table and fetch them dynamically.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated