DotNetBrightener.Infrastructure.Security 2024.0.14.5-preview-180132

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

Package Description

DotNetBrightener.WebApp.CommonShared

Package Description

DotNetBrightener.MultiTenancy

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.0.9-preview-481 0 9/29/2025
2025.0.9-preview-473 33 9/28/2025
2025.0.8 177 9/23/2025
2025.0.6 189 9/22/2025
2025.0.6-preview-455 187 9/22/2025
2025.0.6-preview-454 294 9/17/2025
2025.0.6-preview-441 139 9/14/2025
2025.0.6-preview-440 138 9/14/2025
2025.0.6-preview-406 161 9/2/2025
2025.0.6-preview-401 155 9/2/2025
2025.0.6-preview-400 149 9/2/2025
2025.0.6-preview-369 205 8/27/2025
2025.0.6-preview-368 192 8/27/2025
2025.0.6-preview-334 185 8/18/2025
2025.0.6-preview-333 112 7/27/2025
2025.0.6-preview-332 477 7/24/2025
2025.0.6-preview-331 485 7/24/2025
2025.0.6-preview-328 477 7/24/2025
2025.0.6-preview-327 363 7/21/2025
2025.0.6-preview-326 355 7/21/2025
2025.0.6-preview-325 275 7/20/2025
2025.0.6-preview-324 264 7/20/2025
2025.0.6-preview-322 262 7/20/2025
2025.0.6-preview-321 266 7/19/2025
2025.0.6-preview-320 270 7/19/2025
2025.0.6-preview-319 178 7/17/2025
2025.0.6-preview-317 165 7/17/2025
2025.0.6-preview-316 172 7/17/2025
2025.0.6-preview-315 172 7/17/2025
2025.0.6-preview-314 168 7/17/2025
2025.0.6-preview-313 175 7/17/2025
2025.0.6-preview-312 176 7/16/2025
2025.0.5 202 7/10/2025
2025.0.5-preview-307 112 7/5/2025
2025.0.4 130 7/5/2025
2025.0.4-preview-305 121 7/4/2025
2025.0.4-preview-304 181 7/1/2025
2025.0.4-preview-299 156 5/31/2025
2025.0.4-preview-298 133 5/30/2025
2025.0.4-preview-296 169 5/30/2025
2025.0.4-preview-295 182 5/29/2025
2025.0.4-preview-293 180 5/26/2025
2025.0.4-preview-292 187 5/26/2025
2025.0.3 177 2/10/2025
2025.0.3-preview-288 146 2/10/2025
2025.0.2 185 1/21/2025
2025.0.2-preview-278 127 1/21/2025
2025.0.2-preview-277 149 12/16/2024
2025.0.1-rc-243301701 435 11/25/2024
2024.0.14.6 210 11/25/2024
2024.0.14.6-rc-243031001 230 10/29/2024
2024.0.14.6-rc-243030701 160 10/29/2024
2024.0.14.6-rc-242840501 157 10/10/2024
2024.0.14.6-rc-242820305 154 10/8/2024
2024.0.14.6-rc-242771401 285 10/3/2024
2024.0.14.6-rc-242770501 149 10/3/2024
2024.0.14.6-rc-242770201 169 10/3/2024
2024.0.14.6-rc-242761801 152 10/2/2024
2024.0.14.6-rc-242761601 168 10/2/2024
2024.0.14.6-rc-242761501 151 10/2/2024
2024.0.14.6-rc-242761401 156 10/2/2024
2024.0.14.6-rc-242760701 169 10/2/2024
2024.0.14.6-rc-242751002 155 10/1/2024
2024.0.14.6-rc-242750901 172 10/1/2024
2024.0.14.6-rc-242750502 154 10/1/2024
2024.0.14.6-rc-242750201 160 10/1/2024
2024.0.14.6-rc-242741501 155 9/30/2024
2024.0.14.6-rc-242730701 171 9/29/2024
2024.0.14.6-preview-2730501 156 9/29/2024
2024.0.14.6-preview-2701501 197 9/26/2024
2024.0.14.6-preview-2620901 207 9/18/2024
2024.0.14.6-preview-2570701 165 9/13/2024
2024.0.14.6-preview-2510703 246 9/7/2024
2024.0.14.6-preview-2480501 189 9/4/2024
2024.0.14.6-preview-2430401 208 8/30/2024
2024.0.14.6-preview-242730701 150 9/29/2024
2024.0.14.6-preview-2421703 179 8/29/2024
2024.0.14.6-preview-2421701 163 8/29/2024
2024.0.14.6-preview-2420901 158 8/29/2024
2024.0.14.6-preview-2390101 191 8/26/2024
2024.0.14.6-preview-2381603 178 8/25/2024
2024.0.14.6-preview-2341601 203 8/21/2024
2024.0.14.6-preview-2321602 190 8/20/2024
2024.0.14.6-preview-2190801 211 8/6/2024
2024.0.14.6-preview-2041501 172 7/22/2024
2024.0.14.6-preview-1920603 240 7/10/2024
2024.0.14.6-preview-1920301 163 7/10/2024
2024.0.14.6-preview-1911302 175 7/9/2024
2024.0.14.6-preview-1901001 192 7/8/2024
2024.0.14.6-preview-1900901 182 7/8/2024
2024.0.14.6-preview-1900801 161 7/8/2024
2024.0.14.6-preview-1860304 174 7/4/2024
2024.0.14.5 272 7/1/2024
2024.0.14.5-preview-1811601 178 6/29/2024
2024.0.14.5-preview-1810501 199 6/29/2024
2024.0.14.5-preview-180132 200 6/28/2024
2024.0.14.5-preview-180131 177 6/28/2024
2024.0.14.5-preview-180121 163 6/28/2024
2024.0.14.4 259 6/27/2024
2024.0.14.4-preview-7 177 6/27/2024
2024.0.14.3 232 6/21/2024
2024.0.14.1 211 6/6/2024
2024.0.14.1-preview 166 6/6/2024
2024.0.14-preview-1 152 6/6/2024
2024.0.13.8-preview 173 6/6/2024
2024.0.13.1-preview-0146 177 6/6/2024
2024.0.12.15803-preview-03 169 6/6/2024
2024.0.12.15608 212 6/4/2024
2024.0.12.15515 285 6/3/2024
2024.0.12.15220 201 5/31/2024
2024.0.12.15220-alpha31-240... 157 5/31/2024
2024.0.12.14911 247 5/28/2024
2024.0.12.14910-alpha28-240... 166 5/28/2024
2024.0.12.14823 207 5/27/2024
2024.0.12.14522-alpha7-2405... 188 5/24/2024
2024.0.12.14514-alpha6-2405... 184 5/24/2024
2024.0.12.14511 232 5/24/2024
2024.0.12.14314 265 5/22/2024
2024.0.12.14114 244 5/20/2024
2024.0.12.12815 258 5/7/2024
2024.0.12.12814 221 5/7/2024
2024.0.12.12721 241 5/6/2024
2024.0.12.12702 231 5/5/2024
2024.0.12.12622 249 5/5/2024
2024.0.12.12514 223 5/4/2024
2024.0.12.12512 234 5/4/2024
2024.0.12.12510 223 5/4/2024
2024.0.12.12420 206 5/3/2024
2024.0.12.12319 172 5/2/2024
2024.0.12.12319-rc-2405021801 144 5/2/2024
2024.0.12.12318 186 5/2/2024
2024.0.12.12215 218 5/1/2024
2024.0.12.12011 217 4/29/2024
2024.0.12.11720 223 4/26/2024
2024.0.12.11719 212 4/26/2024
2024.0.12.11621 259 4/25/2024
2024.0.12.11523 212 4/24/2024
2024.0.12.11522 218 4/24/2024
2024.0.12.11417 240 4/23/2024
2024.0.12.11400 242 4/22/2024
2024.0.12.11316 228 4/22/2024
2024.0.11.10220 215 4/11/2024
2024.0.11.10120 197 4/10/2024
2024.0.11.10119 193 4/10/2024
2024.0.11.10115 213 4/10/2024
2024.0.11.9914 233 4/8/2024
2024.0.11.9901 211 4/7/2024
2024.0.11.9823 215 4/7/2024
2024.0.11.9401 230 4/2/2024
2024.0.11.9301 217 4/1/2024
2024.0.11.9206 212 3/31/2024
2024.0.11.9205 206 3/31/2024
2024.0.11.8200 243 3/21/2024
2024.0.11.8122 203 3/21/2024
2024.0.11.8120 197 3/21/2024
2024.0.11.7320 262 3/13/2024
2024.0.11.7316 217 3/13/2024
2024.0.11.7310 214 3/13/2024
2024.0.11 219 3/13/2024
2024.0.10 243 3/3/2024
2024.0.9 227 2/27/2024
2024.0.8 262 2/1/2024
2024.0.7 213 1/26/2024
2024.0.6 212 1/25/2024
2024.0.5 211 1/24/2024
2024.0.4 202 1/24/2024
2024.0.3 217 1/22/2024
2024.0.2 281 1/10/2024
2024.0.1 226 1/9/2024
2024.0.1-alpha-3 184 1/9/2024
2024.0.1-alpha-2 181 1/9/2024
2024.0.1-alpha-1 207 1/3/2024
2024.0.0 262 12/26/2023
2023.0.27 275 12/21/2023
2023.0.26 247 12/21/2023
2023.0.25 268 12/11/2023
2023.0.24 253 12/8/2023
2023.0.23 213 12/6/2023
2023.0.21 307 12/4/2023
2023.0.20 277 11/27/2023
2023.0.19 235 11/20/2023
2023.0.18 257 10/25/2023
2023.0.17 294 10/22/2023
2023.0.16 324 10/16/2023
2023.0.16-alpha-1 183 10/16/2023
2023.0.15 239 10/14/2023
2023.0.14 214 10/14/2023
2023.0.13 223 10/14/2023
2023.0.12 228 10/14/2023
2023.0.11 221 10/10/2023
2023.0.10 224 10/9/2023
2023.0.9 348 8/16/2023
2023.0.8 322 8/15/2023
2023.0.8-alpha-2 367 5/31/2023
2023.0.7 704 5/12/2023
2023.0.6 481 5/10/2023
2023.0.5 312 5/7/2023
2023.0.4 347 4/22/2023
2023.0.3 389 4/19/2023
2023.0.2 383 4/6/2023
2023.0.1 353 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