DotNetBrightener.Infrastructure.Security 2024.0.14.6-preview-1860304

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 2024.0.14.6-preview-1860304
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2024.0.14.6-preview-1860304
                    
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="2024.0.14.6-preview-1860304" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetBrightener.Infrastructure.Security" Version="2024.0.14.6-preview-1860304" />
                    
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 2024.0.14.6-preview-1860304
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2024.0.14.6-preview-1860304"
                    
#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@2024.0.14.6-preview-1860304
                    
#: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=2024.0.14.6-preview-1860304&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.14.6-preview-1860304&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 net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.MultiTenancy

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-487 89 9/29/2025
2025.0.9-preview-481 86 9/29/2025
2025.0.9-preview-473 97 9/28/2025
2025.0.8 228 9/23/2025
2025.0.6 229 9/22/2025
2025.0.6-preview-455 215 9/22/2025
2025.0.6-preview-454 319 9/17/2025
2025.0.6-preview-441 163 9/14/2025
2025.0.6-preview-440 156 9/14/2025
2025.0.6-preview-406 182 9/2/2025
2025.0.6-preview-401 182 9/2/2025
2025.0.6-preview-400 173 9/2/2025
2025.0.6-preview-369 225 8/27/2025
2025.0.6-preview-368 213 8/27/2025
2025.0.6-preview-334 203 8/18/2025
2025.0.6-preview-333 131 7/27/2025
2025.0.6-preview-332 499 7/24/2025
2025.0.6-preview-331 498 7/24/2025
2025.0.6-preview-328 493 7/24/2025
2025.0.6-preview-327 382 7/21/2025
2025.0.6-preview-326 361 7/21/2025
2025.0.6-preview-325 288 7/20/2025
2025.0.6-preview-324 280 7/20/2025
2025.0.6-preview-322 278 7/20/2025
2025.0.6-preview-321 287 7/19/2025
2025.0.6-preview-320 289 7/19/2025
2025.0.6-preview-319 197 7/17/2025
2025.0.6-preview-317 187 7/17/2025
2025.0.6-preview-316 190 7/17/2025
2025.0.6-preview-315 194 7/17/2025
2025.0.6-preview-314 190 7/17/2025
2025.0.6-preview-313 184 7/17/2025
2025.0.6-preview-312 192 7/16/2025
2025.0.5 217 7/10/2025
2025.0.5-preview-307 134 7/5/2025
2025.0.4 150 7/5/2025
2025.0.4-preview-305 142 7/4/2025
2025.0.4-preview-304 203 7/1/2025
2025.0.4-preview-299 181 5/31/2025
2025.0.4-preview-298 152 5/30/2025
2025.0.4-preview-296 188 5/30/2025
2025.0.4-preview-295 195 5/29/2025
2025.0.4-preview-293 196 5/26/2025
2025.0.4-preview-292 204 5/26/2025
2025.0.3 194 2/10/2025
2025.0.3-preview-288 168 2/10/2025
2025.0.2 204 1/21/2025
2025.0.2-preview-278 143 1/21/2025
2025.0.2-preview-277 171 12/16/2024
2025.0.1-rc-243301701 451 11/25/2024
2024.0.14.6 230 11/25/2024
2024.0.14.6-rc-243031001 252 10/29/2024
2024.0.14.6-rc-243030701 174 10/29/2024
2024.0.14.6-rc-242840501 175 10/10/2024
2024.0.14.6-rc-242820305 171 10/8/2024
2024.0.14.6-rc-242771401 313 10/3/2024
2024.0.14.6-rc-242770501 173 10/3/2024
2024.0.14.6-rc-242770201 190 10/3/2024
2024.0.14.6-rc-242761801 176 10/2/2024
2024.0.14.6-rc-242761601 188 10/2/2024
2024.0.14.6-rc-242761501 168 10/2/2024
2024.0.14.6-rc-242761401 178 10/2/2024
2024.0.14.6-rc-242760701 196 10/2/2024
2024.0.14.6-rc-242751002 177 10/1/2024
2024.0.14.6-rc-242750901 190 10/1/2024
2024.0.14.6-rc-242750502 174 10/1/2024
2024.0.14.6-rc-242750201 190 10/1/2024
2024.0.14.6-rc-242741501 172 9/30/2024
2024.0.14.6-rc-242730701 191 9/29/2024
2024.0.14.6-preview-2730501 178 9/29/2024
2024.0.14.6-preview-2701501 215 9/26/2024
2024.0.14.6-preview-2620901 225 9/18/2024
2024.0.14.6-preview-2570701 190 9/13/2024
2024.0.14.6-preview-2510703 269 9/7/2024
2024.0.14.6-preview-2480501 211 9/4/2024
2024.0.14.6-preview-2430401 229 8/30/2024
2024.0.14.6-preview-242730701 168 9/29/2024
2024.0.14.6-preview-2421703 199 8/29/2024
2024.0.14.6-preview-2421701 190 8/29/2024
2024.0.14.6-preview-2420901 180 8/29/2024
2024.0.14.6-preview-2390101 219 8/26/2024
2024.0.14.6-preview-2381603 197 8/25/2024
2024.0.14.6-preview-2341601 229 8/21/2024
2024.0.14.6-preview-2321602 212 8/20/2024
2024.0.14.6-preview-2190801 236 8/6/2024
2024.0.14.6-preview-2041501 194 7/22/2024
2024.0.14.6-preview-1920603 263 7/10/2024
2024.0.14.6-preview-1920301 189 7/10/2024
2024.0.14.6-preview-1911302 200 7/9/2024
2024.0.14.6-preview-1901001 215 7/8/2024
2024.0.14.6-preview-1900901 199 7/8/2024
2024.0.14.6-preview-1900801 182 7/8/2024
2024.0.14.6-preview-1860304 185 7/4/2024
2024.0.14.5 293 7/1/2024
2024.0.14.5-preview-1811601 196 6/29/2024
2024.0.14.5-preview-1810501 217 6/29/2024
2024.0.14.5-preview-180132 216 6/28/2024
2024.0.14.5-preview-180131 202 6/28/2024
2024.0.14.5-preview-180121 184 6/28/2024
2024.0.14.4 280 6/27/2024
2024.0.14.4-preview-7 198 6/27/2024
2024.0.14.3 254 6/21/2024
2024.0.14.1 233 6/6/2024
2024.0.14.1-preview 184 6/6/2024
2024.0.14-preview-1 170 6/6/2024
2024.0.13.8-preview 198 6/6/2024
2024.0.13.1-preview-0146 200 6/6/2024
2024.0.12.15803-preview-03 191 6/6/2024
2024.0.12.15608 218 6/4/2024
2024.0.12.15515 305 6/3/2024
2024.0.12.15220 222 5/31/2024
2024.0.12.15220-alpha31-240... 175 5/31/2024
2024.0.12.14911 268 5/28/2024
2024.0.12.14910-alpha28-240... 184 5/28/2024
2024.0.12.14823 232 5/27/2024
2024.0.12.14522-alpha7-2405... 214 5/24/2024
2024.0.12.14514-alpha6-2405... 191 5/24/2024
2024.0.12.14511 264 5/24/2024
2024.0.12.14314 277 5/22/2024
2024.0.12.14114 252 5/20/2024
2024.0.12.12815 280 5/7/2024
2024.0.12.12814 243 5/7/2024
2024.0.12.12721 259 5/6/2024
2024.0.12.12702 239 5/5/2024
2024.0.12.12622 263 5/5/2024
2024.0.12.12514 234 5/4/2024
2024.0.12.12512 260 5/4/2024
2024.0.12.12510 249 5/4/2024
2024.0.12.12420 220 5/3/2024
2024.0.12.12319 197 5/2/2024
2024.0.12.12319-rc-2405021801 171 5/2/2024
2024.0.12.12318 203 5/2/2024
2024.0.12.12215 236 5/1/2024
2024.0.12.12011 235 4/29/2024
2024.0.12.11720 241 4/26/2024
2024.0.12.11719 225 4/26/2024
2024.0.12.11621 277 4/25/2024
2024.0.12.11523 238 4/24/2024
2024.0.12.11522 232 4/24/2024
2024.0.12.11417 257 4/23/2024
2024.0.12.11400 259 4/22/2024
2024.0.12.11316 250 4/22/2024
2024.0.11.10220 233 4/11/2024
2024.0.11.10120 215 4/10/2024
2024.0.11.10119 207 4/10/2024
2024.0.11.10115 224 4/10/2024
2024.0.11.9914 247 4/8/2024
2024.0.11.9901 218 4/7/2024
2024.0.11.9823 233 4/7/2024
2024.0.11.9401 248 4/2/2024
2024.0.11.9301 235 4/1/2024
2024.0.11.9206 230 3/31/2024
2024.0.11.9205 218 3/31/2024
2024.0.11.8200 257 3/21/2024
2024.0.11.8122 221 3/21/2024
2024.0.11.8120 215 3/21/2024
2024.0.11.7320 276 3/13/2024
2024.0.11.7316 233 3/13/2024
2024.0.11.7310 234 3/13/2024
2024.0.11 239 3/13/2024
2024.0.10 261 3/3/2024
2024.0.9 245 2/27/2024
2024.0.8 280 2/1/2024
2024.0.7 231 1/26/2024
2024.0.6 228 1/25/2024
2024.0.5 215 1/24/2024
2024.0.4 220 1/24/2024
2024.0.3 231 1/22/2024
2024.0.2 295 1/10/2024
2024.0.1 247 1/9/2024
2024.0.1-alpha-3 202 1/9/2024
2024.0.1-alpha-2 189 1/9/2024
2024.0.1-alpha-1 225 1/3/2024
2024.0.0 280 12/26/2023
2023.0.27 295 12/21/2023
2023.0.26 267 12/21/2023
2023.0.25 288 12/11/2023
2023.0.24 273 12/8/2023
2023.0.23 232 12/6/2023
2023.0.21 327 12/4/2023
2023.0.20 293 11/27/2023
2023.0.19 250 11/20/2023
2023.0.18 272 10/25/2023
2023.0.17 314 10/22/2023
2023.0.16 345 10/16/2023
2023.0.16-alpha-1 204 10/16/2023
2023.0.15 259 10/14/2023
2023.0.14 234 10/14/2023
2023.0.13 238 10/14/2023
2023.0.12 248 10/14/2023
2023.0.11 236 10/10/2023
2023.0.10 244 10/9/2023
2023.0.9 368 8/16/2023
2023.0.8 341 8/15/2023
2023.0.8-alpha-2 386 5/31/2023
2023.0.7 724 5/12/2023
2023.0.6 501 5/10/2023
2023.0.5 331 5/7/2023
2023.0.4 366 4/22/2023
2023.0.3 410 4/19/2023
2023.0.2 403 4/6/2023
2023.0.1 373 3/13/2023
2022.10.4 447 11/9/2022
2022.10.3 507 10/19/2022
2022.10.2 622 10/19/2022
2022.10.0 600 10/16/2022
2022.7.1 650 7/18/2022

Basic infrastructure provided for authorizing User with given permission