DotNetBrightener.Infrastructure.Security 2024.0.14.5-preview-180121

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-180121
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2024.0.14.5-preview-180121
                    
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-180121" />
                    
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-180121" />
                    
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-180121
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2024.0.14.5-preview-180121"
                    
#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-180121
                    
#: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-180121&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.14.5-preview-180121&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.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.6-preview-369 0 8/27/2025
2025.0.6-preview-368 0 8/27/2025
2025.0.6-preview-334 118 8/18/2025
2025.0.6-preview-333 70 7/27/2025
2025.0.6-preview-332 442 7/24/2025
2025.0.6-preview-331 443 7/24/2025
2025.0.6-preview-328 439 7/24/2025
2025.0.6-preview-327 278 7/21/2025
2025.0.6-preview-326 277 7/21/2025
2025.0.6-preview-325 190 7/20/2025
2025.0.6-preview-324 185 7/20/2025
2025.0.6-preview-322 186 7/20/2025
2025.0.6-preview-321 189 7/19/2025
2025.0.6-preview-320 190 7/19/2025
2025.0.6-preview-319 119 7/17/2025
2025.0.6-preview-317 112 7/17/2025
2025.0.6-preview-316 112 7/17/2025
2025.0.6-preview-315 115 7/17/2025
2025.0.6-preview-314 111 7/17/2025
2025.0.6-preview-313 119 7/17/2025
2025.0.6-preview-312 145 7/16/2025
2025.0.5 170 7/10/2025
2025.0.5-preview-307 95 7/5/2025
2025.0.4 104 7/5/2025
2025.0.4-preview-305 103 7/4/2025
2025.0.4-preview-304 165 7/1/2025
2025.0.4-preview-299 137 5/31/2025
2025.0.4-preview-298 120 5/30/2025
2025.0.4-preview-296 152 5/30/2025
2025.0.4-preview-295 169 5/29/2025
2025.0.4-preview-293 168 5/26/2025
2025.0.4-preview-292 169 5/26/2025
2025.0.3 157 2/10/2025
2025.0.3-preview-288 133 2/10/2025
2025.0.2 163 1/21/2025
2025.0.2-preview-278 116 1/21/2025
2025.0.2-preview-277 138 12/16/2024
2025.0.1-rc-243301701 422 11/25/2024
2024.0.14.6 187 11/25/2024
2024.0.14.6-rc-243031001 215 10/29/2024
2024.0.14.6-rc-243030701 146 10/29/2024
2024.0.14.6-rc-242840501 142 10/10/2024
2024.0.14.6-rc-242820305 139 10/8/2024
2024.0.14.6-rc-242771401 271 10/3/2024
2024.0.14.6-rc-242770501 135 10/3/2024
2024.0.14.6-rc-242770201 152 10/3/2024
2024.0.14.6-rc-242761801 139 10/2/2024
2024.0.14.6-rc-242761601 150 10/2/2024
2024.0.14.6-rc-242761501 137 10/2/2024
2024.0.14.6-rc-242761401 142 10/2/2024
2024.0.14.6-rc-242760701 151 10/2/2024
2024.0.14.6-rc-242751002 143 10/1/2024
2024.0.14.6-rc-242750901 151 10/1/2024
2024.0.14.6-rc-242750502 140 10/1/2024
2024.0.14.6-rc-242750201 142 10/1/2024
2024.0.14.6-rc-242741501 136 9/30/2024
2024.0.14.6-rc-242730701 162 9/29/2024
2024.0.14.6-preview-2730501 138 9/29/2024
2024.0.14.6-preview-2701501 178 9/26/2024
2024.0.14.6-preview-2620901 189 9/18/2024
2024.0.14.6-preview-2570701 154 9/13/2024
2024.0.14.6-preview-2510703 230 9/7/2024
2024.0.14.6-preview-2480501 173 9/4/2024
2024.0.14.6-preview-2430401 194 8/30/2024
2024.0.14.6-preview-242730701 136 9/29/2024
2024.0.14.6-preview-2421703 165 8/29/2024
2024.0.14.6-preview-2421701 149 8/29/2024
2024.0.14.6-preview-2420901 145 8/29/2024
2024.0.14.6-preview-2390101 181 8/26/2024
2024.0.14.6-preview-2381603 167 8/25/2024
2024.0.14.6-preview-2341601 197 8/21/2024
2024.0.14.6-preview-2321602 175 8/20/2024
2024.0.14.6-preview-2190801 201 8/6/2024
2024.0.14.6-preview-2041501 155 7/22/2024
2024.0.14.6-preview-1920603 222 7/10/2024
2024.0.14.6-preview-1920301 149 7/10/2024
2024.0.14.6-preview-1911302 161 7/9/2024
2024.0.14.6-preview-1901001 178 7/8/2024
2024.0.14.6-preview-1900901 173 7/8/2024
2024.0.14.6-preview-1900801 147 7/8/2024
2024.0.14.6-preview-1860304 156 7/4/2024
2024.0.14.5 249 7/1/2024
2024.0.14.5-preview-1811601 164 6/29/2024
2024.0.14.5-preview-1810501 182 6/29/2024
2024.0.14.5-preview-180132 185 6/28/2024
2024.0.14.5-preview-180131 162 6/28/2024
2024.0.14.5-preview-180121 154 6/28/2024
2024.0.14.4 221 6/27/2024
2024.0.14.4-preview-7 163 6/27/2024
2024.0.14.3 205 6/21/2024
2024.0.14.1 188 6/6/2024
2024.0.14.1-preview 152 6/6/2024
2024.0.14-preview-1 138 6/6/2024
2024.0.13.8-preview 158 6/6/2024
2024.0.13.1-preview-0146 159 6/6/2024
2024.0.12.15803-preview-03 155 6/6/2024
2024.0.12.15608 186 6/4/2024
2024.0.12.15515 263 6/3/2024
2024.0.12.15220 177 5/31/2024
2024.0.12.15220-alpha31-240... 139 5/31/2024
2024.0.12.14911 225 5/28/2024
2024.0.12.14910-alpha28-240... 151 5/28/2024
2024.0.12.14823 189 5/27/2024
2024.0.12.14522-alpha7-2405... 178 5/24/2024
2024.0.12.14514-alpha6-2405... 166 5/24/2024
2024.0.12.14511 209 5/24/2024
2024.0.12.14314 238 5/22/2024
2024.0.12.14114 218 5/20/2024
2024.0.12.12815 231 5/7/2024
2024.0.12.12814 198 5/7/2024
2024.0.12.12721 215 5/6/2024
2024.0.12.12702 203 5/5/2024
2024.0.12.12622 223 5/5/2024
2024.0.12.12514 198 5/4/2024
2024.0.12.12512 212 5/4/2024
2024.0.12.12510 200 5/4/2024
2024.0.12.12420 184 5/3/2024
2024.0.12.12319 150 5/2/2024
2024.0.12.12319-rc-2405021801 127 5/2/2024
2024.0.12.12318 159 5/2/2024
2024.0.12.12215 191 5/1/2024
2024.0.12.12011 192 4/29/2024
2024.0.12.11720 202 4/26/2024
2024.0.12.11719 188 4/26/2024
2024.0.12.11621 238 4/25/2024
2024.0.12.11523 192 4/24/2024
2024.0.12.11522 192 4/24/2024
2024.0.12.11417 215 4/23/2024
2024.0.12.11400 216 4/22/2024
2024.0.12.11316 201 4/22/2024
2024.0.11.10220 195 4/11/2024
2024.0.11.10120 175 4/10/2024
2024.0.11.10119 172 4/10/2024
2024.0.11.10115 191 4/10/2024
2024.0.11.9914 210 4/8/2024
2024.0.11.9901 192 4/7/2024
2024.0.11.9823 191 4/7/2024
2024.0.11.9401 208 4/2/2024
2024.0.11.9301 193 4/1/2024
2024.0.11.9206 191 3/31/2024
2024.0.11.9205 183 3/31/2024
2024.0.11.8200 219 3/21/2024
2024.0.11.8122 177 3/21/2024
2024.0.11.8120 177 3/21/2024
2024.0.11.7320 240 3/13/2024
2024.0.11.7316 199 3/13/2024
2024.0.11.7310 195 3/13/2024
2024.0.11 196 3/13/2024
2024.0.10 217 3/3/2024
2024.0.9 208 2/27/2024
2024.0.8 240 2/1/2024
2024.0.7 195 1/26/2024
2024.0.6 190 1/25/2024
2024.0.5 187 1/24/2024
2024.0.4 181 1/24/2024
2024.0.3 195 1/22/2024
2024.0.2 257 1/10/2024
2024.0.1 204 1/9/2024
2024.0.1-alpha-3 169 1/9/2024
2024.0.1-alpha-2 165 1/9/2024
2024.0.1-alpha-1 193 1/3/2024
2024.0.0 240 12/26/2023
2023.0.27 251 12/21/2023
2023.0.26 221 12/21/2023
2023.0.25 242 12/11/2023
2023.0.24 229 12/8/2023
2023.0.23 201 12/6/2023
2023.0.21 294 12/4/2023
2023.0.20 260 11/27/2023
2023.0.19 218 11/20/2023
2023.0.18 234 10/25/2023
2023.0.17 277 10/22/2023
2023.0.16 307 10/16/2023
2023.0.16-alpha-1 164 10/16/2023
2023.0.15 221 10/14/2023
2023.0.14 198 10/14/2023
2023.0.13 206 10/14/2023
2023.0.12 215 10/14/2023
2023.0.11 203 10/10/2023
2023.0.10 207 10/9/2023
2023.0.9 327 8/16/2023
2023.0.8 298 8/15/2023
2023.0.8-alpha-2 340 5/31/2023
2023.0.7 678 5/12/2023
2023.0.6 447 5/10/2023
2023.0.5 285 5/7/2023
2023.0.4 320 4/22/2023
2023.0.3 363 4/19/2023
2023.0.2 357 4/6/2023
2023.0.1 337 3/13/2023
2022.10.4 424 11/9/2022
2022.10.3 484 10/19/2022
2022.10.2 588 10/19/2022
2022.10.0 576 10/16/2022
2022.7.1 614 7/18/2022

Basic infrastructure provided for authorizing User with given permission