Paralax.Auth - A framework for authentication in microservices architecture
$ dotnet add package Paralax.AuthParalax.Auth is a lightweight, extensible authentication module for the Paralax microservices framework, providing JWT-based authentication, token validation, and optional authentication bypass for development and internal scenarios.
It is designed for modern .NET microservices, with first-class support for ASP.NET Core, JWT Bearer authentication, and scalable distributed architectures.
Install from NuGet:
dotnet add package Paralax.Auth
builder.AddParalax()
.AddJwt();
By default, configuration is read from the jwt section in your configuration files.
app.UseAuthentication();
app.UseAuthorization();
app.UseAccessTokenValidator();
"jwt": {
"issuer": "paralax-auth",
"issuerSigningKey": "very_secure_secret_key_123456",
"expiryMinutes": 60,
"validateIssuer": true,
"validateAudience": false
}
"jwt": {
"issuer": "paralax-auth",
"certificate": {
"location": "certs/jwt-signing.pfx",
"password": "cert-password"
},
"expiryMinutes": 60
}
You may also provide the certificate as Base64 (rawData) instead of a file path.
| Option | Description |
|---|---|
Issuer | Token issuer |
ValidIssuer(s) | Allowed token issuers |
IssuerSigningKey | Symmetric signing key |
Certificate | X.509 certificate for signing |
Algorithm | Security algorithm (default auto-selected) |
Expiry / ExpiryMinutes | Token lifetime |
ValidateLifetime | Enable expiration validation |
ValidateAudience | Enable audience validation |
ValidAudience(s) | Allowed audiences |
AuthenticationDisabled | Disable authentication entirely |
AllowAnonymousEndpoints | Paths excluded from validation |
Inject IJwtHandler and generate tokens programmatically:
public class AuthService
{
private readonly IJwtHandler _jwtHandler;
public AuthService(IJwtHandler jwtHandler)
{
_jwtHandler = jwtHandler;
}
public string CreateToken(string userId)
{
return _jwtHandler.CreateToken(userId).AccessToken;
}
}
Supports:
JWT validation is handled by ASP.NET Core authentication middleware.
Paralax.Auth includes an in-memory token blacklist:
await accessTokenService.DeactivateCurrentAsync();
Once revoked, the token becomes invalid until it expires.
⚠️ In-memory storage is per-instance. For distributed systems, use a shared cache (e.g. Redis) via a custom
IAccessTokenService.
"jwt": {
"authenticationDisabled": true
}
This bypasses authentication entirely while preserving the request pipeline.
⚠️ Never enable this in production.
Exclude selected paths from token validation:
"jwt": {
"allowAnonymousEndpoints": [
"/health",
"/metrics",
"/swagger"
]
}
AddJwtThe design follows SOLID principles and is fully extensible.
| .NET Version |
|---|
| .NET 8.0 |
| .NET 9.0 |
Licensed under the Apache License 2.0.
See LICENSE.
✅ Microservices ✅ Internal APIs ✅ Gateway authentication ✅ Stateless JWT authentication ✅ Paralax-based systems
Contributions are welcome.
Repository: 👉 https://github.com/ITSharpPro/Paralax
ITSharpPro 🌐 https://itsharppro.com
Andrii Voznesenskyi GitHub: https://github.com/SaintAngeLs
Paralax.Auth is intentionally simple, explicit, and predictable. It provides full control over authentication without unnecessary abstractions.
If you need:
You can extend it cleanly without breaking the core.
Happy building 🚀