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.8 0 9/23/2025
2025.0.6 37 9/22/2025
2025.0.6-preview-455 42 9/22/2025
2025.0.6-preview-454 273 9/17/2025
2025.0.6-preview-441 119 9/14/2025
2025.0.6-preview-440 121 9/14/2025
2025.0.6-preview-406 155 9/2/2025
2025.0.6-preview-401 147 9/2/2025
2025.0.6-preview-400 144 9/2/2025
2025.0.6-preview-369 193 8/27/2025
2025.0.6-preview-368 186 8/27/2025
2025.0.6-preview-334 176 8/18/2025
2025.0.6-preview-333 78 7/27/2025
2025.0.6-preview-332 469 7/24/2025
2025.0.6-preview-331 473 7/24/2025
2025.0.6-preview-328 466 7/24/2025
2025.0.6-preview-327 354 7/21/2025
2025.0.6-preview-326 349 7/21/2025
2025.0.6-preview-325 269 7/20/2025
2025.0.6-preview-324 258 7/20/2025
2025.0.6-preview-322 256 7/20/2025
2025.0.6-preview-321 260 7/19/2025
2025.0.6-preview-320 261 7/19/2025
2025.0.6-preview-319 169 7/17/2025
2025.0.6-preview-317 159 7/17/2025
2025.0.6-preview-316 162 7/17/2025
2025.0.6-preview-315 165 7/17/2025
2025.0.6-preview-314 161 7/17/2025
2025.0.6-preview-313 169 7/17/2025
2025.0.6-preview-312 166 7/16/2025
2025.0.5 194 7/10/2025
2025.0.5-preview-307 106 7/5/2025
2025.0.4 122 7/5/2025
2025.0.4-preview-305 115 7/4/2025
2025.0.4-preview-304 173 7/1/2025
2025.0.4-preview-299 148 5/31/2025
2025.0.4-preview-298 127 5/30/2025
2025.0.4-preview-296 160 5/30/2025
2025.0.4-preview-295 176 5/29/2025
2025.0.4-preview-293 173 5/26/2025
2025.0.4-preview-292 176 5/26/2025
2025.0.3 166 2/10/2025
2025.0.3-preview-288 140 2/10/2025
2025.0.2 174 1/21/2025
2025.0.2-preview-278 121 1/21/2025
2025.0.2-preview-277 143 12/16/2024
2025.0.1-rc-243301701 427 11/25/2024
2024.0.14.6 199 11/25/2024
2024.0.14.6-rc-243031001 221 10/29/2024
2024.0.14.6-rc-243030701 152 10/29/2024
2024.0.14.6-rc-242840501 145 10/10/2024
2024.0.14.6-rc-242820305 146 10/8/2024
2024.0.14.6-rc-242771401 277 10/3/2024
2024.0.14.6-rc-242770501 141 10/3/2024
2024.0.14.6-rc-242770201 157 10/3/2024
2024.0.14.6-rc-242761801 144 10/2/2024
2024.0.14.6-rc-242761601 156 10/2/2024
2024.0.14.6-rc-242761501 143 10/2/2024
2024.0.14.6-rc-242761401 144 10/2/2024
2024.0.14.6-rc-242760701 157 10/2/2024
2024.0.14.6-rc-242751002 151 10/1/2024
2024.0.14.6-rc-242750901 157 10/1/2024
2024.0.14.6-rc-242750502 146 10/1/2024
2024.0.14.6-rc-242750201 148 10/1/2024
2024.0.14.6-rc-242741501 143 9/30/2024
2024.0.14.6-rc-242730701 168 9/29/2024
2024.0.14.6-preview-2730501 144 9/29/2024
2024.0.14.6-preview-2701501 184 9/26/2024
2024.0.14.6-preview-2620901 195 9/18/2024
2024.0.14.6-preview-2570701 161 9/13/2024
2024.0.14.6-preview-2510703 238 9/7/2024
2024.0.14.6-preview-2480501 181 9/4/2024
2024.0.14.6-preview-2430401 200 8/30/2024
2024.0.14.6-preview-242730701 138 9/29/2024
2024.0.14.6-preview-2421703 171 8/29/2024
2024.0.14.6-preview-2421701 155 8/29/2024
2024.0.14.6-preview-2420901 152 8/29/2024
2024.0.14.6-preview-2390101 187 8/26/2024
2024.0.14.6-preview-2381603 173 8/25/2024
2024.0.14.6-preview-2341601 199 8/21/2024
2024.0.14.6-preview-2321602 182 8/20/2024
2024.0.14.6-preview-2190801 207 8/6/2024
2024.0.14.6-preview-2041501 164 7/22/2024
2024.0.14.6-preview-1920603 228 7/10/2024
2024.0.14.6-preview-1920301 155 7/10/2024
2024.0.14.6-preview-1911302 167 7/9/2024
2024.0.14.6-preview-1901001 184 7/8/2024
2024.0.14.6-preview-1900901 179 7/8/2024
2024.0.14.6-preview-1900801 153 7/8/2024
2024.0.14.6-preview-1860304 166 7/4/2024
2024.0.14.5 261 7/1/2024
2024.0.14.5-preview-1811601 170 6/29/2024
2024.0.14.5-preview-1810501 188 6/29/2024
2024.0.14.5-preview-180132 192 6/28/2024
2024.0.14.5-preview-180131 169 6/28/2024
2024.0.14.5-preview-180121 159 6/28/2024
2024.0.14.4 233 6/27/2024
2024.0.14.4-preview-7 169 6/27/2024
2024.0.14.3 217 6/21/2024
2024.0.14.1 200 6/6/2024
2024.0.14.1-preview 158 6/6/2024
2024.0.14-preview-1 144 6/6/2024
2024.0.13.8-preview 165 6/6/2024
2024.0.13.1-preview-0146 165 6/6/2024
2024.0.12.15803-preview-03 161 6/6/2024
2024.0.12.15608 198 6/4/2024
2024.0.12.15515 275 6/3/2024
2024.0.12.15220 188 5/31/2024
2024.0.12.15220-alpha31-240... 145 5/31/2024
2024.0.12.14911 237 5/28/2024
2024.0.12.14910-alpha28-240... 158 5/28/2024
2024.0.12.14823 197 5/27/2024
2024.0.12.14522-alpha7-2405... 180 5/24/2024
2024.0.12.14514-alpha6-2405... 172 5/24/2024
2024.0.12.14511 222 5/24/2024
2024.0.12.14314 250 5/22/2024
2024.0.12.14114 231 5/20/2024
2024.0.12.12815 244 5/7/2024
2024.0.12.12814 210 5/7/2024
2024.0.12.12721 227 5/6/2024
2024.0.12.12702 215 5/5/2024
2024.0.12.12622 235 5/5/2024
2024.0.12.12514 212 5/4/2024
2024.0.12.12512 223 5/4/2024
2024.0.12.12510 212 5/4/2024
2024.0.12.12420 196 5/3/2024
2024.0.12.12319 162 5/2/2024
2024.0.12.12319-rc-2405021801 133 5/2/2024
2024.0.12.12318 172 5/2/2024
2024.0.12.12215 203 5/1/2024
2024.0.12.12011 206 4/29/2024
2024.0.12.11720 215 4/26/2024
2024.0.12.11719 200 4/26/2024
2024.0.12.11621 250 4/25/2024
2024.0.12.11523 204 4/24/2024
2024.0.12.11522 204 4/24/2024
2024.0.12.11417 227 4/23/2024
2024.0.12.11400 228 4/22/2024
2024.0.12.11316 217 4/22/2024
2024.0.11.10220 207 4/11/2024
2024.0.11.10120 187 4/10/2024
2024.0.11.10119 183 4/10/2024
2024.0.11.10115 203 4/10/2024
2024.0.11.9914 223 4/8/2024
2024.0.11.9901 204 4/7/2024
2024.0.11.9823 205 4/7/2024
2024.0.11.9401 220 4/2/2024
2024.0.11.9301 206 4/1/2024
2024.0.11.9206 203 3/31/2024
2024.0.11.9205 195 3/31/2024
2024.0.11.8200 232 3/21/2024
2024.0.11.8122 193 3/21/2024
2024.0.11.8120 187 3/21/2024
2024.0.11.7320 252 3/13/2024
2024.0.11.7316 211 3/13/2024
2024.0.11.7310 205 3/13/2024
2024.0.11 209 3/13/2024
2024.0.10 233 3/3/2024
2024.0.9 218 2/27/2024
2024.0.8 252 2/1/2024
2024.0.7 207 1/26/2024
2024.0.6 202 1/25/2024
2024.0.5 201 1/24/2024
2024.0.4 192 1/24/2024
2024.0.3 207 1/22/2024
2024.0.2 270 1/10/2024
2024.0.1 216 1/9/2024
2024.0.1-alpha-3 176 1/9/2024
2024.0.1-alpha-2 173 1/9/2024
2024.0.1-alpha-1 199 1/3/2024
2024.0.0 251 12/26/2023
2023.0.27 264 12/21/2023
2023.0.26 237 12/21/2023
2023.0.25 256 12/11/2023
2023.0.24 242 12/8/2023
2023.0.23 203 12/6/2023
2023.0.21 297 12/4/2023
2023.0.20 267 11/27/2023
2023.0.19 225 11/20/2023
2023.0.18 243 10/25/2023
2023.0.17 284 10/22/2023
2023.0.16 314 10/16/2023
2023.0.16-alpha-1 173 10/16/2023
2023.0.15 229 10/14/2023
2023.0.14 205 10/14/2023
2023.0.13 213 10/14/2023
2023.0.12 217 10/14/2023
2023.0.11 210 10/10/2023
2023.0.10 214 10/9/2023
2023.0.9 339 8/16/2023
2023.0.8 311 8/15/2023
2023.0.8-alpha-2 356 5/31/2023
2023.0.7 693 5/12/2023
2023.0.6 466 5/10/2023
2023.0.5 300 5/7/2023
2023.0.4 335 4/22/2023
2023.0.3 378 4/19/2023
2023.0.2 372 4/6/2023
2023.0.1 352 3/13/2023
2022.10.4 436 11/9/2022
2022.10.3 496 10/19/2022
2022.10.2 610 10/19/2022
2022.10.0 598 10/16/2022
2022.7.1 636 7/18/2022

Basic infrastructure provided for authorizing User with given permission