Linbik.Core
0.45.12
See the version list below for details.
dotnet add package Linbik.Core --version 0.45.12
NuGet\Install-Package Linbik.Core -Version 0.45.12
<PackageReference Include="Linbik.Core" Version="0.45.12" />
<PackageVersion Include="Linbik.Core" Version="0.45.12" />
<PackageReference Include="Linbik.Core" />
paket add Linbik.Core --version 0.45.12
#r "nuget: Linbik.Core, 0.45.12"
#:package Linbik.Core@0.45.12
#addin nuget:?package=Linbik.Core&version=0.45.12
#tool nuget:?package=Linbik.Core&version=0.45.12
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
Legacy Features (Deprecated)
- Simple JWT authentication (use authorization code flow instead)
- Basic token validation (use per-service validation)
📦 Installation
dotnet add package Linbik.Core
🔧 Configuration
Authorization Code Setup (Recommended)
services.AddLinbik(options =>
{
options.ServerUrl = "https://linbik.com";
options.AuthorizationEndpoint = "/auth";
options.TokenEndpoint = "/oauth/token";
options.RefreshEndpoint = "/oauth/refresh";
options.AuthorizationCodeLifetimeMinutes = 10;
options.AccessTokenLifetimeMinutes = 60;
options.RefreshTokenLifetimeDays = 30;
options.EnablePKCE = true;
options.JwtIssuer = "linbik";
});
📚 Main Interfaces
IJwtHelper
RSA-256 JWT token signing and validation for multi-service authentication.
public interface IJwtHelper
{
Task<string> CreateTokenAsync(Claim[] claims, string privateKey, string audience, int expirationMinutes = 60);
Task<bool> ValidateTokenAsync(string token, string publicKey, string expectedAudience, string expectedIssuer = "linbik");
Dictionary<string, string> GetTokenClaims(string token);
}
IAuthorizationCodeService
Manages authorization codes (5-10 minute validity, single-use).
public interface IAuthorizationCodeService
{
Task<string> GenerateCodeAsync(/* parameters */);
Task<(bool isValid, AuthorizationCodeData? data)> ValidateAndUseCodeAsync(string code, Guid serviceId);
Task<bool> IsCodeValidAsync(string code);
}
IServiceRepository
Service registration and management.
public interface IServiceRepository
{
Task<ServiceData?> GetServiceByIdAsync(Guid serviceId);
Task<ServiceData?> GetServiceByApiKeyAsync(string apiKey);
Task<List<ServiceData>> GetGrantedIntegrationServicesAsync(Guid userId, Guid mainServiceId);
Task<bool> IsIpAllowedAsync(Guid serviceId, string ipAddress);
}
IRefreshTokenService
Refresh token lifecycle management (30-day validity by default).
public interface IRefreshTokenService
{
Task<string> CreateRefreshTokenAsync(/* parameters */);
Task<(bool isValid, RefreshTokenData? data)> ValidateRefreshTokenAsync(string token, Guid serviceId);
Task<bool> RevokeRefreshTokenAsync(string token);
}
ILinbikAuthClient
HTTP client for communicating with Linbik.App OAuth endpoints.
public interface ILinbikAuthClient
{
/// <summary>
/// Exchange authorization code for tokens
/// POST {LinbikUrl}/oauth/token
/// </summary>
Task<LinbikTokenResponse?> ExchangeCodeAsync(string code);
/// <summary>
/// Refresh tokens using refresh token
/// POST {LinbikUrl}/oauth/refresh
/// </summary>
Task<LinbikTokenResponse?> RefreshTokensAsync(string refreshToken);
}
Usage:
// In Program.cs - automatically registered with AddLinbik()
builder.Services.AddLinbik(builder.Configuration);
// In your code
public class MyService
{
private readonly ILinbikAuthClient _linbikClient;
public MyService(ILinbikAuthClient linbikClient)
{
_linbikClient = linbikClient;
}
public async Task HandleCallback(string code)
{
var response = await _linbikClient.ExchangeCodeAsync(code);
if (response != null)
{
// response.UserId
// response.Username
// response.Integrations (list of JWT tokens for each service)
// response.RefreshToken
}
}
}
📋 Models
MultiServiceTokenResponse
Response format for token exchange endpoint.
public class MultiServiceTokenResponse
{
public Guid UserId { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public List<IntegrationToken> Integrations { get; set; }
public string RefreshToken { get; set; }
public long RefreshTokenExpiresAt { get; set; }
public string? CodeChallenge { get; set; } // For PKCE validation
}
IntegrationToken
Per-service JWT token data.
public class IntegrationToken
{
public Guid ServiceId { get; set; }
public string ServiceName { get; set; }
public string ServicePackage { get; set; }
public string BaseUrl { get; set; }
public string Token { get; set; } // JWT signed with service's private key
public int ExpiresIn { get; set; } // Seconds
public DateTime ExpiresAt { get; set; }
}
🔄 Migration from v1.x
Legacy properties are marked with [Obsolete] but still functional:
// ❌ Old way (v1.x)
options.PublicKey = "single-key-for-all";
options.AllowAllApp = true;
// ✅ New way (v2.0+)
// Use IServiceRepository for service registration
// Use per-service RSA key pairs
// Use proper API key validation
📖 Documentation
📄 License
This library is currently a work in progress and is not ready for production use.
Contact: info@linbik.com
Version: 2.0.0 (Authorization Code Support)
Last Updated: 1 Kasım 2025
| 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.AspNetCore.Session (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- 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 |