Nabs.Launchpad.Core.Gateway 9.0.146

Prefix Reserved
dotnet add package Nabs.Launchpad.Core.Gateway --version 9.0.146
                    
NuGet\Install-Package Nabs.Launchpad.Core.Gateway -Version 9.0.146
                    
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="Nabs.Launchpad.Core.Gateway" Version="9.0.146" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nabs.Launchpad.Core.Gateway" Version="9.0.146" />
                    
Directory.Packages.props
<PackageReference Include="Nabs.Launchpad.Core.Gateway" />
                    
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 Nabs.Launchpad.Core.Gateway --version 9.0.146
                    
#r "nuget: Nabs.Launchpad.Core.Gateway, 9.0.146"
                    
#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 Nabs.Launchpad.Core.Gateway@9.0.146
                    
#: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=Nabs.Launchpad.Core.Gateway&version=9.0.146
                    
Install as a Cake Addin
#tool nuget:?package=Nabs.Launchpad.Core.Gateway&version=9.0.146
                    
Install as a Cake Tool

Nabs Launchpad Core Gateway Library

A comprehensive API Gateway library built on Microsoft's YARP (Yet Another Reverse Proxy) with integrated Azure Active Directory authentication and custom authorization features.

Overview

The Nabs.Launchpad.Core.Gateway library provides a robust, production-ready API Gateway solution that acts as a reverse proxy for microservices architectures. It includes built-in authentication, authorization, CORS support, and service discovery capabilities.

Features

  • YARP-based Reverse Proxy: Built on Microsoft's high-performance YARP reverse proxy
  • Azure AD Integration: Full integration with Microsoft Identity platform for authentication
  • Custom Authorization: JWT token generation and validation for downstream services
  • Service Discovery: Integration with .NET Aspire service discovery
  • CORS Support: Configurable Cross-Origin Resource Sharing
  • Request Transformation: Automatic header injection and authorization token forwarding
  • Development Authentication: Test authentication handler for development scenarios
  • Configuration Validation: FluentValidation-based configuration validation

Key Components

Gateway Configuration

The library uses GatewayOptions to configure the gateway behavior:

public sealed class GatewayOptions
{
    public AuthorizationIssuerOptions AuthorizationIssuerOptions { get; set; }
    public YarpOptions YarpOptions { get; set; }
}

Authentication & Authorization

  • Production: Uses Microsoft Identity Web with Azure AD/Entra ID
  • Development: Optional test authentication handler for local development
  • JWT Token Generation: Issues custom JWT tokens for downstream service authentication
  • Authorization Policies: Configurable policies for UI and API access

YARP Integration

  • Service Discovery: Automatic service resolution using .NET Aspire
  • Request Transformation: Adds custom headers and authorization tokens
  • Load Balancing: Built-in load balancing capabilities through YARP

Usage

Basic Setup

var builder = WebApplication.CreateBuilder(args);

builder.AddGateway(gatewayOptions =>
{
    // Configure YARP options
    gatewayOptions.YarpOptions.HeaderName = "X-Custom-Header";
    gatewayOptions.YarpOptions.HeaderValue = "CustomValue";

    // Configure authorization issuer
    gatewayOptions.AuthorizationIssuerOptions.Issuer = "https://your-gateway";
    gatewayOptions.AuthorizationIssuerOptions.Audience = "https://your-api";
    gatewayOptions.AuthorizationIssuerOptions.Key = "your-secret-key";
});

var app = builder.Build();

app.UseGateway();

await app.RunAsync();

Configuration

The gateway expects YARP configuration in appsettings.json:

{
  "ReverseProxy": {
    "Routes": {
      "api-route": {
        "ClusterId": "api-cluster",
        "Match": {
          "Path": "/api/{**catch-all}"
        }
      }
    },
    "Clusters": {
      "api-cluster": {
        "Destinations": {
          "destination1": {
            "Address": "http://api-service/"
          }
        }
      }
    }
  },
  "AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "TenantId": "your-tenant-id",
    "ClientId": "your-client-id",
    "RedirectUri": "https://your-gateway/signin-oidc"
  }
}

Dependencies

  • Microsoft.AspNetCore.App: Core ASP.NET Core framework
  • Yarp.ReverseProxy: Microsoft's reverse proxy implementation
  • Microsoft.Extensions.ServiceDiscovery.Yarp: Service discovery integration
  • Microsoft.Identity.Web: Azure AD authentication
  • FluentValidation: Configuration validation
  • CommunityToolkit.Mvvm: MVVM helpers

Architecture

The gateway follows a layered architecture:

  1. Entry Point: ProjectExtensions provides fluent configuration API
  2. Authentication Layer: Handles Azure AD authentication and test scenarios
  3. Authorization Layer: Issues JWT tokens for downstream services
  4. Proxy Layer: YARP handles request routing and transformation
  5. Service Discovery: Automatic service resolution and load balancing

Request Flow

  1. Incoming Request: Client sends request to gateway
  2. Authentication: Azure AD validates user identity
  3. Authorization: Gateway generates JWT token for downstream services
  4. Transformation: Custom headers and authorization tokens are added
  5. Routing: YARP routes request to appropriate backend service
  6. Response: Backend response is returned to client

Testing

The library includes comprehensive test harnesses:

  • Launchpad.Harness.Gateway: Test gateway application
  • Launchpad.Core.Gateway.UnitTests: Unit test suite
  • Integration Tests: Full end-to-end testing capabilities

Best Practices

  1. Security: Always use HTTPS in production
  2. Configuration: Validate all configuration options
  3. Monitoring: Implement proper logging and telemetry
  4. Performance: Configure appropriate timeouts and connection limits
  5. Scalability: Use service discovery for dynamic service resolution

Development

For development scenarios, the gateway can be configured with test authentication:

// Uncomment for development testing
builder.Services.AddAuthentication("TestAuth")
    .AddScheme<AuthenticationSchemeOptions, TestAuthHandler>("TestAuth", null);
  • Nabs.Launchpad.Core.ServiceDefaults: Common service configurations
  • Nabs.Launchpad.Core.Portal: Blazor UI that can run behind the gateway
  • Nabs.Launchpad.Core.SiloClient: Orleans client integration

License

This project is part of the Nabs Launchpad framework by Net Advantage Business Solutions.

Product 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. 
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
9.0.146 27 8/15/2025
9.0.145 91 8/11/2025
9.0.144 94 8/8/2025
9.0.137 94 7/29/2025
9.0.136 88 7/29/2025
9.0.135 90 7/28/2025
9.0.134 139 7/9/2025
9.0.133 136 7/9/2025
9.0.132 130 7/9/2025
9.0.131 146 7/9/2025
9.0.130 138 7/7/2025