DotNetBrightener.Infrastructure.Security 2024.0.12.14522-alpha7-24052422

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.12.14522-alpha7-24052422
                    
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2024.0.12.14522-alpha7-24052422
                    
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.12.14522-alpha7-24052422" />
                    
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.12.14522-alpha7-24052422" />
                    
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.12.14522-alpha7-24052422
                    
#r "nuget: DotNetBrightener.Infrastructure.Security, 2024.0.12.14522-alpha7-24052422"
                    
#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.
#addin nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.14522-alpha7-24052422&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.14522-alpha7-24052422&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.4-preview-299 127 5/31/2025
2025.0.4-preview-298 109 5/30/2025
2025.0.4-preview-296 141 5/30/2025
2025.0.4-preview-295 158 5/29/2025
2025.0.4-preview-293 158 5/26/2025
2025.0.4-preview-292 159 5/26/2025
2025.0.3 141 2/10/2025
2025.0.3-preview-288 124 2/10/2025
2025.0.2 147 1/21/2025
2025.0.2-preview-278 107 1/21/2025
2025.0.2-preview-277 129 12/16/2024
2025.0.1-rc-243301701 412 11/25/2024
2024.0.14.6 171 11/25/2024
2024.0.14.6-rc-243031001 206 10/29/2024
2024.0.14.6-rc-243030701 136 10/29/2024
2024.0.14.6-rc-242840501 133 10/10/2024
2024.0.14.6-rc-242820305 130 10/8/2024
2024.0.14.6-rc-242771401 262 10/3/2024
2024.0.14.6-rc-242770501 127 10/3/2024
2024.0.14.6-rc-242770201 143 10/3/2024
2024.0.14.6-rc-242761801 131 10/2/2024
2024.0.14.6-rc-242761601 141 10/2/2024
2024.0.14.6-rc-242761501 128 10/2/2024
2024.0.14.6-rc-242761401 133 10/2/2024
2024.0.14.6-rc-242760701 143 10/2/2024
2024.0.14.6-rc-242751002 134 10/1/2024
2024.0.14.6-rc-242750901 141 10/1/2024
2024.0.14.6-rc-242750502 132 10/1/2024
2024.0.14.6-rc-242750201 134 10/1/2024
2024.0.14.6-rc-242741501 128 9/30/2024
2024.0.14.6-rc-242730701 154 9/29/2024
2024.0.14.6-preview-2730501 129 9/29/2024
2024.0.14.6-preview-2701501 164 9/26/2024
2024.0.14.6-preview-2620901 181 9/18/2024
2024.0.14.6-preview-2570701 145 9/13/2024
2024.0.14.6-preview-2510703 222 9/7/2024
2024.0.14.6-preview-2480501 164 9/4/2024
2024.0.14.6-preview-2430401 185 8/30/2024
2024.0.14.6-preview-242730701 127 9/29/2024
2024.0.14.6-preview-2421703 156 8/29/2024
2024.0.14.6-preview-2421701 140 8/29/2024
2024.0.14.6-preview-2420901 137 8/29/2024
2024.0.14.6-preview-2390101 173 8/26/2024
2024.0.14.6-preview-2381603 159 8/25/2024
2024.0.14.6-preview-2341601 187 8/21/2024
2024.0.14.6-preview-2321602 167 8/20/2024
2024.0.14.6-preview-2190801 190 8/6/2024
2024.0.14.6-preview-2041501 146 7/22/2024
2024.0.14.6-preview-1920603 213 7/10/2024
2024.0.14.6-preview-1920301 140 7/10/2024
2024.0.14.6-preview-1911302 151 7/9/2024
2024.0.14.6-preview-1901001 167 7/8/2024
2024.0.14.6-preview-1900901 164 7/8/2024
2024.0.14.6-preview-1900801 137 7/8/2024
2024.0.14.6-preview-1860304 148 7/4/2024
2024.0.14.5 233 7/1/2024
2024.0.14.5-preview-1811601 155 6/29/2024
2024.0.14.5-preview-1810501 172 6/29/2024
2024.0.14.5-preview-180132 177 6/28/2024
2024.0.14.5-preview-180131 154 6/28/2024
2024.0.14.5-preview-180121 146 6/28/2024
2024.0.14.4 205 6/27/2024
2024.0.14.4-preview-7 155 6/27/2024
2024.0.14.3 185 6/21/2024
2024.0.14.1 173 6/6/2024
2024.0.14.1-preview 144 6/6/2024
2024.0.14-preview-1 129 6/6/2024
2024.0.13.8-preview 149 6/6/2024
2024.0.13.1-preview-0146 151 6/6/2024
2024.0.12.15803-preview-03 146 6/6/2024
2024.0.12.15608 169 6/4/2024
2024.0.12.15515 249 6/3/2024
2024.0.12.15220 159 5/31/2024
2024.0.12.15220-alpha31-240... 129 5/31/2024
2024.0.12.14911 209 5/28/2024
2024.0.12.14910-alpha28-240... 142 5/28/2024
2024.0.12.14823 173 5/27/2024
2024.0.12.14522-alpha7-2405... 168 5/24/2024
2024.0.12.14514-alpha6-2405... 151 5/24/2024
2024.0.12.14511 194 5/24/2024
2024.0.12.14314 223 5/22/2024
2024.0.12.14114 203 5/20/2024
2024.0.12.12815 215 5/7/2024
2024.0.12.12814 182 5/7/2024
2024.0.12.12721 200 5/6/2024
2024.0.12.12702 189 5/5/2024
2024.0.12.12622 209 5/5/2024
2024.0.12.12514 182 5/4/2024
2024.0.12.12512 199 5/4/2024
2024.0.12.12510 185 5/4/2024
2024.0.12.12420 167 5/3/2024
2024.0.12.12319 134 5/2/2024
2024.0.12.12319-rc-2405021801 117 5/2/2024
2024.0.12.12318 143 5/2/2024
2024.0.12.12215 175 5/1/2024
2024.0.12.12011 176 4/29/2024
2024.0.12.11720 186 4/26/2024
2024.0.12.11719 171 4/26/2024
2024.0.12.11621 208 4/25/2024
2024.0.12.11523 175 4/24/2024
2024.0.12.11522 176 4/24/2024
2024.0.12.11417 201 4/23/2024
2024.0.12.11400 201 4/22/2024
2024.0.12.11316 187 4/22/2024
2024.0.11.10220 181 4/11/2024
2024.0.11.10120 160 4/10/2024
2024.0.11.10119 158 4/10/2024
2024.0.11.10115 176 4/10/2024
2024.0.11.9914 196 4/8/2024
2024.0.11.9901 177 4/7/2024
2024.0.11.9823 177 4/7/2024
2024.0.11.9401 193 4/2/2024
2024.0.11.9301 178 4/1/2024
2024.0.11.9206 177 3/31/2024
2024.0.11.9205 168 3/31/2024
2024.0.11.8200 204 3/21/2024
2024.0.11.8122 163 3/21/2024
2024.0.11.8120 163 3/21/2024
2024.0.11.7320 225 3/13/2024
2024.0.11.7316 184 3/13/2024
2024.0.11.7310 182 3/13/2024
2024.0.11 179 3/13/2024
2024.0.10 204 3/3/2024
2024.0.9 194 2/27/2024
2024.0.8 226 2/1/2024
2024.0.7 182 1/26/2024
2024.0.6 174 1/25/2024
2024.0.5 173 1/24/2024
2024.0.4 167 1/24/2024
2024.0.3 181 1/22/2024
2024.0.2 242 1/10/2024
2024.0.1 189 1/9/2024
2024.0.1-alpha-3 161 1/9/2024
2024.0.1-alpha-2 157 1/9/2024
2024.0.1-alpha-1 180 1/3/2024
2024.0.0 226 12/26/2023
2023.0.27 239 12/21/2023
2023.0.26 208 12/21/2023
2023.0.25 229 12/11/2023
2023.0.24 216 12/8/2023
2023.0.23 192 12/6/2023
2023.0.21 287 12/4/2023
2023.0.20 252 11/27/2023
2023.0.19 208 11/20/2023
2023.0.18 223 10/25/2023
2023.0.17 264 10/22/2023
2023.0.16 293 10/16/2023
2023.0.16-alpha-1 152 10/16/2023
2023.0.15 208 10/14/2023
2023.0.14 184 10/14/2023
2023.0.13 193 10/14/2023
2023.0.12 201 10/14/2023
2023.0.11 189 10/10/2023
2023.0.10 193 10/9/2023
2023.0.9 306 8/16/2023
2023.0.8 277 8/15/2023
2023.0.8-alpha-2 316 5/31/2023
2023.0.7 653 5/12/2023
2023.0.6 400 5/10/2023
2023.0.5 261 5/7/2023
2023.0.4 296 4/22/2023
2023.0.3 338 4/19/2023
2023.0.2 334 4/6/2023
2023.0.1 313 3/13/2023
2022.10.4 400 11/9/2022
2022.10.3 457 10/19/2022
2022.10.2 544 10/19/2022
2022.10.0 530 10/16/2022
2022.7.1 569 7/18/2022

Basic infrastructure provided for authorizing User with given permission