DotNetBrightener.Infrastructure.Security 2025.0.9-preview-487

This is a prerelease version of DotNetBrightener.Infrastructure.Security.
dotnet add package DotNetBrightener.Infrastructure.Security --version 2025.0.9-preview-487
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2025.0.9-preview-487
                    
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.9-preview-487" />
                    
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.9-preview-487" />
                    
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.9-preview-487
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2025.0.9-preview-487"
                    
#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.9-preview-487
                    
#: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.9-preview-487&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2025.0.9-preview-487&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.MultiTenancy

Package Description

DotNetBrightener.Infrastructure.ApiKeyAuthentication

Package Description

DotNetBrightener.WebApp.CommonShared

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.0.9-preview-487 29 9/29/2025
2025.0.9-preview-481 41 9/29/2025
2025.0.9-preview-473 54 9/28/2025
2025.0.8 197 9/23/2025
2025.0.6 212 9/22/2025
2025.0.6-preview-455 202 9/22/2025
2025.0.6-preview-454 304 9/17/2025
2025.0.6-preview-441 146 9/14/2025
2025.0.6-preview-440 142 9/14/2025
2025.0.6-preview-406 165 9/2/2025
2025.0.6-preview-401 165 9/2/2025
2025.0.6-preview-400 159 9/2/2025
2025.0.6-preview-369 209 8/27/2025
2025.0.6-preview-368 202 8/27/2025
2025.0.6-preview-334 191 8/18/2025
2025.0.6-preview-333 115 7/27/2025
2025.0.6-preview-332 485 7/24/2025
2025.0.6-preview-331 485 7/24/2025
2025.0.6-preview-328 483 7/24/2025
2025.0.6-preview-327 366 7/21/2025
2025.0.6-preview-326 361 7/21/2025
2025.0.6-preview-325 278 7/20/2025
2025.0.6-preview-324 270 7/20/2025
2025.0.6-preview-322 265 7/20/2025
2025.0.6-preview-321 271 7/19/2025
2025.0.6-preview-320 276 7/19/2025
2025.0.6-preview-319 181 7/17/2025
2025.0.6-preview-317 171 7/17/2025
2025.0.6-preview-316 175 7/17/2025
2025.0.6-preview-315 178 7/17/2025
2025.0.6-preview-314 176 7/17/2025
2025.0.6-preview-313 181 7/17/2025
2025.0.6-preview-312 179 7/16/2025
2025.0.5 204 7/10/2025
2025.0.5-preview-307 118 7/5/2025
2025.0.4 135 7/5/2025
2025.0.4-preview-305 127 7/4/2025
2025.0.4-preview-304 190 7/1/2025
2025.0.4-preview-299 161 5/31/2025
2025.0.4-preview-298 142 5/30/2025
2025.0.4-preview-296 175 5/30/2025
2025.0.4-preview-295 185 5/29/2025
2025.0.4-preview-293 186 5/26/2025
2025.0.4-preview-292 189 5/26/2025
2025.0.3 183 2/10/2025
2025.0.3-preview-288 152 2/10/2025
2025.0.2 188 1/21/2025
2025.0.2-preview-278 133 1/21/2025
2025.0.2-preview-277 155 12/16/2024
2025.0.1-rc-243301701 441 11/25/2024
2024.0.14.6 217 11/25/2024
2024.0.14.6-rc-243031001 242 10/29/2024
2024.0.14.6-rc-243030701 171 10/29/2024
2024.0.14.6-rc-242840501 165 10/10/2024
2024.0.14.6-rc-242820305 166 10/8/2024
2024.0.14.6-rc-242771401 293 10/3/2024
2024.0.14.6-rc-242770501 160 10/3/2024
2024.0.14.6-rc-242770201 177 10/3/2024
2024.0.14.6-rc-242761801 162 10/2/2024
2024.0.14.6-rc-242761601 175 10/2/2024
2024.0.14.6-rc-242761501 158 10/2/2024
2024.0.14.6-rc-242761401 160 10/2/2024
2024.0.14.6-rc-242760701 180 10/2/2024
2024.0.14.6-rc-242751002 167 10/1/2024
2024.0.14.6-rc-242750901 180 10/1/2024
2024.0.14.6-rc-242750502 158 10/1/2024
2024.0.14.6-rc-242750201 171 10/1/2024
2024.0.14.6-rc-242741501 162 9/30/2024
2024.0.14.6-rc-242730701 181 9/29/2024
2024.0.14.6-preview-2730501 160 9/29/2024
2024.0.14.6-preview-2701501 205 9/26/2024
2024.0.14.6-preview-2620901 211 9/18/2024
2024.0.14.6-preview-2570701 176 9/13/2024
2024.0.14.6-preview-2510703 254 9/7/2024
2024.0.14.6-preview-2480501 193 9/4/2024
2024.0.14.6-preview-2430401 219 8/30/2024
2024.0.14.6-preview-242730701 158 9/29/2024
2024.0.14.6-preview-2421703 183 8/29/2024
2024.0.14.6-preview-2421701 175 8/29/2024
2024.0.14.6-preview-2420901 166 8/29/2024
2024.0.14.6-preview-2390101 203 8/26/2024
2024.0.14.6-preview-2381603 186 8/25/2024
2024.0.14.6-preview-2341601 215 8/21/2024
2024.0.14.6-preview-2321602 194 8/20/2024
2024.0.14.6-preview-2190801 217 8/6/2024
2024.0.14.6-preview-2041501 180 7/22/2024
2024.0.14.6-preview-1920603 248 7/10/2024
2024.0.14.6-preview-1920301 175 7/10/2024
2024.0.14.6-preview-1911302 184 7/9/2024
2024.0.14.6-preview-1901001 204 7/8/2024
2024.0.14.6-preview-1900901 189 7/8/2024
2024.0.14.6-preview-1900801 169 7/8/2024
2024.0.14.6-preview-1860304 181 7/4/2024
2024.0.14.5 280 7/1/2024
2024.0.14.5-preview-1811601 186 6/29/2024
2024.0.14.5-preview-1810501 203 6/29/2024
2024.0.14.5-preview-180132 212 6/28/2024
2024.0.14.5-preview-180131 189 6/28/2024
2024.0.14.5-preview-180121 171 6/28/2024
2024.0.14.4 266 6/27/2024
2024.0.14.4-preview-7 188 6/27/2024
2024.0.14.3 240 6/21/2024
2024.0.14.1 219 6/6/2024
2024.0.14.1-preview 174 6/6/2024
2024.0.14-preview-1 156 6/6/2024
2024.0.13.8-preview 183 6/6/2024
2024.0.13.1-preview-0146 186 6/6/2024
2024.0.12.15803-preview-03 181 6/6/2024
2024.0.12.15608 216 6/4/2024
2024.0.12.15515 292 6/3/2024
2024.0.12.15220 205 5/31/2024
2024.0.12.15220-alpha31-240... 161 5/31/2024
2024.0.12.14911 254 5/28/2024
2024.0.12.14910-alpha28-240... 170 5/28/2024
2024.0.12.14823 214 5/27/2024
2024.0.12.14522-alpha7-2405... 200 5/24/2024
2024.0.12.14514-alpha6-2405... 188 5/24/2024
2024.0.12.14511 244 5/24/2024
2024.0.12.14314 273 5/22/2024
2024.0.12.14114 252 5/20/2024
2024.0.12.12815 263 5/7/2024
2024.0.12.12814 233 5/7/2024
2024.0.12.12721 245 5/6/2024
2024.0.12.12702 235 5/5/2024
2024.0.12.12622 253 5/5/2024
2024.0.12.12514 230 5/4/2024
2024.0.12.12512 242 5/4/2024
2024.0.12.12510 235 5/4/2024
2024.0.12.12420 210 5/3/2024
2024.0.12.12319 183 5/2/2024
2024.0.12.12319-rc-2405021801 147 5/2/2024
2024.0.12.12318 189 5/2/2024
2024.0.12.12215 218 5/1/2024
2024.0.12.12011 225 4/29/2024
2024.0.12.11720 227 4/26/2024
2024.0.12.11719 215 4/26/2024
2024.0.12.11621 267 4/25/2024
2024.0.12.11523 223 4/24/2024
2024.0.12.11522 222 4/24/2024
2024.0.12.11417 244 4/23/2024
2024.0.12.11400 249 4/22/2024
2024.0.12.11316 236 4/22/2024
2024.0.11.10220 223 4/11/2024
2024.0.11.10120 205 4/10/2024
2024.0.11.10119 197 4/10/2024
2024.0.11.10115 217 4/10/2024
2024.0.11.9914 233 4/8/2024
2024.0.11.9901 214 4/7/2024
2024.0.11.9823 223 4/7/2024
2024.0.11.9401 238 4/2/2024
2024.0.11.9301 224 4/1/2024
2024.0.11.9206 216 3/31/2024
2024.0.11.9205 210 3/31/2024
2024.0.11.8200 247 3/21/2024
2024.0.11.8122 207 3/21/2024
2024.0.11.8120 201 3/21/2024
2024.0.11.7320 266 3/13/2024
2024.0.11.7316 221 3/13/2024
2024.0.11.7310 224 3/13/2024
2024.0.11 229 3/13/2024
2024.0.10 251 3/3/2024
2024.0.9 235 2/27/2024
2024.0.8 266 2/1/2024
2024.0.7 217 1/26/2024
2024.0.6 216 1/25/2024
2024.0.5 215 1/24/2024
2024.0.4 208 1/24/2024
2024.0.3 221 1/22/2024
2024.0.2 285 1/10/2024
2024.0.1 234 1/9/2024
2024.0.1-alpha-3 192 1/9/2024
2024.0.1-alpha-2 185 1/9/2024
2024.0.1-alpha-1 215 1/3/2024
2024.0.0 270 12/26/2023
2023.0.27 280 12/21/2023
2023.0.26 257 12/21/2023
2023.0.25 278 12/11/2023
2023.0.24 263 12/8/2023
2023.0.23 222 12/6/2023
2023.0.21 317 12/4/2023
2023.0.20 283 11/27/2023
2023.0.19 240 11/20/2023
2023.0.18 262 10/25/2023
2023.0.17 304 10/22/2023
2023.0.16 334 10/16/2023
2023.0.16-alpha-1 193 10/16/2023
2023.0.15 244 10/14/2023
2023.0.14 219 10/14/2023
2023.0.13 228 10/14/2023
2023.0.12 238 10/14/2023
2023.0.11 226 10/10/2023
2023.0.10 234 10/9/2023
2023.0.9 358 8/16/2023
2023.0.8 331 8/15/2023
2023.0.8-alpha-2 376 5/31/2023
2023.0.7 709 5/12/2023
2023.0.6 491 5/10/2023
2023.0.5 321 5/7/2023
2023.0.4 356 4/22/2023
2023.0.3 399 4/19/2023
2023.0.2 393 4/6/2023
2023.0.1 363 3/13/2023
2022.10.4 437 11/9/2022
2022.10.3 497 10/19/2022
2022.10.2 612 10/19/2022
2022.10.0 600 10/16/2022
2022.7.1 638 7/18/2022

Basic infrastructure provided for authorizing User with given permission