GrayMint.Authorization.RoleManagement.ResourceProviders
3.1.151
See the version list below for details.
dotnet add package GrayMint.Authorization.RoleManagement.ResourceProviders --version 3.1.151
NuGet\Install-Package GrayMint.Authorization.RoleManagement.ResourceProviders -Version 3.1.151
<PackageReference Include="GrayMint.Authorization.RoleManagement.ResourceProviders" Version="3.1.151" />
<PackageVersion Include="GrayMint.Authorization.RoleManagement.ResourceProviders" Version="3.1.151" />
<PackageReference Include="GrayMint.Authorization.RoleManagement.ResourceProviders" />
paket add GrayMint.Authorization.RoleManagement.ResourceProviders --version 3.1.151
#r "nuget: GrayMint.Authorization.RoleManagement.ResourceProviders, 3.1.151"
#:package GrayMint.Authorization.RoleManagement.ResourceProviders@3.1.151
#addin nuget:?package=GrayMint.Authorization.RoleManagement.ResourceProviders&version=3.1.151
#tool nuget:?package=GrayMint.Authorization.RoleManagement.ResourceProviders&version=3.1.151
GrayMint.Authorization
Modular B2B Authorization Framework for .NET Applications
GrayMint.Authorization provides a flexible, multi-tenant-compatible B2B authorization framework for .NET apps. It enables role-based and resource-based access control, ideal for enterprise platforms, SaaS systems, and microservices.
๐ง Features
- Role-based and resource-based authorization
- Multi-tenant (B2B) ready
- Modular service registration and layering
- Microservice-compatible with extensible providers
- EF Core-based persistence support
- Built-in controllers and services for quick bootstrap
๐ฆ Installation
Install the packages from nuget.org:
dotnet add package GrayMint.Authorization
๐ Getting Started
1. Configure App Settings
Issuer: The issuer of the tokens.Audience: The audience of the tokens.Secret: The secret key for token generation.Secrets: List of additional secret keys.CacheTimeout: The cache timeout duration.AllowUserSelfRegister: Boolean flag to allow or disallow user self-registration.AllowUserApiKey: Boolean flag to allow or disallow user API keys.AllowRefreshToken: Boolean flag to allow or disallow refresh tokens.SignInRedirectUrl: The URL to redirect to after sign-in.OpenIdProviders: List of OpenID providers with their respective configurations.
2. Service Registration (from Sample Web API)
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
// Load options
var appOptions = builder.Configuration.GetSection("App").Get<AppOptions>();
services.Configure<AppOptions>(builder.Configuration.GetSection("App"));
// Register shared services and Swagger
services
.AddGrayMintCommonServices();
// Register Authorization and Roles
builder.AddGrayMintCommonAuthorizationForApp(
GmRole.GetAll(typeof(Roles)),
options => options.UseSqlServer(builder.Configuration.GetConnectionString("AppDatabase")));
// Optional: Register Resource Provider
if (appOptions.UseResourceProvider)
services.AddGrayMintResourceProvider(
new ResourceProviderOptions(),
options => options.UseSqlServer(builder.Configuration.GetConnectionString("AppDatabase")));
// Add EF Core & domain services
services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("AppDatabase")));
services.AddItemServices();
3. Middleware & Execution
var webApp = builder.Build();
webApp.UseGrayMintCommonServices();
await webApp.UseGrayMinCommonAuthorizationForApp();
await webApp.Services.UseGrayMintDatabaseCommand<AppDbContext>(args);
if (appOptions.UseResourceProvider)
await webApp.Services.UseGrayMintResourceProvider();
await GrayMintApp.RunAsync(webApp, args);
๐งช Permission Check Example
[HttpGet("itemId/by-role")]
[Authorize("DefaultPolicy", Roles = ["SystemAdmin", "SystemReader"])
public Task<Item> GetByRole(int appId, int itemId)
{
return itemService.Get(appId, itemId);
}
[HttpPost("by-permission")]
[AuthorizeAppIdPermission(Permissions.AppWrite)]
public Task<Item> CreateByPermission(int appId, ItemCreateRequest? createRequest = null)
{
return itemService.Create(appId, createRequest);
}
๐งฉ Extending
Implement custom providers:
IRoleProviderIUserProviderIResourceProvider
These interfaces allow full control over how roles, users, and resources are managed.
๐ Repo layout & CI
src/โ the packable libraries; one shared version and package metadata viasrc/Directory.Build.props.pub/PubVersion.jsonis the version source of truth.tests/โ test suites and sample hosts. Never packed..github/workflows/โ thin wrappers over the reusable CI in GrayMint.Common: every push tomainbuilds, tests, bumps the version, and publishes to nuget.org; a daily job (02:30 UTC, right after GrayMint.Common's own update) upgrades all NuGet dependencies and republishes when tests pass. Nothing ships when tests fail.
Build locally:
dotnet build GrayMint.Authorization.slnx
dotnet test GrayMint.Authorization.slnx
๐ License
Licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- GrayMint.Authorization.Abstractions (>= 3.1.151)
- GrayMint.Authorization.RoleManagement.Abstractions (>= 3.1.151)
- GrayMint.Common.EntityFrameworkCore (>= 2.1.254)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GrayMint.Authorization.RoleManagement.ResourceProviders:
| Package | Downloads |
|---|---|
|
GrayMint.Authorization
Reference all GrayMint authorization. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.157 | 27 | 7/21/2026 |
| 3.2.156 | 51 | 7/18/2026 |
| 3.2.155 | 56 | 7/18/2026 |
| 3.2.154 | 51 | 7/18/2026 |
| 3.1.151 | 64 | 7/17/2026 |
| 3.1.150 | 111 | 7/7/2026 |
| 3.1.149 | 175 | 6/23/2026 |
| 3.1.148 | 344 | 5/7/2026 |
| 3.1.147 | 122 | 5/7/2026 |
| 3.1.146 | 121 | 5/7/2026 |
| 3.1.145 | 740 | 2/3/2026 |
| 3.1.144 | 144 | 2/3/2026 |
| 3.1.143 | 277 | 12/13/2025 |
| 3.1.142 | 202 | 11/16/2025 |
| 3.1.141 | 231 | 11/15/2025 |
| 3.0.140 | 256 | 11/3/2025 |
| 3.0.139 | 269 | 11/3/2025 |
| 3.0.138 | 260 | 11/3/2025 |
| 3.0.137 | 264 | 11/3/2025 |
| 3.0.136 | 263 | 11/2/2025 |