DotNetBrightener.Infrastructure.Security
2024.0.12.14522-alpha7-24052422
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
<PackageReference Include="DotNetBrightener.Infrastructure.Security" Version="2024.0.12.14522-alpha7-24052422" />
paket add DotNetBrightener.Infrastructure.Security --version 2024.0.12.14522-alpha7-24052422
#r "nuget: DotNetBrightener.Infrastructure.Security, 2024.0.12.14522-alpha7-24052422"
// Install DotNetBrightener.Infrastructure.Security as a Cake Addin
#addin nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.14522-alpha7-24052422&prerelease
// Install DotNetBrightener.Infrastructure.Security as a Cake Tool
#tool nuget:?package=DotNetBrightener.Infrastructure.Security&version=2024.0.12.14522-alpha7-24052422&prerelease
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
- Register the Permission System to
IServiceCollection
serviceCollection.AddPermissionAuthorization();
- 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
- Authorize with
IAuthorizationService
var authorizationResult = await IAuthorizationService.AuthorizePermissionAsync(user, permissionKey);
- 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 | Versions 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. |
-
net8.0
- DotNetBrightener.CryptoEngine (>= 2024.0.12.14522-alpha7-24052422)
- Newtonsoft.Json (>= 13.0.3)
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 |
---|---|---|
2024.0.14.1 | 92 | 6/6/2024 |
2024.0.14.1-preview | 78 | 6/6/2024 |
2024.0.14-preview-1 | 77 | 6/6/2024 |
2024.0.13.8-preview | 85 | 6/6/2024 |
2024.0.13.1-preview-0146 | 85 | 6/6/2024 |
2024.0.12.15803-preview-03 | 83 | 6/6/2024 |
2024.0.12.15608 | 88 | 6/4/2024 |
2024.0.12.15515 | 117 | 6/3/2024 |
2024.0.12.15220 | 77 | 5/31/2024 |
2024.0.12.15220-alpha31-240... | 70 | 5/31/2024 |
2024.0.12.14911 | 123 | 5/28/2024 |
2024.0.12.14910-alpha28-240... | 84 | 5/28/2024 |
2024.0.12.14823 | 95 | 5/27/2024 |
2024.0.12.14522-alpha7-2405... | 98 | 5/24/2024 |
2024.0.12.14514-alpha6-2405... | 93 | 5/24/2024 |
2024.0.12.14511 | 110 | 5/24/2024 |
2024.0.12.14314 | 146 | 5/22/2024 |
2024.0.12.14114 | 115 | 5/20/2024 |
2024.0.12.12815 | 136 | 5/7/2024 |
2024.0.12.12814 | 105 | 5/7/2024 |
2024.0.12.12721 | 123 | 5/6/2024 |
2024.0.12.12702 | 115 | 5/5/2024 |
2024.0.12.12622 | 128 | 5/5/2024 |
2024.0.12.12514 | 105 | 5/4/2024 |
2024.0.12.12512 | 104 | 5/4/2024 |
2024.0.12.12510 | 106 | 5/4/2024 |
2024.0.12.12420 | 88 | 5/3/2024 |
2024.0.12.12319 | 60 | 5/2/2024 |
2024.0.12.12319-rc-2405021801 | 54 | 5/2/2024 |
2024.0.12.12318 | 63 | 5/2/2024 |
2024.0.12.12215 | 92 | 5/1/2024 |
2024.0.12.12011 | 100 | 4/29/2024 |
2024.0.12.11720 | 111 | 4/26/2024 |
2024.0.12.11719 | 102 | 4/26/2024 |
2024.0.12.11621 | 126 | 4/25/2024 |
2024.0.12.11523 | 101 | 4/24/2024 |
2024.0.12.11522 | 108 | 4/24/2024 |
2024.0.12.11417 | 124 | 4/23/2024 |
2024.0.12.11400 | 127 | 4/22/2024 |
2024.0.12.11316 | 111 | 4/22/2024 |
2024.0.11.10220 | 102 | 4/11/2024 |
2024.0.11.10120 | 94 | 4/10/2024 |
2024.0.11.10119 | 89 | 4/10/2024 |
2024.0.11.10115 | 97 | 4/10/2024 |
2024.0.11.9914 | 122 | 4/8/2024 |
2024.0.11.9901 | 99 | 4/7/2024 |
2024.0.11.9823 | 111 | 4/7/2024 |
2024.0.11.9401 | 115 | 4/2/2024 |
2024.0.11.9301 | 102 | 4/1/2024 |
2024.0.11.9206 | 104 | 3/31/2024 |
2024.0.11.9205 | 100 | 3/31/2024 |
2024.0.11.8200 | 124 | 3/21/2024 |
2024.0.11.8122 | 89 | 3/21/2024 |
2024.0.11.8120 | 90 | 3/21/2024 |
2024.0.11.7320 | 131 | 3/13/2024 |
2024.0.11.7316 | 106 | 3/13/2024 |
2024.0.11.7310 | 107 | 3/13/2024 |
2024.0.11 | 106 | 3/13/2024 |
2024.0.10 | 130 | 3/3/2024 |
2024.0.9 | 113 | 2/27/2024 |
2024.0.8 | 149 | 2/1/2024 |
2024.0.7 | 105 | 1/26/2024 |
2024.0.6 | 104 | 1/25/2024 |
2024.0.5 | 91 | 1/24/2024 |
2024.0.4 | 94 | 1/24/2024 |
2024.0.3 | 110 | 1/22/2024 |
2024.0.2 | 171 | 1/10/2024 |
2024.0.1 | 108 | 1/9/2024 |
2024.0.1-alpha-3 | 91 | 1/9/2024 |
2024.0.1-alpha-2 | 95 | 1/9/2024 |
2024.0.1-alpha-1 | 112 | 1/3/2024 |
2024.0.0 | 161 | 12/26/2023 |
2023.0.27 | 169 | 12/21/2023 |
2023.0.26 | 129 | 12/21/2023 |
2023.0.25 | 161 | 12/11/2023 |
2023.0.24 | 144 | 12/8/2023 |
2023.0.23 | 134 | 12/6/2023 |
2023.0.21 | 196 | 12/4/2023 |
2023.0.20 | 187 | 11/27/2023 |
2023.0.19 | 150 | 11/20/2023 |
2023.0.18 | 161 | 10/25/2023 |
2023.0.17 | 206 | 10/22/2023 |
2023.0.16 | 220 | 10/16/2023 |
2023.0.16-alpha-1 | 91 | 10/16/2023 |
2023.0.15 | 148 | 10/14/2023 |
2023.0.14 | 120 | 10/14/2023 |
2023.0.13 | 123 | 10/14/2023 |
2023.0.12 | 139 | 10/14/2023 |
2023.0.11 | 127 | 10/10/2023 |
2023.0.10 | 139 | 10/9/2023 |
2023.0.9 | 229 | 8/16/2023 |
2023.0.8 | 201 | 8/15/2023 |
2023.0.8-alpha-2 | 243 | 5/31/2023 |
2023.0.7 | 557 | 5/12/2023 |
2023.0.6 | 224 | 5/10/2023 |
2023.0.5 | 182 | 5/7/2023 |
2023.0.4 | 216 | 4/22/2023 |
2023.0.3 | 256 | 4/19/2023 |
2023.0.2 | 248 | 4/6/2023 |
2023.0.1 | 236 | 3/13/2023 |
2022.10.4 | 335 | 11/9/2022 |
2022.10.3 | 391 | 10/19/2022 |
2022.10.2 | 462 | 10/19/2022 |
2022.10.0 | 444 | 10/16/2022 |
2022.7.1 | 476 | 7/18/2022 |
Basic infrastructure provided for authorizing User with given permission