Linbik.Core
1.0.7
See the version list below for details.
dotnet add package Linbik.Core --version 1.0.7
NuGet\Install-Package Linbik.Core -Version 1.0.7
<PackageReference Include="Linbik.Core" Version="1.0.7" />
<PackageVersion Include="Linbik.Core" Version="1.0.7" />
<PackageReference Include="Linbik.Core" />
paket add Linbik.Core --version 1.0.7
#r "nuget: Linbik.Core, 1.0.7"
#:package Linbik.Core@1.0.7
#addin nuget:?package=Linbik.Core&version=1.0.7
#tool nuget:?package=Linbik.Core&version=1.0.7
Linbik.Core
Core library for the Linbik Authentication Framework with Authorization Code Flow support.
🚀 Features
Authorization Code Support (v2.0+)
- Authorization Code Flow with PKCE support
- Multi-Service Integration - Issue multiple JWT tokens in single response
- Refresh Token Management - Long-lived token renewal
- Per-Service RSA Keys - Each service gets its own key pair
- Service Repository - Manage service registration and validation
- Rate Limiting - Built-in protection against abuse
- HTTP Resilience - Polly-based retry policies
Configuration Validation
- Startup-time validation with
IValidateOptions<T> - Detailed error messages for missing or invalid configuration
Exception Handling
LinbikException- Base exception classLinbikAuthenticationException- Authentication failuresLinbikConfigurationException- Configuration errorsLinbikTokenException- Token operation failures
📦 Installation
dotnet add package Linbik.Core
🔧 Configuration
Authorization Code Setup (Recommended)
// In Program.cs — fluent builder pattern
builder.Services.AddLinbik(builder.Configuration)
.AddLinbikJwtAuth(jwtAuthConfig) // optional: Linbik.JwtAuthManager
.AddLinbikServer(serverConfig) // optional: Linbik.Server
.AddLinbikYarp(yarpConfig); // optional: Linbik.YARP
var app = builder.Build();
app.EnsureLinbik(); // Validates all registered Linbik modules at startup
// In appsettings.json
{
"Linbik": {
"LinbikUrl": "https://linbik.com",
"ServiceId": "your-service-guid",
"ClientId": "your-client-guid",
"ApiKey": "your-api-key",
"AuthorizationEndpoint": "/auth",
"TokenEndpoint": "/oauth/token",
"RefreshEndpoint": "/oauth/refresh",
"AccessTokenLifetimeMinutes": 60,
"RefreshTokenLifetimeDays": 14
}
}
Configuration Validation
Options are validated at startup. If configuration is invalid, the application will fail to start with a clear error message:
OptionsValidationException: Linbik:LinbikUrl is required.
OptionsValidationException: Linbik:ApiKey is required and cannot be empty.
📚 Main Interfaces
IAuthService
Main authentication service interface with full CancellationToken support.
public interface IAuthService
{
Task RedirectToLinbikAsync(HttpContext context, string? returnUrl = null,
string? codeChallenge = null, CancellationToken cancellationToken = default);
Task<LinbikTokenResponse?> ExchangeCodeForTokensAsync(string code,
CancellationToken cancellationToken = default);
Task<UserProfile?> GetUserProfileAsync(HttpContext context,
CancellationToken cancellationToken = default);
Task<List<LinbikIntegrationToken>> GetIntegrationTokensAsync(HttpContext context,
CancellationToken cancellationToken = default);
Task<bool> RefreshTokensAsync(HttpContext context,
CancellationToken cancellationToken = default);
Task LogoutAsync(HttpContext context,
CancellationToken cancellationToken = default);
}
ILinbikAuthClient
HTTP client for communicating with Linbik OAuth endpoints.
public interface ILinbikAuthClient
{
Task<LinbikTokenResponse?> ExchangeCodeAsync(string code,
CancellationToken cancellationToken = default);
Task<LinbikTokenResponse?> RefreshTokensAsync(string refreshToken,
CancellationToken cancellationToken = default);
}
🛡️ Exception Handling
The library provides typed exceptions for better error handling:
try
{
var tokens = await authService.ExchangeCodeForTokensAsync(code);
}
catch (LinbikAuthenticationException ex) when (ex.ErrorCode == LinbikAuthenticationException.InvalidCodeError)
{
// Handle invalid authorization code
return RedirectToAction("Login");
}
catch (LinbikTokenException ex) when (ex.ErrorCode == LinbikTokenException.TokenExpiredError)
{
// Handle expired token
await authService.RefreshTokensAsync(context);
}
catch (LinbikConfigurationException ex)
{
// Configuration error - check appsettings.json
logger.LogError(ex, "Configuration error: {Key}", ex.ConfigurationKey);
}
📋 Models
LinbikTokenResponse
Response format for token exchange endpoint.
public class LinbikTokenResponse
{
public Guid UserId { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public List<LinbikIntegrationToken> Integrations { get; set; }
public string RefreshToken { get; set; }
public long? RefreshTokenExpiresAt { get; set; }
public string? CodeChallenge { get; set; } // For PKCE validation
}
LinbikIntegrationToken
Per-service JWT token data.
public class LinbikIntegrationToken
{
public string PackageName { get; set; }
public string ServiceName { get; set; }
public string Token { get; set; } // JWT signed with service's private key
public string ServiceUrl { get; set; }
}
UserProfile
User profile information extracted from JWT.
public class UserProfile
{
public Guid UserId { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
}
🔒 Rate Limiting
Built-in rate limiting to protect authentication endpoints:
// In Program.cs
builder.Services.AddLinbikRateLimiting(builder.Configuration);
// In middleware pipeline
app.UseLinbikRateLimiting();
// In appsettings.json
{
"Linbik": {
"RateLimiting": {
"PermitLimit": 100,
"WindowSeconds": 60,
"QueueLimit": 2
},
"Resilience": {
"StrictTokenLimit": 10,
"StrictReplenishmentPeriodSeconds": 60,
"StrictTokensPerPeriod": 5,
"StrictQueueLimit": 0
}
}
}
📖 Documentation
📄 License
This library is currently a work in progress and is not ready for production use.
Contact: info@linbik.com
Version: 2.3.0
Last Updated: 31 Ocak 2026
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.8)
- Microsoft.Extensions.Http.Resilience (>= 9.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- System.Diagnostics.DiagnosticSource (>= 9.0.0)
- System.IdentityModel.Tokens.Jwt (>= 8.14.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Linbik.Core:
| Package | Downloads |
|---|---|
|
Linbik.JwtAuthManager
Provides seamless Linbik JWT Authorize and Login capabilities. Registration and login flows are executed on Linbik.com and handled securely by this package. |
|
|
Linbik.YARP
Provides YARP-based gateway features to securely expose Linbik ecosystem services to end users. |
|
|
Linbik.Server
Enables external Linbik services to integrate and communicate securely with this service inside the Linbik ecosystem. |
|
|
Linbik.PasetoAuthManager
Provides seamless Linbik PASETO Authorize and Login capabilities. Uses PASETO v4.public (Ed25519) for cookie-based local authentication. Registration and login flows are executed on Linbik.com and handled securely by this package. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0-preview.3 | 73 | 5/30/2026 |
| 1.2.0-preview.2 | 87 | 4/26/2026 |
| 1.2.0-preview.1 | 110 | 4/2/2026 |
| 1.1.0 | 444 | 12/5/2025 |
| 1.1.0-beta0007 | 143 | 3/6/2026 |
| 1.0.7 | 196 | 3/6/2026 |
| 1.0.1 | 271 | 12/14/2025 |
| 1.0.0 | 139 | 3/6/2026 |
| 0.60.1 | 146 | 3/6/2026 |
| 0.45.12 | 406 | 11/30/2025 |
| 0.45.7 | 271 | 8/31/2025 |
| 0.45.6 | 248 | 8/31/2025 |
| 0.45.5 | 282 | 8/27/2025 |
| 0.45.4 | 248 | 8/27/2025 |
| 0.45.3 | 240 | 8/27/2025 |
| 0.45.0 | 247 | 8/27/2025 |
| 0.44.0 | 298 | 8/24/2025 |
| 0.42.0 | 155 | 8/23/2025 |
| 0.41.0 | 167 | 8/15/2025 |