Linbik.JwtAuthManager
1.2.7
See the version list below for details.
dotnet add package Linbik.JwtAuthManager --version 1.2.7
NuGet\Install-Package Linbik.JwtAuthManager -Version 1.2.7
<PackageReference Include="Linbik.JwtAuthManager" Version="1.2.7" />
<PackageVersion Include="Linbik.JwtAuthManager" Version="1.2.7" />
<PackageReference Include="Linbik.JwtAuthManager" />
paket add Linbik.JwtAuthManager --version 1.2.7
#r "nuget: Linbik.JwtAuthManager, 1.2.7"
#:package Linbik.JwtAuthManager@1.2.7
#addin nuget:?package=Linbik.JwtAuthManager&version=1.2.7
#tool nuget:?package=Linbik.JwtAuthManager&version=1.2.7
Linbik.JwtAuthManager
JWT Authentication Manager for Linbik Framework. Provides cookie-based login/logout endpoints, RSA-256 JWT validation, and rate limiting.
π¦ Installation
dotnet add package Linbik.JwtAuthManager
π Features
- Cookie-Based JWT Auth β Login, logout, and token refresh via minimal API endpoints
- RSA-256 JWT Signing β Industry-standard asymmetric cryptography
- PKCE Support β Proof Key for Code Exchange for public clients
- Rate Limiting β Configurable
LinbikAuth,LinbikGeneral, andLinbikStrictpolicies - Multi-Client Support β Web, Mobile, Admin via
Clientsconfiguration - Keyless Mode β Zero-config development with auto-provisioning
- LinbikAuthorize Attribute β Protect endpoints with
[LinbikAuthorize]
π§ Configuration
Fluent Builder (Recommended)
// In Program.cs
using Linbik.Core.Extensions;
using Linbik.JwtAuthManager.Extensions;
var builder = WebApplication.CreateBuilder(args);
// 1. Add Linbik services
builder.Services.AddLinbik()
.AddLinbikJwtAuth();
var app = builder.Build();
// 2. Validate configuration at startup
app.EnsureLinbik();
// 3. if using controllers, add this.
app.UseRouting();
// 4. Add authentication and authorization middleware
app.UseAuthentication();
app.UseAuthorization();
// 5. Map endpoints: /api/linbik/login, /api/linbik/logout, /api/linbik/refresh
app.UseLinbikJwtAuth();
app.Run();
π Configure JWT Authentication
Choose one of the following approaches:
// Default configuration
AddLinbikJwtAuth();
// From configuration
AddLinbikJwtAuth(builder.Configuration.GetSection("Linbik:JwtAuth"));
// Fluent configuration
AddLinbikJwtAuth(opt => { });
Endpoints
| Path | Method | Description |
|---|---|---|
/api/Linbik/login |
GET | Initiate OAuth flow β exchange code β set cookies |
/api/Linbik/callback |
GET | OAuth callback for code exchange |
/api/Linbik/logout |
GET | Clear all auth cookies |
/api/Linbik/refresh |
POST | Refresh tokens using refresh cookie |
β οΈ Login/callback/logout/refresh error paths currently crash with a
NotImplementedExceptioninstead of returning a response β seePROJECT_STATUS.mdKnown Issues.Linbik.PasetoAuthManager's equivalent handler is the reference fix.
π» Usage
Protect Endpoints
[LinbikAuthorize]
[HttpGet]
public IActionResult Protected()
{
var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return Ok(new { userId });
}
or with minimal APIs:
app.MapGet("/protected", [LinbikAuthorize] (ClaimsPrincipal user) =>
{
var userId = user.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return Results.Ok(new { userId });
});
app.MapGet("/protected", (HttpContext context) =>
{
var userId = context.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return Results.Ok(new { userId });
})
.RequireAuthorization("LinbikAuthorize");
Access Integration Tokens
// Get a specific integration token from cookies
var paymentToken = HttpContext.GetIntegrationToken("payment-gateway");
// Check if user has any integrations
var hasIntegrations = HttpContext.HasIntegrations();
π Rate Limiting
Rate limiting is shared through Linbik.Core.Extensions. All overloads of AddLinbikRateLimiting, including the parameterless overload, register the policies.
// In Program.cs
builder.Services.AddLinbikRateLimiting(builder.Configuration.GetSection("Linbik:RateLimiting"));
// In middleware pipeline
app.UseLinbikRateLimiting();
{
"Linbik": {
"RateLimiting": {
"PermitLimit": 100,
"WindowSeconds": 60,
"QueueLimit": 2
},
"Resilience": {
"StrictTokenLimit": 10,
"StrictReplenishmentPeriodSeconds": 60,
"StrictTokensPerPeriod": 5,
"StrictQueueLimit": 0
}
}
}
Rate Limiting Policies
| Policy | Use Case |
|---|---|
LinbikAuth |
Login and logout endpoints (fixed/sliding window) |
LinbikStrict |
Callback and refresh endpoints β token exchange (token-bucket) |
LinbikGeneral |
Registered for general-purpose use in your own endpoints (more permissive fixed window) |
[EnableRateLimiting("LinbikAuth")]
public IActionResult RateLimitedAction() => Ok();
π Documentation
- Full Documentation
- Examples
- Linbik.Core
- Linbik.PasetoAuthManager
- Linbik.Server
- Linbik.YARP
- Linbik.Slices
π License
MIT License
Contact: info@linbik.com
Version: 1.2.0
Platform: ASP.NET Core 10.0 (net10.0)
Last Updated: 9 EylΓΌl 2026
Local refresh tokens
After a successful callback, an upstream Linbik refresh token is used unchanged.
When none is returned, AuthManager creates a cryptographically random local refresh
token and stores only its SHA-256 hash and the authenticated user's profile.
POST the configured RefreshPath (default /api/Linbik/refresh) to renew either kind.
Local refresh does not call Linbik or mint integration tokens. Upstream failures never
fall back to local sessions. Core's IAuthService is an upstream API helper, not
this AuthManager refresh endpoint; do not use it to renew local sessions.
Local tokens rotate atomically on every use. Reusing a consumed token revokes the whole session. Clients must serialize refresh requests (including across browser tabs). The absolute session expiry is established at login using RefreshTokenExpirationDays and is not extended by rotation. LogoutPath revokes the local refresh session and clears cookies; already-issued access tokens remain valid until their own expiry.
The default InMemoryLinbikRefreshTokenStore is process-local. Restarting loses all local refresh sessions. It cannot support multiple application instances. Expired entries are evicted by MemoryCache. No database driver or new package is required. AuthManager.Shared is linked source compiled into each existing AuthManager assembly; its public types live under the selected AuthManager's Services namespace.
To use application-owned storage, implement ILinbikRefreshTokenStore and register it AFTER AddLinbikJwtAuth / AddLinbikPasetoAuth (or before, since defaults use TryAdd):
// using Linbik.PasetoAuthManager.Services; // or Linbik.JwtAuthManager.Services
builder.Services.AddScoped<ILinbikRefreshTokenStore, MyRefreshTokenStore>();
CreateAsync must persist hashes and immutable session data. RotateAsync must perform expiry/revocation validation and replacement atomically, retain consumed hashes until session expiry to detect reuse, and revoke all replacements when reuse is detected. RevokeAsync must invalidate the entire session even when passed an older hash. Persisting a custom store also requires stable access-token signing keys across restarts. Keep those keys in application secret configuration, never source control.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Linbik.Core (>= 1.2.7)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.12)
- System.IdentityModel.Tokens.Jwt (>= 8.22.0)
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.2.8 | 98 | 9/20/2026 |
| 1.2.7 | 103 | 9/10/2026 |
| 1.2.5 | 105 | 9/7/2026 |
| 1.2.3 | 97 | 9/1/2026 |
| 1.2.1 | 140 | 7/16/2026 |
| 1.2.0-preview.3 | 72 | 5/30/2026 |
| 1.2.0-preview.2 | 104 | 4/26/2026 |
| 1.2.0-preview.1 | 126 | 4/2/2026 |
| 1.1.0 | 419 | 12/5/2025 |
| 1.1.0-beta0007 | 124 | 3/6/2026 |
| 1.0.7 | 173 | 3/6/2026 |
| 1.0.1 | 251 | 12/14/2025 |
| 1.0.0 | 114 | 3/6/2026 |
| 0.60.1 | 123 | 3/6/2026 |
| 0.46.0 | 389 | 11/30/2025 |
| 0.45.12 | 385 | 11/30/2025 |
| 0.45.7 | 271 | 8/31/2025 |
| 0.45.6 | 243 | 8/31/2025 |
| 0.45.5 | 257 | 8/27/2025 |
| 0.44.0 | 273 | 8/24/2025 |