Linbik.YARP 1.2.0-preview.2

This is a prerelease version of Linbik.YARP.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Linbik.YARP --version 1.2.0-preview.2
                    
NuGet\Install-Package Linbik.YARP -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.YARP" 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.YARP" Version="1.2.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Linbik.YARP" />
                    
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.YARP --version 1.2.0-preview.2
                    
#r "nuget: Linbik.YARP, 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.YARP@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.YARP&version=1.2.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Linbik.YARP&version=1.2.0-preview.2&prerelease
                    
Install as a Cake Tool

Linbik.YARP

YARP (Yet Another Reverse Proxy) integration for Linbik multi-service authentication. Provides automatic token injection, S2S token provider, and typed S2S HTTP client.

📦 Installation

dotnet add package Linbik.YARP

🚀 Features

User-Context Proxy

  • Automatic Token Injection — Inject service-specific JWT tokens into proxied requests from cookies
  • Cookie-Based Storage — Integration tokens stored in HttpOnly cookies
  • Per-Service Routing/{packageName}/{**path} routes to integration service BaseUrl

S2S (Service-to-Service)

  • IS2STokenProvider — Token caching, auto-refresh, config-based and dynamic targets
  • IS2SServiceClient — Full typed HTTP client (GET, POST, PUT, DELETE, PATCH) with automatic S2S token injection
  • LBaseResponse<T> Enforcement — Consistent response format
  • Role-Based TokensService (service-to-service) and Linbik (platform) roles

🔧 Configuration

// In Program.cs
builder.Services.AddLinbik()
    .AddLinbikJwtAuth()
    .AddLinbikYarp();

var app = builder.Build();
app.EnsureLinbik();

// Map user-context integration proxy: /{packageName}/{**path}
app.UseLinbikYarp();

// Map S2S proxy endpoints (optional)
app.UseLinbikS2S();

appsettings.json

{
  "Linbik": {
    "LinbikUrl": "https://api.linbik.com",
    "ServiceId": "your-service-guid",
    "ApiKey": "lnbk_your_api_key",
    "S2STargetServices": {
      "payment-gateway": "guid-of-payment-service",
      "courier-service": "guid-of-courier-service"
    },
    "S2SAutoRefresh": true,
    "S2SRefreshThreshold": 0.75
  },
  "YARP": {
    "IntegrationServices": {
      "payment-gateway": {
        "BaseUrl": "https://payment.example.com"
      },
      "survey-service": {
        "BaseUrl": "https://survey.example.com"
      }
    }
  }
}

💻 User-Context Proxy (UseLinbikYarp)

How It Works

1. User authenticates → Integration tokens stored in cookies
   Cookie: integration_payment-gateway = "eyJhbG..."
   Cookie: integration_survey-service = "eyJhbG..."

2. Client request → /payment-gateway/api/charge

3. UseLinbikYarp():
   a. Extract {packageName} from URL → "payment-gateway"
   b. Read cookie: integration_payment-gateway
   c. Lookup BaseUrl from YARP:IntegrationServices config
   d. Proxy request with Authorization: Bearer {token}

4. Target service receives:
   GET /api/charge
   Authorization: Bearer eyJhbG...
Cookie: linbikRefreshToken = "refresh_abc..." (HttpOnly, Secure, 30 days)
Cookie: integration_payment-gateway = "eyJhbGci..." (HttpOnly, Secure, 1 hour)
Cookie: integration_courier-service = "eyJhbGci..." (HttpOnly, Secure, 1 hour)

💻 S2S Communication

ITokenProvider

public interface ITokenProvider
{
    Task<LinbikTokenResponse?> GetMultiServiceTokenAsync(
        string baseUrl, string authorizationCode, string apiKey);
    Task<LinbikTokenResponse?> RefreshTokensAsync(
        string baseUrl, string refreshToken, string apiKey, string serviceId);
    Task<string?> GetIntegrationTokenAsync(string integrationServicePackage);
    void CacheTokenResponse(LinbikTokenResponse tokenResponse);
    void ClearCache();
}

IS2STokenProvider

public interface IS2STokenProvider
{
    // Config-based (package name)
    Task<string?> GetS2STokenAsync(string packageName, CancellationToken ct = default);
    Task<LinbikS2SIntegration?> GetS2SIntegrationAsync(string packageName, CancellationToken ct = default);

    // Dynamic (service ID) — for callbacks/webhooks
    Task<LinbikS2SIntegration?> GetS2SIntegrationByIdAsync(Guid targetServiceId, CancellationToken ct = default);

    // Cache management
    Task RefreshS2STokensAsync(CancellationToken ct = default);
    void ClearCache();
    TimeSpan? GetTimeUntilExpiry();
}

IS2SServiceClient

Typed HTTP client with automatic S2S token injection and LBaseResponse<T> format:

Config-Based Targets (Package Name)
public class MyController : ControllerBase
{
    private readonly IS2SServiceClient _s2sClient;

    public async Task<IActionResult> SyncWithPayment()
    {
        var result = await _s2sClient.PostAsync<SyncRequest, SyncResponse>(
            "payment-gateway",           // package name from config
            "/api/integration/s2s/sync",
            new SyncRequest { EntityType = "order", EntityId = "123" }
        );

        return result.IsSuccess ? Ok(result.Data) : BadRequest(result.FriendlyMessage);
    }
}
Dynamic Targets (Service ID) — Callbacks/Webhooks
public class PaymentController : ControllerBase
{
    private readonly IS2SServiceClient _s2sClient;

    public async Task<IActionResult> NotifyMerchant(Order order)
    {
        var result = await _s2sClient.PostByIdAsync<PaymentNotification, NotifyResponse>(
            order.MerchantLinbikServiceId,   // dynamic service ID
            "/api/webhooks/payment",
            new PaymentNotification
            {
                OrderId = order.Id.ToString(),
                Status = "completed",
                Amount = order.Amount
            }
        );

        return result.IsSuccess ? Ok() : StatusCode(500);
    }
}

Available HTTP Methods

Method Config-Based Dynamic (by ID)
GET GetAsync<TResponse> GetByIdAsync<TResponse>
POST PostAsync<TReq, TRes> PostByIdAsync<TReq, TRes>
PUT PutAsync<TReq, TRes> PutByIdAsync<TReq, TRes>
DELETE DeleteAsync<TRes> DeleteByIdAsync<TRes>
PATCH PatchAsync<TReq, TRes> PatchByIdAsync<TReq, TRes>

YARP Route Configuration (Advanced)

For fine-grained control with YARP reverse proxy routes:

// Add Linbik token transform to YARP
builder.Services.AddReverseProxy()
    .LoadFromConfig()
    .AddLinbikTokenTransform();

📖 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

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.0-preview.3 57 5/30/2026
1.2.0-preview.2 84 4/26/2026
1.2.0-preview.1 111 4/2/2026
1.1.0 413 12/5/2025
1.1.0-beta0007 107 3/6/2026
1.0.7 164 3/6/2026
1.0.1 237 12/14/2025
1.0.0 120 3/6/2026
0.60.1 116 3/6/2026
0.46.0 371 11/30/2025
0.45.12 380 11/30/2025
0.45.7 247 8/31/2025
0.45.6 218 8/31/2025
0.45.5 249 8/27/2025
0.44.0 277 8/24/2025
0.42.0 139 8/23/2025
0.41.0 144 8/15/2025
0.40.0 197 8/14/2025
0.39.0 203 8/14/2025
0.38.0 203 8/14/2025
Loading failed