Kllmp.Org.Soptec.Library
1.0.3
dotnet add package Kllmp.Org.Soptec.Library --version 1.0.3
NuGet\Install-Package Kllmp.Org.Soptec.Library -Version 1.0.3
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="Kllmp.Org.Soptec.Library" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kllmp.Org.Soptec.Library" Version="1.0.3" />
<PackageReference Include="Kllmp.Org.Soptec.Library" />
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 Kllmp.Org.Soptec.Library --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Kllmp.Org.Soptec.Library, 1.0.3"
#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 Kllmp.Org.Soptec.Library@1.0.3
#: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=Kllmp.Org.Soptec.Library&version=1.0.3
#tool nuget:?package=Kllmp.Org.Soptec.Library&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Kllmp.Org.Soptec.Library
Librería de seguridad para ASP.NET Core que implementa filtros de autorización personalizados para la validación de tokens RSA y encabezados de acceso.
Características
- Validación de Token RSA: Verifica un token en el encabezado
token, desencriptando el claimsuby validando la expiración. - Validación de Access ID: Verifica encabezados personalizados mediante expresiones regulares configurables.
- Respuestas Estandarizadas: Devuelve errores consistentes mediante la clase
ErrorBase.
Configuración
En tu archivo Program.cs, configura el servicio y las opciones necesarias:
using Kllmp.Org.Soptec.Library;
var builder = WebApplication.CreateBuilder(args);
var options = new ValidationTokenSoptecOptions {
AppName = "TuProyecto",
PrivatePem = "...", // Llave privada RSA
SecretWord = "PalabraDeValidacion",
FieldAccessId = "X-Access-Id",
PatternForFieldAccessId = "^[0-9]+$"
};
builder.Services.AddSingleton(options);
builder.Services.AddScoped<IValidationTokenSoptec, ValidationTokenSoptec>();
Uso
Aplica los filtros como atributos en tus controladores o acciones:
1. Validar Token de Sesión
El filtro [FilterToken] busca el header token.
[FilterToken]
[HttpGet]
public IActionResult Get() => Ok();
2. Validar ID de Acceso
El filtro [FilterAccessId] busca el header definido en la configuración y lo valida contra el Regex.
[FilterAccessId]
[HttpPost]
public IActionResult Post() => Ok();
Requisitos
- .NET 8.0 o superior.
- Newtonsoft.Json.
- Una librería con RSA como
Kllmp.Org.Security.
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Kllmp.Org.Security (>= 1.0.2)
- Microsoft.AspNetCore.Mvc.Abstractions (>= 2.3.9)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.