SecureCore Auth es una solución de identidad y gestión de sesiones modular, agnóstica a la base de datos y diseñada para aplicaciones .NET modernas que requieren un equilibrio entre ligereza y robustez.
- Seguridad Moderna: Soporte nativo y prioritario para Passkeys (WebAuthn) y biometría.
- Control Total de Sesión: Gestión activa de Refresh Tokens con rotación (RTR) y capacidad de revocación global instántanea.
- Desacoplamiento Absoluto: Tú decides dónde y cómo guardas tus datos. La librería dicta la lógica, no la infraestructura.
- Resistencia por Diseño: Mitigaciones nativas contra ataques de enumeración y fuerza bruta.
El framework está dividido en componentes independientes para que solo instales lo que necesites:
- SecureCore.Auth.Abstractions: Contratos, interfaces y modelos base. Sin dependencias.
- SecureCore.Auth.Core: El motor de orquestación, lógica de JWT, hashing (Argon2id) y MFA.
- SecureCore.Auth.WebAuthn: Soporte para llaves físicas y biometría (FIDO2).
- SecureCore.Auth.AspNetCore: Integración fluida con el pipeline de ASP.NET Core (Middleware y Endpoints).
- SecureCore.Auth.OAuth: Orquestación OAuth2/OIDC y persistencia de tokens de proveedor.
- SecureCore.Auth.OAuth.{Apple, Facebook, GitHub, Google, LinkedIn, Microsoft, TikTok}: Validadores específicos por proveedor (JWKS, nonce anti-replay,
appsecret_proof).
Agrega los paquetes necesarios a tu proyecto:
dotnet add package SecureCore.Auth.AspNetCore
dotnet add package SecureCore.Auth.CoreRegistra los servicios y configura las opciones de seguridad:
builder.Services.AddSecureAuth(options => {
options.Issuer = "tu-dominio.com";
options.Audience = "tu-app";
options.SigningKey = builder.Configuration["Jwt:Key"];
})
.AddPasswordAuthentication()
.AddWebAuthn(); // Opcional
var app = builder.Build();
app.UseAuthentication();
app.UseSecureAuthValidation(); // Validación activa de sesiones
app.UseAuthorization();
app.MapSecureAuthEndpoints("/auth"); // Mapea login, refresh, logout automáticamente- Argon2id: Hashing de contraseñas de última generación.
- Passkeys / WebAuthn (primera clase): Ceremonias de registro y login completas (challenge single-use atómico, origin check fail-closed, anti-enumeración, rate limiting por IP y tope de payload propio).
- Passwordless-first (A-25): Contraseña nullable de primera clase;
SignInWithPasswordAsync(email, null)→PasswordlessRequiresCredential(sin oráculo de enumeración);GET /auth/meexponehasPassword; claimsamrpor método (pwd|webauthn|oauth|mfa, RFC 8176, opt-inEmitAmr). - Recovery codes de primera clase: Generación, verificación (peek no consumidor) y redención single-use atómico; solo se persisten hashes SHA-256; expiración configurable; scope anti-abuso propio.
- Anti-abuso por cuenta (S1): Lockout multi-scope, temporal y escalonado (contraseña, MFA, passkey, recovery, verify-action), distribuible por SPI, default in-memory.
- Refresh Token Rotation (RTR): Protege contra el robo de tokens; con periodo de gracia real para condiciones de carrera y preservación del aseguramiento (
amr/mfa_method) en la rotación. - Security Stamp Versioning (SSV): Permite invalidar todas las sesiones de un usuario de forma inmediata (Panic Button).
- MFA + step-up (S3): TOTP (RFC 6238), códigos por email, ventana
mfa_verified, verify-action y creación/cambio de contraseña con re-emisión de tokens. - Constant-Time Verification: Previene ataques de tiempo durante la validación de credenciales (Argon2 dummy, nonce OIDC, OTP).
- Anti-replay y single-use atómico (S2): Primitiva transversal "consumir una vez" para OAuth state, challenges WebAuthn, OTP y recovery codes (extensible a GETDEL/Lua en Redis).
- OAuth2/OIDC: Login social (Google, Microsoft, Apple, GitHub, Facebook, LinkedIn, TikTok) con validación criptográfica de JWKS y
client_secretnunca en URLs. - Blacklist de access tokens opt-in (A-24):
ITokenBlacklist(default no-op) — el host puede revocar eljtidel access token en el logout con TTL = vida restante. - Protección anti-DoS: Límites de payload en endpoints anónimos y rate limiting por IP (login, forgot-password, WebAuthn, recovery codes).
Para más detalles, consulta la documentación extendida:
Las contribuciones son bienvenidas. Asegúrate de seguir los estándares de código y mantener una cobertura de pruebas superior al 90%.
Desarrollado con ❤️ por el equipo de SecureCore.
SecureCore Auth is a modular, database-agnostic identity and session management solution designed for modern .NET applications that need a balance between lightness and robustness.
- Modern Security: Native, prioritized support for Passkeys (WebAuthn) and biometrics.
- Full Session Control: Active Refresh Token management with rotation (RTR) and instant global revocation.
- Total Decoupling: You decide where and how you store your data. The library dictates the logic, not the infrastructure.
- Security by Design: Built-in mitigations against enumeration and brute-force attacks.
The framework is split into independent components so you only install what you need:
- SecureCore.Auth.Abstractions: Contracts, interfaces and base models. No dependencies.
- SecureCore.Auth.Core: The orchestration engine, JWT logic, hashing (Argon2id) and MFA.
- SecureCore.Auth.WebAuthn: Support for security keys and biometrics (FIDO2).
- SecureCore.Auth.AspNetCore: Seamless integration with the ASP.NET Core pipeline (Middleware & Endpoints).
- SecureCore.Auth.OAuth: OAuth2/OIDC orchestration and provider token persistence.
- SecureCore.Auth.OAuth.{Apple, Facebook, GitHub, Google, LinkedIn, Microsoft, TikTok}: Provider-specific validators (JWKS, anti-replay nonce,
appsecret_proof).
Add the required packages to your project:
dotnet add package SecureCore.Auth.AspNetCore
dotnet add package SecureCore.Auth.CoreRegister the services and configure the security options:
builder.Services.AddSecureAuth(options => {
options.Issuer = "your-domain.com";
options.Audience = "your-app";
options.SigningKey = builder.Configuration["Jwt:Key"];
})
.AddPasswordAuthentication()
.AddWebAuthn(); // Optional
var app = builder.Build();
app.UseAuthentication();
app.UseSecureAuthValidation(); // Active session validation
app.UseAuthorization();
app.MapSecureAuthEndpoints("/auth"); // Maps login, refresh, logout automatically- Argon2id: State-of-the-art password hashing.
- Passkeys / WebAuthn (first-class): Full register/login ceremonies (atomic single-use challenge, fail-closed origin check, anti-enumeration, per-IP rate limiting and dedicated payload cap).
- Passwordless-first (A-25): First-class nullable password;
SignInWithPasswordAsync(email, null)→PasswordlessRequiresCredential(no enumeration oracle);GET /auth/meexposeshasPassword; per-methodamrclaims (pwd|webauthn|oauth|mfa, RFC 8176, opt-inEmitAmr). - First-class recovery codes: Generation, non-consuming verification and atomic single-use redemption; only SHA-256 hashes persisted; configurable expiry; dedicated anti-abuse scope.
- Per-account abuse prevention (S1): Multi-scope, time-based, escalating lockout (password, MFA, passkey, recovery, verify-action), distributable via SPI, in-memory default.
- Refresh Token Rotation (RTR): Protects against token theft; with a real grace period for client races and session assurance (
amr/mfa_method) preserved across rotation. - Security Stamp Versioning (SSV): Invalidate all of a user's sessions instantly (Panic Button).
- MFA + step-up (S3): TOTP (RFC 6238), email codes,
mfa_verifiedwindow, verify-action, and create/change password with token re-issuance. - Constant-Time Verification: Prevents timing attacks during credential validation (Argon2 dummy, OIDC nonce, OTP).
- Atomic anti-replay / single-use (S2): Cross-cutting "consume once" primitive for OAuth state, WebAuthn challenges, OTP and recovery codes (extensible to Redis GETDEL/Lua).
- OAuth2/OIDC: Social login (Google, Microsoft, Apple, GitHub, Facebook, LinkedIn, TikTok) with cryptographic JWKS validation and
client_secretnever in URLs. - Opt-in access-token blacklist (A-24):
ITokenBlacklist(no-op default) — hosts can revoke the access token'sjtion logout with TTL = remaining lifetime. - Anti-DoS: Payload limits on anonymous endpoints and per-IP rate limiting (login, forgot-password, WebAuthn, recovery codes).
For more details, check the extended documentation:
Contributions are welcome. Please follow the coding standards and keep test coverage above 90%.
Built with ❤️ by the SecureCore team.