DotNetBrightener.Infrastructure.Security 2024.0.12.15608

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.15608                
NuGet\Install-Package DotNetBrightener.Infrastructure.Security -Version 2024.0.12.15608                
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.15608" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetBrightener.Infrastructure.Security --version 2024.0.12.15608                
#r "nuget: DotNetBrightener.Infrastructure.Security, 2024.0.12.15608"                
#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.
// Install DotNetBrightener.Infrastructure.Security as a Cake Addin
#addin nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.15608

// Install DotNetBrightener.Infrastructure.Security as a Cake Tool
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.15608                

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. 
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.2-preview-277 101 a month ago
2025.0.1-rc-243301701 241 2 months ago
2024.0.14.6 135 2 months ago
2024.0.14.6-rc-243031001 189 3 months ago
2024.0.14.6-rc-243030701 119 3 months ago
2024.0.14.6-rc-242840501 111 3 months ago
2024.0.14.6-rc-242820305 115 3 months ago
2024.0.14.6-rc-242771401 249 3 months ago
2024.0.14.6-rc-242770501 107 3 months ago
2024.0.14.6-rc-242770201 126 3 months ago
2024.0.14.6-rc-242761801 115 4 months ago
2024.0.14.6-rc-242761601 128 4 months ago
2024.0.14.6-rc-242761501 113 4 months ago
2024.0.14.6-rc-242761401 116 4 months ago
2024.0.14.6-rc-242760701 130 4 months ago
2024.0.14.6-rc-242751002 119 4 months ago
2024.0.14.6-rc-242750901 126 4 months ago
2024.0.14.6-rc-242750502 116 4 months ago
2024.0.14.6-rc-242750201 115 4 months ago
2024.0.14.6-rc-242741501 112 4 months ago
2024.0.14.6-rc-242730701 140 4 months ago
2024.0.14.6-preview-2730501 113 4 months ago
2024.0.14.6-preview-2701501 145 4 months ago
2024.0.14.6-preview-2620901 170 4 months ago
2024.0.14.6-preview-2570701 133 4 months ago
2024.0.14.6-preview-2510703 211 4 months ago
2024.0.14.6-preview-2480501 153 4 months ago
2024.0.14.6-preview-2430401 174 5 months ago
2024.0.14.6-preview-242730701 114 4 months ago
2024.0.14.6-preview-2421703 138 5 months ago
2024.0.14.6-preview-2421701 127 5 months ago
2024.0.14.6-preview-2420901 123 5 months ago
2024.0.14.6-preview-2390101 158 5 months ago
2024.0.14.6-preview-2381603 150 5 months ago
2024.0.14.6-preview-2341601 177 5 months ago
2024.0.14.6-preview-2321602 157 5 months ago
2024.0.14.6-preview-2190801 177 5 months ago
2024.0.14.6-preview-2041501 132 6 months ago
2024.0.14.6-preview-1920603 200 6 months ago
2024.0.14.6-preview-1920301 130 6 months ago
2024.0.14.6-preview-1911302 137 6 months ago
2024.0.14.6-preview-1901001 160 6 months ago
2024.0.14.6-preview-1900901 155 6 months ago
2024.0.14.6-preview-1900801 126 6 months ago
2024.0.14.6-preview-1860304 140 6 months ago
2024.0.14.5 214 7 months ago
2024.0.14.5-preview-1811601 146 7 months ago
2024.0.14.5-preview-1810501 162 7 months ago
2024.0.14.5-preview-180132 169 7 months ago
2024.0.14.5-preview-180131 145 7 months ago
2024.0.14.5-preview-180121 136 7 months ago
2024.0.14.4 186 7 months ago
2024.0.14.4-preview-7 143 7 months ago
2024.0.14.3 166 7 months ago
2024.0.14.1 154 7 months ago
2024.0.14.1-preview 136 7 months ago
2024.0.14-preview-1 123 7 months ago
2024.0.13.8-preview 141 7 months ago
2024.0.13.1-preview-0146 144 7 months ago
2024.0.12.15803-preview-03 134 7 months ago
2024.0.12.15608 148 7 months ago
2024.0.12.15515 229 7 months ago
2024.0.12.15220 139 8 months ago
2024.0.12.15220-alpha31-240... 123 8 months ago
2024.0.12.14911 184 8 months ago
2024.0.12.14910-alpha28-240... 135 8 months ago
2024.0.12.14823 154 8 months ago
2024.0.12.14522-alpha7-2405... 153 8 months ago
2024.0.12.14514-alpha6-2405... 144 8 months ago
2024.0.12.14511 170 8 months ago
2024.0.12.14314 201 8 months ago
2024.0.12.14114 179 8 months ago
2024.0.12.12815 198 8 months ago
2024.0.12.12814 159 8 months ago
2024.0.12.12721 179 8 months ago
2024.0.12.12702 171 8 months ago
2024.0.12.12622 185 8 months ago
2024.0.12.12514 161 8 months ago
2024.0.12.12512 171 8 months ago
2024.0.12.12510 163 8 months ago
2024.0.12.12420 145 8 months ago
2024.0.12.12319 113 9 months ago
2024.0.12.12319-rc-2405021801 102 9 months ago
2024.0.12.12318 121 9 months ago
2024.0.12.12215 151 9 months ago
2024.0.12.12011 153 9 months ago
2024.0.12.11720 166 9 months ago
2024.0.12.11719 152 9 months ago
2024.0.12.11621 188 9 months ago
2024.0.12.11523 155 9 months ago
2024.0.12.11522 158 9 months ago
2024.0.12.11417 180 9 months ago
2024.0.12.11400 181 9 months ago
2024.0.12.11316 167 9 months ago
2024.0.11.10220 156 9 months ago
2024.0.11.10120 138 9 months ago
2024.0.11.10119 136 9 months ago
2024.0.11.10115 156 9 months ago
2024.0.11.9914 173 9 months ago
2024.0.11.9901 154 9 months ago
2024.0.11.9823 156 9 months ago
2024.0.11.9401 171 10 months ago
2024.0.11.9301 155 10 months ago
2024.0.11.9206 157 10 months ago
2024.0.11.9205 145 10 months ago
2024.0.11.8200 184 10 months ago
2024.0.11.8122 142 10 months ago
2024.0.11.8120 142 10 months ago
2024.0.11.7320 204 3/13/2024
2024.0.11.7316 163 3/13/2024
2024.0.11.7310 159 3/13/2024
2024.0.11 159 3/13/2024
2024.0.10 179 3/3/2024
2024.0.9 172 2/27/2024
2024.0.8 208 2/1/2024
2024.0.7 164 1/26/2024
2024.0.6 153 1/25/2024
2024.0.5 149 1/24/2024
2024.0.4 145 1/24/2024
2024.0.3 160 1/22/2024
2024.0.2 224 1/10/2024
2024.0.1 168 1/9/2024
2024.0.1-alpha-3 151 1/9/2024
2024.0.1-alpha-2 148 1/9/2024
2024.0.1-alpha-1 170 1/3/2024
2024.0.0 208 12/26/2023
2023.0.27 218 12/21/2023
2023.0.26 188 12/21/2023
2023.0.25 211 12/11/2023
2023.0.24 195 12/8/2023
2023.0.23 180 12/6/2023
2023.0.21 260 12/4/2023
2023.0.20 237 11/27/2023
2023.0.19 200 11/20/2023
2023.0.18 213 10/25/2023
2023.0.17 255 10/22/2023
2023.0.16 281 10/16/2023
2023.0.16-alpha-1 142 10/16/2023
2023.0.15 200 10/14/2023
2023.0.14 175 10/14/2023
2023.0.13 181 10/14/2023
2023.0.12 191 10/14/2023
2023.0.11 179 10/10/2023
2023.0.10 184 10/9/2023
2023.0.9 290 8/16/2023
2023.0.8 262 8/15/2023
2023.0.8-alpha-2 295 5/31/2023
2023.0.7 626 5/12/2023
2023.0.6 280 5/10/2023
2023.0.5 238 5/7/2023
2023.0.4 270 4/22/2023
2023.0.3 316 4/19/2023
2023.0.2 305 4/6/2023
2023.0.1 286 3/13/2023
2022.10.4 372 11/9/2022
2022.10.3 429 10/19/2022
2022.10.2 496 10/19/2022
2022.10.0 482 10/16/2022
2022.7.1 513 7/18/2022

Basic infrastructure provided for authorizing User with given permission