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" />
                    
Directory.Packages.props
<PackageReference Include="Kllmp.Org.Soptec.Library" />
                    
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 Kllmp.Org.Soptec.Library --version 1.0.3
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Kllmp.Org.Soptec.Library&version=1.0.3
                    
Install as a Cake Tool

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 claim sub y 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 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 114 4/14/2026
1.0.2 108 4/13/2026
1.0.0 103 4/11/2026