DotNetBrightener.Infrastructure.Security 2025.0.6-preview-324

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.6-preview-324
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2025.0.6-preview-324
                    
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.6-preview-324" />
                    
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.6-preview-324" />
                    
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.6-preview-324
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2025.0.6-preview-324"
                    
#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.6-preview-324
                    
#: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.6-preview-324&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2025.0.6-preview-324&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.WebApp.CommonShared

Package Description

DotNetBrightener.Infrastructure.ApiKeyAuthentication

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.0.9-preview-509 128 10/2/2025
2025.0.9-preview-508 121 10/2/2025
2025.0.9-preview-487 213 9/29/2025
2025.0.9-preview-481 211 9/29/2025
2025.0.9-preview-473 193 9/28/2025
2025.0.8 231 9/23/2025
2025.0.6 229 9/22/2025
2025.0.6-preview-455 215 9/22/2025
2025.0.6-preview-454 322 9/17/2025
2025.0.6-preview-441 166 9/14/2025
2025.0.6-preview-440 159 9/14/2025
2025.0.6-preview-406 185 9/2/2025
2025.0.6-preview-401 185 9/2/2025
2025.0.6-preview-400 176 9/2/2025
2025.0.6-preview-369 229 8/27/2025
2025.0.6-preview-368 216 8/27/2025
2025.0.6-preview-334 206 8/18/2025
2025.0.6-preview-333 134 7/27/2025
2025.0.6-preview-332 502 7/24/2025
2025.0.6-preview-331 501 7/24/2025
2025.0.6-preview-328 496 7/24/2025
2025.0.6-preview-327 385 7/21/2025
2025.0.6-preview-326 364 7/21/2025
2025.0.6-preview-325 291 7/20/2025
2025.0.6-preview-324 283 7/20/2025
2025.0.6-preview-322 281 7/20/2025
2025.0.6-preview-321 289 7/19/2025
2025.0.6-preview-320 292 7/19/2025
2025.0.6-preview-319 197 7/17/2025
2025.0.6-preview-317 190 7/17/2025
2025.0.6-preview-316 193 7/17/2025
2025.0.6-preview-315 197 7/17/2025
2025.0.6-preview-314 192 7/17/2025
2025.0.6-preview-313 187 7/17/2025
2025.0.6-preview-312 195 7/16/2025
2025.0.5 220 7/10/2025
2025.0.5-preview-307 137 7/5/2025
2025.0.4 156 7/5/2025
2025.0.4-preview-305 145 7/4/2025
2025.0.4-preview-304 206 7/1/2025
2025.0.4-preview-299 184 5/31/2025
2025.0.4-preview-298 155 5/30/2025
2025.0.4-preview-296 191 5/30/2025
2025.0.4-preview-295 198 5/29/2025
2025.0.4-preview-293 199 5/26/2025
2025.0.4-preview-292 207 5/26/2025
2025.0.3 197 2/10/2025
2025.0.3-preview-288 170 2/10/2025
2025.0.2 207 1/21/2025
2025.0.2-preview-278 146 1/21/2025
2025.0.2-preview-277 174 12/16/2024
2025.0.1-rc-243301701 455 11/25/2024
2024.0.14.6 234 11/25/2024
2024.0.14.6-rc-243031001 256 10/29/2024
2024.0.14.6-rc-243030701 178 10/29/2024
2024.0.14.6-rc-242840501 177 10/10/2024
2024.0.14.6-rc-242820305 175 10/8/2024
2024.0.14.6-rc-242771401 317 10/3/2024
2024.0.14.6-rc-242770501 177 10/3/2024
2024.0.14.6-rc-242770201 194 10/3/2024
2024.0.14.6-rc-242761801 180 10/2/2024
2024.0.14.6-rc-242761601 192 10/2/2024
2024.0.14.6-rc-242761501 172 10/2/2024
2024.0.14.6-rc-242761401 184 10/2/2024
2024.0.14.6-rc-242760701 198 10/2/2024
2024.0.14.6-rc-242751002 181 10/1/2024
2024.0.14.6-rc-242750901 194 10/1/2024
2024.0.14.6-rc-242750502 178 10/1/2024
2024.0.14.6-rc-242750201 194 10/1/2024
2024.0.14.6-rc-242741501 176 9/30/2024
2024.0.14.6-rc-242730701 195 9/29/2024
2024.0.14.6-preview-2730501 182 9/29/2024
2024.0.14.6-preview-2701501 219 9/26/2024
2024.0.14.6-preview-2620901 229 9/18/2024
2024.0.14.6-preview-2570701 194 9/13/2024
2024.0.14.6-preview-2510703 273 9/7/2024
2024.0.14.6-preview-2480501 215 9/4/2024
2024.0.14.6-preview-2430401 233 8/30/2024
2024.0.14.6-preview-242730701 172 9/29/2024
2024.0.14.6-preview-2421703 207 8/29/2024
2024.0.14.6-preview-2421701 194 8/29/2024
2024.0.14.6-preview-2420901 184 8/29/2024
2024.0.14.6-preview-2390101 223 8/26/2024
2024.0.14.6-preview-2381603 201 8/25/2024
2024.0.14.6-preview-2341601 233 8/21/2024
2024.0.14.6-preview-2321602 216 8/20/2024
2024.0.14.6-preview-2190801 240 8/6/2024
2024.0.14.6-preview-2041501 198 7/22/2024
2024.0.14.6-preview-1920603 267 7/10/2024
2024.0.14.6-preview-1920301 193 7/10/2024
2024.0.14.6-preview-1911302 204 7/9/2024
2024.0.14.6-preview-1901001 219 7/8/2024
2024.0.14.6-preview-1900901 203 7/8/2024
2024.0.14.6-preview-1900801 186 7/8/2024
2024.0.14.6-preview-1860304 189 7/4/2024
2024.0.14.5 296 7/1/2024
2024.0.14.5-preview-1811601 200 6/29/2024
2024.0.14.5-preview-1810501 221 6/29/2024
2024.0.14.5-preview-180132 220 6/28/2024
2024.0.14.5-preview-180131 206 6/28/2024
2024.0.14.5-preview-180121 190 6/28/2024
2024.0.14.4 288 6/27/2024
2024.0.14.4-preview-7 204 6/27/2024
2024.0.14.3 258 6/21/2024
2024.0.14.1 241 6/6/2024
2024.0.14.1-preview 189 6/6/2024
2024.0.14-preview-1 174 6/6/2024
2024.0.13.8-preview 202 6/6/2024
2024.0.13.1-preview-0146 204 6/6/2024
2024.0.12.15803-preview-03 196 6/6/2024
2024.0.12.15608 223 6/4/2024
2024.0.12.15515 309 6/3/2024
2024.0.12.15220 230 5/31/2024
2024.0.12.15220-alpha31-240... 179 5/31/2024
2024.0.12.14911 272 5/28/2024
2024.0.12.14910-alpha28-240... 188 5/28/2024
2024.0.12.14823 236 5/27/2024
2024.0.12.14522-alpha7-2405... 218 5/24/2024
2024.0.12.14514-alpha6-2405... 195 5/24/2024
2024.0.12.14511 268 5/24/2024
2024.0.12.14314 281 5/22/2024
2024.0.12.14114 256 5/20/2024
2024.0.12.12815 284 5/7/2024
2024.0.12.12814 247 5/7/2024
2024.0.12.12721 263 5/6/2024
2024.0.12.12702 243 5/5/2024
2024.0.12.12622 267 5/5/2024
2024.0.12.12514 236 5/4/2024
2024.0.12.12512 264 5/4/2024
2024.0.12.12510 253 5/4/2024
2024.0.12.12420 224 5/3/2024
2024.0.12.12319 201 5/2/2024
2024.0.12.12319-rc-2405021801 174 5/2/2024
2024.0.12.12318 208 5/2/2024
2024.0.12.12215 240 5/1/2024
2024.0.12.12011 239 4/29/2024
2024.0.12.11720 245 4/26/2024
2024.0.12.11719 229 4/26/2024
2024.0.12.11621 281 4/25/2024
2024.0.12.11523 242 4/24/2024
2024.0.12.11522 236 4/24/2024
2024.0.12.11417 261 4/23/2024
2024.0.12.11400 263 4/22/2024
2024.0.12.11316 253 4/22/2024
2024.0.11.10220 237 4/11/2024
2024.0.11.10120 219 4/10/2024
2024.0.11.10119 211 4/10/2024
2024.0.11.10115 228 4/10/2024
2024.0.11.9914 251 4/8/2024
2024.0.11.9901 222 4/7/2024
2024.0.11.9823 234 4/7/2024
2024.0.11.9401 252 4/2/2024
2024.0.11.9301 239 4/1/2024
2024.0.11.9206 234 3/31/2024
2024.0.11.9205 222 3/31/2024
2024.0.11.8200 261 3/21/2024
2024.0.11.8122 225 3/21/2024
2024.0.11.8120 219 3/21/2024
2024.0.11.7320 280 3/13/2024
2024.0.11.7316 237 3/13/2024
2024.0.11.7310 238 3/13/2024
2024.0.11 243 3/13/2024
2024.0.10 265 3/3/2024
2024.0.9 250 2/27/2024
2024.0.8 285 2/1/2024
2024.0.7 235 1/26/2024
2024.0.6 232 1/25/2024
2024.0.5 219 1/24/2024
2024.0.4 224 1/24/2024
2024.0.3 235 1/22/2024
2024.0.2 299 1/10/2024
2024.0.1 251 1/9/2024
2024.0.1-alpha-3 206 1/9/2024
2024.0.1-alpha-2 189 1/9/2024
2024.0.1-alpha-1 229 1/3/2024
2024.0.0 284 12/26/2023
2023.0.27 300 12/21/2023
2023.0.26 271 12/21/2023
2023.0.25 293 12/11/2023
2023.0.24 278 12/8/2023
2023.0.23 237 12/6/2023
2023.0.21 330 12/4/2023
2023.0.20 298 11/27/2023
2023.0.19 255 11/20/2023
2023.0.18 276 10/25/2023
2023.0.17 314 10/22/2023
2023.0.16 350 10/16/2023
2023.0.16-alpha-1 209 10/16/2023
2023.0.15 259 10/14/2023
2023.0.14 239 10/14/2023
2023.0.13 243 10/14/2023
2023.0.12 248 10/14/2023
2023.0.11 236 10/10/2023
2023.0.10 249 10/9/2023
2023.0.9 373 8/16/2023
2023.0.8 346 8/15/2023
2023.0.8-alpha-2 391 5/31/2023
2023.0.7 730 5/12/2023
2023.0.6 507 5/10/2023
2023.0.5 337 5/7/2023
2023.0.4 372 4/22/2023
2023.0.3 416 4/19/2023
2023.0.2 404 4/6/2023
2023.0.1 374 3/13/2023
2022.10.4 448 11/9/2022
2022.10.3 508 10/19/2022
2022.10.2 624 10/19/2022
2022.10.0 602 10/16/2022
2022.7.1 651 7/18/2022

Basic infrastructure provided for authorizing User with given permission