ComplianceFactory.Cootje.Middleware
1.0.24
dotnet add package ComplianceFactory.Cootje.Middleware --version 1.0.24
NuGet\Install-Package ComplianceFactory.Cootje.Middleware -Version 1.0.24
<PackageReference Include="ComplianceFactory.Cootje.Middleware" Version="1.0.24" />
<PackageVersion Include="ComplianceFactory.Cootje.Middleware" Version="1.0.24" />
<PackageReference Include="ComplianceFactory.Cootje.Middleware" />
paket add ComplianceFactory.Cootje.Middleware --version 1.0.24
#r "nuget: ComplianceFactory.Cootje.Middleware, 1.0.24"
#:package ComplianceFactory.Cootje.Middleware@1.0.24
#addin nuget:?package=ComplianceFactory.Cootje.Middleware&version=1.0.24
#tool nuget:?package=ComplianceFactory.Cootje.Middleware&version=1.0.24
Auth Middleware
Cootje Auth Middleware and RequestExtensions used for easy security integration with connected API's
Installation
Install the package via NuGet package manager:
Install-Package ComplianceFactory.Cootje.Middleware -Version 0.0.1
Usage
1. In program startup register the middleware
This will automatically protect all your controller endpoints by:
- Checking for the Authorization header
- Communicating with AUTH API for validation and token decryption
- Decrypting the token and attaching decrypted user to HttpContext
In Program Startup:
app.UseMiddleware<ComplianceFactory.Cootje.Middleware.ComplianceFactoryAuthMiddleware>("http://AUTH_URI:8080");
2. Read user from request in controller
In order to read the user from a request, an extensionmethod can be used from the package ComplianceFactory.Cootje.Middleware
using ComplianceFactory.Cootje.Middleware;
...
public IActionResult Get() {
var user = Request.GetUser();
}
3. Protect controllers by Roles
Add the AuthorizeRolesAttribute to the method attribute. Multiple roles can be added, if any is in the user roles, the request is allowed.
using ComplianceFactory.Cootje.Roles;
using ComplianceFactory.Cootje.Middleware.AuthorizationAttributes;
...
[AuthorizeRoles([ComplianceFactoryRoles.EnvironmentOwer, ComplianceFactoryRoles.Professional])]
public IActionResult Get() {
...
}
| 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. 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ComplianceFactory.Cootje.Middleware:
| Package | Downloads |
|---|---|
|
ComplianceFactory.Cootje.Logger
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.24 | 236 | 6/17/2025 |
| 1.0.23 | 201 | 6/16/2025 |
| 1.0.22 | 500 | 3/5/2025 |
| 1.0.21 | 413 | 2/3/2025 |
| 1.0.20 | 478 | 11/30/2024 |
| 1.0.19 | 285 | 10/22/2024 |
| 1.0.18 | 413 | 7/5/2024 |
| 1.0.17 | 195 | 7/5/2024 |
| 1.0.16 | 178 | 7/4/2024 |
| 1.0.15 | 209 | 7/4/2024 |
| 1.0.14 | 221 | 6/27/2024 |
| 1.0.13 | 178 | 6/27/2024 |
| 1.0.12 | 181 | 6/27/2024 |
| 1.0.11 | 193 | 6/27/2024 |
| 1.0.10 | 186 | 6/27/2024 |
| 1.0.9 | 184 | 6/27/2024 |
| 1.0.8 | 178 | 6/26/2024 |
| 1.0.7 | 187 | 6/26/2024 |
| 1.0.6 | 176 | 6/26/2024 |
| 1.0.5 | 319 | 6/5/2024 |