DotNetBrightener.Infrastructure.Security 2025.0.4-preview-304

This is a prerelease version of DotNetBrightener.Infrastructure.Security.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.Infrastructure.Security --version 2025.0.4-preview-304
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2025.0.4-preview-304
                    
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="DotNetBrightener.Infrastructure.Security" Version="2025.0.4-preview-304" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetBrightener.Infrastructure.Security" Version="2025.0.4-preview-304" />
                    
Directory.Packages.props
<PackageReference Include="DotNetBrightener.Infrastructure.Security" />
                    
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 DotNetBrightener.Infrastructure.Security --version 2025.0.4-preview-304
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2025.0.4-preview-304"
                    
#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 DotNetBrightener.Infrastructure.Security@2025.0.4-preview-304
                    
#: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=DotNetBrightener.Infrastructure.Security&version=2025.0.4-preview-304&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2025.0.4-preview-304&prerelease
                    
Install as a Cake Tool

Security Infratructure Library

© DotNet Brightener

Installation

Run this in command line:

dotnet add package DotNetBrightener.Infrastructure.Security

Or add the following to .csproj file

<PackageReference Include="DotNetBrightener.Infrastructure.Security" Version="2022.10.0" />

You should check the latest version from Nuget Site

Adding Permission System

  1. Register the Permission System to IServiceCollection
serviceCollection.AddPermissionAuthorization();
  1. Calling the following before application starts.
var app = builder.Build();

// call this before app.Run()
app.LoadAndValidatePermissions();

app.Run();

If you use legacy Startup.cs file then the app.LoadAndValidatePermissions() should be called in Configure() method

Authorization Extensions

  1. Authorize with IAuthorizationService
var authorizationResult = await IAuthorizationService.AuthorizePermissionAsync(user, permissionKey);
  1. Authorize with [PermissionAuthorize] attribute

public class SomeController: Controller 
{
    [PermissionAuthorize("<your_permission_key>")]
    public async Task<IActionResult> SomeAction() 
    {
        // your action implementation
    }   
}

Automatically Register Permissions

Given the following class for defining permissions


public class SomePermissionsList: AutomaticPermissionProvider
{
    /// <summary>
    ///     Description for Permission 1
    /// </summary>
    public const string Permission1 = "ThisIsKey.OfThePermission";

    /// <summary>
    ///     Description for Permission 2
    /// </summary>
    public const string Permission2 = "Permission.Permission2";
}

You can register the permissions defined in this class into service collection by doing the following:

// with SomePermissionsList is the type of permission provider
serviceCollection.RegisterPermissionProvider<SomePermissionsList>();

The app.LoadAndValidatePermissions() call above should automatically register the permissions you defined in the class provided

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 (4)

Showing the top 4 NuGet packages that depend on DotNetBrightener.Infrastructure.Security:

Package Downloads
DotNetBrightener.Infrastructure.JwtAuthentication

Package Description

DotNetBrightener.WebApp.CommonShared

Package Description

DotNetBrightener.Infrastructure.ApiKeyAuthentication

Package Description

DotNetBrightener.MultiTenancy

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.0.10-preview-559 38 10/29/2025
2025.0.10-preview-557 54 10/27/2025
2025.0.9 62 10/26/2025
2025.0.9-preview-553 53 10/26/2025
2025.0.9-preview-539 174 10/12/2025
2025.0.9-preview-535 233 10/8/2025
2025.0.9-preview-509 247 10/2/2025
2025.0.9-preview-508 236 10/2/2025
2025.0.9-preview-487 250 9/29/2025
2025.0.9-preview-481 238 9/29/2025
2025.0.9-preview-473 214 9/28/2025
2025.0.8 259 9/23/2025
2025.0.6 264 9/22/2025
2025.0.6-preview-455 242 9/22/2025
2025.0.6-preview-454 343 9/17/2025
2025.0.6-preview-441 182 9/14/2025
2025.0.6-preview-440 181 9/14/2025
2025.0.6-preview-406 209 9/2/2025
2025.0.6-preview-401 212 9/2/2025
2025.0.6-preview-400 202 9/2/2025
2025.0.6-preview-369 256 8/27/2025
2025.0.6-preview-368 242 8/27/2025
2025.0.6-preview-334 227 8/18/2025
2025.0.6-preview-333 145 7/27/2025
2025.0.6-preview-332 516 7/24/2025
2025.0.6-preview-331 526 7/24/2025
2025.0.6-preview-328 522 7/24/2025
2025.0.6-preview-327 398 7/21/2025
2025.0.6-preview-326 390 7/21/2025
2025.0.6-preview-325 317 7/20/2025
2025.0.6-preview-324 304 7/20/2025
2025.0.6-preview-322 309 7/20/2025
2025.0.6-preview-321 315 7/19/2025
2025.0.6-preview-320 319 7/19/2025
2025.0.6-preview-319 207 7/17/2025
2025.0.6-preview-317 217 7/17/2025
2025.0.6-preview-316 206 7/17/2025
2025.0.6-preview-315 221 7/17/2025
2025.0.6-preview-314 213 7/17/2025
2025.0.6-preview-313 202 7/17/2025
2025.0.6-preview-312 220 7/16/2025
2025.0.5 247 7/10/2025
2025.0.5-preview-307 146 7/5/2025
2025.0.4 177 7/5/2025
2025.0.4-preview-305 167 7/4/2025
2025.0.4-preview-304 243 7/1/2025
2025.0.4-preview-299 209 5/31/2025
2025.0.4-preview-298 183 5/30/2025
2025.0.4-preview-296 213 5/30/2025
2025.0.4-preview-295 222 5/29/2025
2025.0.4-preview-293 221 5/26/2025
2025.0.4-preview-292 228 5/26/2025
2025.0.3 224 2/10/2025
2025.0.3-preview-288 194 2/10/2025
2025.0.2 220 1/21/2025
2025.0.2-preview-278 181 1/21/2025
2025.0.2-preview-277 198 12/16/2024
2025.0.1-rc-243301701 480 11/25/2024
2024.0.14.6 262 11/25/2024
2024.0.14.6-rc-243031001 283 10/29/2024
2024.0.14.6-rc-243030701 203 10/29/2024
2024.0.14.6-rc-242840501 204 10/10/2024
2024.0.14.6-rc-242820305 203 10/8/2024
2024.0.14.6-rc-242771401 340 10/3/2024
2024.0.14.6-rc-242770501 204 10/3/2024
2024.0.14.6-rc-242770201 221 10/3/2024
2024.0.14.6-rc-242761801 206 10/2/2024
2024.0.14.6-rc-242761601 220 10/2/2024
2024.0.14.6-rc-242761501 201 10/2/2024
2024.0.14.6-rc-242761401 208 10/2/2024
2024.0.14.6-rc-242760701 229 10/2/2024
2024.0.14.6-rc-242751002 210 10/1/2024
2024.0.14.6-rc-242750901 221 10/1/2024
2024.0.14.6-rc-242750502 208 10/1/2024
2024.0.14.6-rc-242750201 223 10/1/2024
2024.0.14.6-rc-242741501 192 9/30/2024
2024.0.14.6-rc-242730701 225 9/29/2024
2024.0.14.6-preview-2730501 206 9/29/2024
2024.0.14.6-preview-2701501 249 9/26/2024
2024.0.14.6-preview-2620901 260 9/18/2024
2024.0.14.6-preview-2570701 215 9/13/2024
2024.0.14.6-preview-2510703 304 9/7/2024
2024.0.14.6-preview-2480501 236 9/4/2024
2024.0.14.6-preview-2430401 262 8/30/2024
2024.0.14.6-preview-242730701 200 9/29/2024
2024.0.14.6-preview-2421703 226 8/29/2024
2024.0.14.6-preview-2421701 213 8/29/2024
2024.0.14.6-preview-2420901 203 8/29/2024
2024.0.14.6-preview-2390101 253 8/26/2024
2024.0.14.6-preview-2381603 228 8/25/2024
2024.0.14.6-preview-2341601 264 8/21/2024
2024.0.14.6-preview-2321602 244 8/20/2024
2024.0.14.6-preview-2190801 270 8/6/2024
2024.0.14.6-preview-2041501 228 7/22/2024
2024.0.14.6-preview-1920603 291 7/10/2024
2024.0.14.6-preview-1920301 213 7/10/2024
2024.0.14.6-preview-1911302 235 7/9/2024
2024.0.14.6-preview-1901001 243 7/8/2024
2024.0.14.6-preview-1900901 241 7/8/2024
2024.0.14.6-preview-1900801 207 7/8/2024
2024.0.14.6-preview-1860304 217 7/4/2024
2024.0.14.5 326 7/1/2024
2024.0.14.5-preview-1811601 228 6/29/2024
2024.0.14.5-preview-1810501 258 6/29/2024
2024.0.14.5-preview-180132 237 6/28/2024
2024.0.14.5-preview-180131 236 6/28/2024
2024.0.14.5-preview-180121 219 6/28/2024
2024.0.14.4 335 6/27/2024
2024.0.14.4-preview-7 248 6/27/2024
2024.0.14.3 287 6/21/2024
2024.0.14.1 266 6/6/2024
2024.0.14.1-preview 218 6/6/2024
2024.0.14-preview-1 199 6/6/2024
2024.0.13.8-preview 227 6/6/2024
2024.0.13.1-preview-0146 234 6/6/2024
2024.0.12.15803-preview-03 226 6/6/2024
2024.0.12.15608 256 6/4/2024
2024.0.12.15515 340 6/3/2024
2024.0.12.15220 258 5/31/2024
2024.0.12.15220-alpha31-240... 198 5/31/2024
2024.0.12.14911 299 5/28/2024
2024.0.12.14910-alpha28-240... 216 5/28/2024
2024.0.12.14823 262 5/27/2024
2024.0.12.14522-alpha7-2405... 242 5/24/2024
2024.0.12.14514-alpha6-2405... 223 5/24/2024
2024.0.12.14511 301 5/24/2024
2024.0.12.14314 311 5/22/2024
2024.0.12.14114 290 5/20/2024
2024.0.12.12815 314 5/7/2024
2024.0.12.12814 281 5/7/2024
2024.0.12.12721 289 5/6/2024
2024.0.12.12702 276 5/5/2024
2024.0.12.12622 284 5/5/2024
2024.0.12.12514 255 5/4/2024
2024.0.12.12512 289 5/4/2024
2024.0.12.12510 287 5/4/2024
2024.0.12.12420 252 5/3/2024
2024.0.12.12319 228 5/2/2024
2024.0.12.12319-rc-2405021801 202 5/2/2024
2024.0.12.12318 239 5/2/2024
2024.0.12.12215 267 5/1/2024
2024.0.12.12011 270 4/29/2024
2024.0.12.11720 273 4/26/2024
2024.0.12.11719 252 4/26/2024
2024.0.12.11621 308 4/25/2024
2024.0.12.11523 277 4/24/2024
2024.0.12.11522 260 4/24/2024
2024.0.12.11417 289 4/23/2024
2024.0.12.11400 285 4/22/2024
2024.0.12.11316 281 4/22/2024
2024.0.11.10220 261 4/11/2024
2024.0.11.10120 235 4/10/2024
2024.0.11.10119 235 4/10/2024
2024.0.11.10115 251 4/10/2024
2024.0.11.9914 273 4/8/2024
2024.0.11.9901 244 4/7/2024
2024.0.11.9823 266 4/7/2024
2024.0.11.9401 271 4/2/2024
2024.0.11.9301 261 4/1/2024
2024.0.11.9206 246 3/31/2024
2024.0.11.9205 246 3/31/2024
2024.0.11.8200 273 3/21/2024
2024.0.11.8122 251 3/21/2024
2024.0.11.8120 245 3/21/2024
2024.0.11.7320 305 3/13/2024
2024.0.11.7316 261 3/13/2024
2024.0.11.7310 260 3/13/2024
2024.0.11 262 3/13/2024
2024.0.10 290 3/3/2024
2024.0.9 264 2/27/2024
2024.0.8 309 2/1/2024
2024.0.7 256 1/26/2024
2024.0.6 256 1/25/2024
2024.0.5 232 1/24/2024
2024.0.4 248 1/24/2024
2024.0.3 258 1/22/2024
2024.0.2 320 1/10/2024
2024.0.1 275 1/9/2024
2024.0.1-alpha-3 215 1/9/2024
2024.0.1-alpha-2 210 1/9/2024
2024.0.1-alpha-1 250 1/3/2024
2024.0.0 307 12/26/2023
2023.0.27 328 12/21/2023
2023.0.26 297 12/21/2023
2023.0.25 318 12/11/2023
2023.0.24 307 12/8/2023
2023.0.23 247 12/6/2023
2023.0.21 353 12/4/2023
2023.0.20 309 11/27/2023
2023.0.19 273 11/20/2023
2023.0.18 300 10/25/2023
2023.0.17 337 10/22/2023
2023.0.16 375 10/16/2023
2023.0.16-alpha-1 232 10/16/2023
2023.0.15 282 10/14/2023
2023.0.14 263 10/14/2023
2023.0.13 255 10/14/2023
2023.0.12 271 10/14/2023
2023.0.11 264 10/10/2023
2023.0.10 273 10/9/2023
2023.0.9 394 8/16/2023
2023.0.8 371 8/15/2023
2023.0.8-alpha-2 420 5/31/2023
2023.0.7 758 5/12/2023
2023.0.6 546 5/10/2023
2023.0.5 364 5/7/2023
2023.0.4 399 4/22/2023
2023.0.3 442 4/19/2023
2023.0.2 436 4/6/2023
2023.0.1 398 3/13/2023
2022.10.4 457 11/9/2022
2022.10.3 528 10/19/2022
2022.10.2 652 10/19/2022
2022.10.0 630 10/16/2022
2022.7.1 681 7/18/2022

Basic infrastructure provided for authorizing User with given permission