Nabs.Launchpad.Core.Gateway
10.0.219
Prefix Reserved
dotnet add package Nabs.Launchpad.Core.Gateway --version 10.0.219
NuGet\Install-Package Nabs.Launchpad.Core.Gateway -Version 10.0.219
<PackageReference Include="Nabs.Launchpad.Core.Gateway" Version="10.0.219" />
<PackageVersion Include="Nabs.Launchpad.Core.Gateway" Version="10.0.219" />
<PackageReference Include="Nabs.Launchpad.Core.Gateway" />
paket add Nabs.Launchpad.Core.Gateway --version 10.0.219
#r "nuget: Nabs.Launchpad.Core.Gateway, 10.0.219"
#:package Nabs.Launchpad.Core.Gateway@10.0.219
#addin nuget:?package=Nabs.Launchpad.Core.Gateway&version=10.0.219
#tool nuget:?package=Nabs.Launchpad.Core.Gateway&version=10.0.219
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.
Key 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:
- Entry Point:
ProjectExtensionsprovides fluent configuration API - Authentication Layer: Handles Azure AD authentication and test scenarios
- Authorization Layer: Issues JWT tokens for downstream services
- Proxy Layer: YARP handles request routing and transformation
- Service Discovery: Automatic service resolution and load balancing
Request Flow
- Incoming Request: Client sends request to gateway
- Authentication: Azure AD validates user identity
- Authorization: Gateway generates JWT token for downstream services
- Transformation: Custom headers and authorization tokens are added
- Routing: YARP routes request to appropriate backend service
- 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
- Security: Always use HTTPS in production
- Configuration: Validate all configuration options
- Monitoring: Implement proper logging and telemetry
- Performance: Configure appropriate timeouts and connection limits
- 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);
Related Projects
- 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 | Versions 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. |
-
net10.0
- CommunityToolkit.Mvvm (>= 8.4.0)
- FluentValidation (>= 12.1.1)
- Microsoft.Extensions.ServiceDiscovery.Yarp (>= 10.1.0)
- Microsoft.Identity.Web (>= 4.2.0)
- Nabs.Launchpad.Core.ServiceDefaults (>= 10.0.219)
- Yarp.ReverseProxy (>= 2.3.0)
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 | |
|---|---|---|---|
| 10.0.219 | 84 | 1/5/2026 | |
| 10.0.218 | 144 | 1/4/2026 | |
| 10.0.217 | 103 | 1/4/2026 | |
| 10.0.216 | 101 | 1/4/2026 | |
| 10.0.215 | 102 | 1/4/2026 | |
| 10.0.214 | 102 | 1/1/2026 | |
| 10.0.213 | 161 | 1/1/2026 | |
| 10.0.212 | 109 | 1/1/2026 | |
| 10.0.211 | 116 | 12/31/2025 | |
| 10.0.210 | 115 | 12/30/2025 | |
| 10.0.209 | 123 | 12/30/2025 | |
| 10.0.208 | 119 | 12/30/2025 | |
| 10.0.207 | 123 | 12/29/2025 | |
| 10.0.206 | 114 | 12/29/2025 | |
| 10.0.205 | 195 | 12/24/2025 | |
| 10.0.204 | 201 | 12/21/2025 | |
| 10.0.203 | 295 | 12/18/2025 | |
| 10.0.202 | 296 | 12/17/2025 | |
| 10.0.200 | 301 | 12/17/2025 | |
| 10.0.199 | 456 | 12/10/2025 | |
| 10.0.197 | 195 | 12/5/2025 | |
| 10.0.196 | 708 | 12/3/2025 | |
| 10.0.195 | 699 | 12/3/2025 | |
| 10.0.194 | 699 | 12/3/2025 | |
| 10.0.193 | 693 | 12/2/2025 | |
| 10.0.192 | 196 | 11/28/2025 | |
| 10.0.190 | 218 | 11/27/2025 | |
| 10.0.189 | 195 | 11/23/2025 | |
| 10.0.187 | 198 | 11/23/2025 | |
| 10.0.186 | 177 | 11/23/2025 | |
| 10.0.184 | 435 | 11/20/2025 | |
| 10.0.181-rc3 | 312 | 11/11/2025 | |
| 10.0.180 | 318 | 11/11/2025 | |
| 10.0.179-rc2 | 305 | 11/11/2025 | |
| 10.0.178-rc2 | 273 | 11/10/2025 | |
| 10.0.177-rc2 | 252 | 11/10/2025 | |
| 10.0.176-rc2 | 225 | 11/6/2025 | |
| 10.0.175-rc2 | 221 | 11/6/2025 | |
| 10.0.174-rc2 | 218 | 11/5/2025 | |
| 10.0.173-rc2 | 222 | 11/3/2025 | |
| 10.0.172-rc2 | 171 | 11/2/2025 | |
| 10.0.170-rc2 | 152 | 11/1/2025 | |
| 10.0.169-rc2 | 152 | 11/1/2025 | |
| 10.0.168-rc2 | 158 | 10/31/2025 | |
| 10.0.166-rc2 | 150 | 10/31/2025 | |
| 10.0.164-rc2 | 211 | 10/28/2025 | |
| 10.0.162-rc2 | 219 | 10/24/2025 | |
| 10.0.161 | 214 | 10/24/2025 | |
| 9.0.151 | 150 | 10/17/2025 | |
| 9.0.150 | 214 | 9/10/2025 | |
| 9.0.146 | 155 | 8/15/2025 | |
| 9.0.145 | 235 | 8/11/2025 | |
| 9.0.144 | 215 | 8/8/2025 | |
| 9.0.137 | 168 | 7/29/2025 | |
| 9.0.136 | 169 | 7/29/2025 | |
| 9.0.135 | 186 | 7/28/2025 | |
| 9.0.134 | 205 | 7/9/2025 | |
| 9.0.133 | 216 | 7/9/2025 | |
| 9.0.132 | 208 | 7/9/2025 | |
| 9.0.131 | 222 | 7/9/2025 | |
| 9.0.130 | 218 | 7/7/2025 |