Linbik.Core 1.2.0-preview.2

This is a prerelease version of Linbik.Core.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Linbik.Core --version 1.2.0-preview.2
                    
NuGet\Install-Package Linbik.Core -Version 1.2.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Linbik.Core" Version="1.2.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linbik.Core" Version="1.2.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Linbik.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Linbik.Core --version 1.2.0-preview.2
                    
#r "nuget: Linbik.Core, 1.2.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Linbik.Core@1.2.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Linbik.Core&version=1.2.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Linbik.Core&version=1.2.0-preview.2&prerelease
                    
Install as a Cake Tool

Linbik.Core

Core library for the Linbik Authentication Framework. Provides shared interfaces, models, configuration, and the OAuth 2.1 auth client.

📦 Installation

dotnet add package Linbik.Core

Not: Bu paket genellikle Linbik.JwtAuthManager veya diğer Linbik paketleri tarafından otomatik olarak dahil edilir. Sadece manuel entegrasyon için doğrudan yükleyin.

🚀 Features

  • OAuth 2.1 Authorization Code Flow with PKCE support
  • Multi-Service Integration — Issue multiple JWT tokens in single response
  • S2S (Service-to-Service) token operations
  • Keyless Mode — Zero-configuration development
  • Heartbeat — SDK-to-server health signals
  • Configuration Validation — Startup-time validation with IValidateOptions<T>
  • HTTP Resilience — Polly-based retry policies
  • Health Checks — Built-in health check integration

🔧 Configuration

Basic Setup (Fluent Builder)

// In Program.cs
builder.Services.AddLinbik()
    .AddLinbikJwtAuth()      // optional: Linbik.JwtAuthManager
    .AddLinbikServer()       // optional: Linbik.Server
    .AddLinbikYarp();        // optional: Linbik.YARP

var app = builder.Build();
app.EnsureLinbik(); // Validates all registered Linbik modules at startup

appsettings.json

{
  "Linbik": {
    "LinbikUrl": "https://api.linbik.com",
    "Name": "MyApp",
    "KeylessMode": true,
    "ServiceId": "your-service-guid",
    "ApiKey": "lnbk_your_api_key",
    "Clients": [
      {
        "Name": "Default",
        "ClientId": "your-client-guid",
        "RedirectUrl": "https://yourapp.com",
        "ActionResultType": "Redirect"
      }
    ],
    "EnablePKCE": true,
    "AccessTokenLifetimeMinutes": 60,
    "RefreshTokenLifetimeDays": 30,
    "S2STokenEndpoint": "/api/auth/s2s-token",
    "S2STargetServices": {
      "payment-gateway": "target-service-guid"
    },
    "EnableHeartbeat": true,
    "HeartbeatIntervalSeconds": 60
  }
}

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

Core authentication service for communicating with Linbik authorization server.

public interface IAuthService
{
    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 Linbik authorization server communication.

public interface ILinbikAuthClient
{
    // User-Context Token Operations
    Task<LBaseResponse<LinbikInitiateResponse>> InitiateAuthAsync(
        LinbikInitiateRequest request, CancellationToken cancellationToken = default);

    Task<LinbikTokenResponse?> ExchangeCodeAsync(
        string code, CancellationToken cancellationToken = default);

    Task<LinbikTokenResponse?> RefreshTokensAsync(
        string refreshToken, CancellationToken cancellationToken = default);

    // S2S (Service-to-Service) Token Operations
    Task<LinbikS2STokenResponse?> GetS2STokensAsync(
        LinbikS2STokenRequest request, CancellationToken cancellationToken = default);

    Task<LinbikS2STokenResponse?> GetS2STokensAsync(
        IEnumerable<string> targetPackageNames, CancellationToken cancellationToken = default);

    // Client Management
    Task<bool> UpdateClientRedirectUriByNameAsync(
        string clientName, string redirectUri, CancellationToken cancellationToken = default);
}

IJwtHelper

JWT token generation and validation helper.

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);
}

📋 Models

LinbikTokenResponse

Response from token exchange and refresh endpoints.

public sealed class LinbikTokenResponse
{
    public Guid UserId { get; set; }
    public string Username { get; set; }
    public string DisplayName { get; set; }
    public string? CodeChallenge { get; set; }
    public string? QueryParameters { get; set; }
    public List<LinbikIntegrationToken>? Integrations { get; set; }
    public string? RefreshToken { get; set; }
    public long? RefreshTokenExpiresAt { get; set; }
    public long? AccessTokenExpiresAt { get; set; }
    public Guid? ClientId { get; set; }
    public bool? Claimed { get; set; }       // Keyless Mode
    public string? NewApiKey { get; set; }   // Keyless Mode
}

LinbikIntegrationToken

Per-service JWT token data.

public sealed class LinbikIntegrationToken
{
    public Guid ServiceId { get; set; }
    public string ServiceName { get; set; }
    public string PackageName { get; set; }
    public string ServiceUrl { get; set; }
    public string Token { get; set; }         // JWT signed with service's private key
}

UserProfile

User profile information extracted from cookies.

public sealed class UserProfile
{
    public Guid UserId { get; set; }
    public string UserName { get; set; }
    public string NickName { get; set; }
    public Dictionary<string, string> IntegrationTokens { get; set; }
}

S2S Models

public sealed class LinbikS2STokenRequest
{
    public Guid SourceServiceId { get; set; }
    public List<Guid> TargetServiceIds { get; set; }
}

public sealed class LinbikS2STokenResponse
{
    public Guid SourceServiceId { get; set; }
    public string SourcePackageName { get; set; }
    public List<LinbikS2SIntegration> Integrations { get; set; }
    public long AccessTokenExpiresAt { get; set; }
}

public sealed class LinbikS2SIntegration
{
    public Guid ServiceId { get; set; }
    public string ServiceName { get; set; }
    public string PackageName { get; set; }
    public string ServiceUrl { get; set; }
    public string Token { get; set; }
}

🛡️ Exception Handling

try
{
    var tokens = await authService.ExchangeCodeForTokensAsync(code);
}
catch (LinbikAuthenticationException ex) when (ex.ErrorCode == LinbikAuthenticationException.InvalidCodeError)
{
    return RedirectToAction("Login");
}
catch (LinbikTokenException ex) when (ex.ErrorCode == LinbikTokenException.TokenExpiredError)
{
    await authService.RefreshTokensAsync(context);
}
catch (LinbikConfigurationException ex)
{
    logger.LogError(ex, "Configuration error: {Key}", ex.ConfigurationKey);
}

📖 Documentation

📄 License

MIT License

Contact: info@linbik.com


Version: 1.2.0
Platform: ASP.NET Core 10.0 (net10.0)
Last Updated: 2 Nisan 2026

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed