Skip to main content

SuperAdmin.Rbac for ASP.NET Core

SuperAdmin.Rbac adds role-based authentication, URL-based permissions and a role-aware sidebar menu to an ASP.NET Core app. You manage everything at runtime from a built-in admin panel: users, roles, permissions, URL rules and the menu. You do not need a code change or a redeploy to change who can do what.

Supported: .NET 10 (LTS) · MVC, Razor Pages, Minimal APIs, Blazor Server · SQL Server, PostgreSQL, MySQL, Oracle, SQLite

dotnet add package SuperAdmin.Rbac

Dashboard of a super administrator

It is a port of the auth, role, permission and menu system of the Laravel Super Admin package. It keeps the same look and the same URLs (/admin/auth/users, /admin/auth/roles, ...) and fixes the weaknesses of the original. See Coming from Laravel.

Features​

FeatureDetails
LoginCookie scheme SuperAdmin, remember me, per-user lockout, per-IP rate limit, forced password change, POST-only logout
URL permissionsEvery request under /admin (or the whole app) is checked against permission URL rules (GET,POST /admin/posts/{id}/edit)
RolesAssign permissions to roles, roles to users, plus direct user permissions. Super-admin roles bypass checks
MenuDatabase menu tree. Each user sees only items whose URL they may open (plus optional role and permission restrictions)
Admin panelUsers, user access view, roles, permissions, URL tester, menu editor, route discovery, operation log
Code API[HasPermission], [AllowRoles], [DenyRoles], [SkipUrlPermission], [HasUrlPermission], Minimal API helpers, ICurrentAdmin, <sa-can> tag helper
Blazor ServerAddSuperAdminBlazor(): revalidating auth state, URL checks on in-circuit navigation, <SaCan>, <SuperAdminMenu /> and the panel shell (SuperAdminLayout, <SuperAdminHead />, <SuperAdminScripts />)
Audit and hooksOperation log of write requests with secret redaction and retention, ISuperAdminEvents, custom IOperationLogSink
DatabaseAny EF Core relational provider, configurable table prefix and schema, create/migrate/script modes, install and upgrade SQL scripts

Where to start​

You want to...Read
Add the package to an appInstallation, then Quick start
Understand how a request is allowed or deniedHow access works
Give a role access to your own pages without codeProtect your pages
Use the admin panel day to dayAdmin panel guide
Check permissions in controllers, views or servicesAttributes and Minimal APIs, Razor, ICurrentAdmin and menu
Use it in Blazor ServerBlazor Server
Pick a database or ship SQL scriptsDatabases, Migrations and SQL scripts
Change the lookCustomize the UI, Theme and colours
Go to productionSecurity