Nabs.Launchpad.Core.Gateway
10.0.214
Prefix Reserved
dotnet add package Nabs.Launchpad.Core.Gateway --version 10.0.214
NuGet\Install-Package Nabs.Launchpad.Core.Gateway -Version 10.0.214
<PackageReference Include="Nabs.Launchpad.Core.Gateway" Version="10.0.214" />
<PackageVersion Include="Nabs.Launchpad.Core.Gateway" Version="10.0.214" />
<PackageReference Include="Nabs.Launchpad.Core.Gateway" />
paket add Nabs.Launchpad.Core.Gateway --version 10.0.214
#r "nuget: Nabs.Launchpad.Core.Gateway, 10.0.214"
#:package Nabs.Launchpad.Core.Gateway@10.0.214
#addin nuget:?package=Nabs.Launchpad.Core.Gateway&version=10.0.214
#tool nuget:?package=Nabs.Launchpad.Core.Gateway&version=10.0.214
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.214)
- 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.214 | 0 | 1/1/2026 | |
| 10.0.213 | 0 | 1/1/2026 | |
| 10.0.212 | 0 | 1/1/2026 | |
| 10.0.211 | 0 | 12/31/2025 | |
| 10.0.210 | 32 | 12/30/2025 | |
| 10.0.209 | 40 | 12/30/2025 | |
| 10.0.208 | 36 | 12/30/2025 | |
| 10.0.207 | 46 | 12/29/2025 | |
| 10.0.206 | 42 | 12/29/2025 | |
| 10.0.205 | 162 | 12/24/2025 | |
| 10.0.204 | 162 | 12/21/2025 | |
| 10.0.203 | 260 | 12/18/2025 | |
| 10.0.202 | 259 | 12/17/2025 | |
| 10.0.200 | 264 | 12/17/2025 | |
| 10.0.199 | 423 | 12/10/2025 | |
| 10.0.197 | 156 | 12/5/2025 | |
| 10.0.196 | 667 | 12/3/2025 | |
| 10.0.195 | 666 | 12/3/2025 | |
| 10.0.194 | 661 | 12/3/2025 | |
| 10.0.193 | 661 | 12/2/2025 | |
| 10.0.192 | 162 | 11/28/2025 | |
| 10.0.190 | 179 | 11/27/2025 | |
| 10.0.189 | 162 | 11/23/2025 | |
| 10.0.187 | 164 | 11/23/2025 | |
| 10.0.186 | 145 | 11/23/2025 | |
| 10.0.184 | 401 | 11/20/2025 | |
| 10.0.181-rc3 | 275 | 11/11/2025 | |
| 10.0.180 | 283 | 11/11/2025 | |
| 10.0.179-rc2 | 273 | 11/11/2025 | |
| 10.0.178-rc2 | 235 | 11/10/2025 | |
| 10.0.177-rc2 | 220 | 11/10/2025 | |
| 10.0.176-rc2 | 191 | 11/6/2025 | |
| 10.0.175-rc2 | 185 | 11/6/2025 | |
| 10.0.174-rc2 | 185 | 11/5/2025 | |
| 10.0.173-rc2 | 183 | 11/3/2025 | |
| 10.0.172-rc2 | 137 | 11/2/2025 | |
| 10.0.170-rc2 | 115 | 11/1/2025 | |
| 10.0.169-rc2 | 114 | 11/1/2025 | |
| 10.0.168-rc2 | 124 | 10/31/2025 | |
| 10.0.166-rc2 | 117 | 10/31/2025 | |
| 10.0.164-rc2 | 179 | 10/28/2025 | |
| 10.0.162-rc2 | 180 | 10/24/2025 | |
| 10.0.161 | 183 | 10/24/2025 | |
| 9.0.151 | 113 | 10/17/2025 | |
| 9.0.150 | 172 | 9/10/2025 | |
| 9.0.146 | 119 | 8/15/2025 | |
| 9.0.145 | 196 | 8/11/2025 | |
| 9.0.144 | 179 | 8/8/2025 | |
| 9.0.137 | 135 | 7/29/2025 | |
| 9.0.136 | 130 | 7/29/2025 | |
| 9.0.135 | 153 | 7/28/2025 | |
| 9.0.134 | 166 | 7/9/2025 | |
| 9.0.133 | 180 | 7/9/2025 | |
| 9.0.132 | 174 | 7/9/2025 | |
| 9.0.131 | 186 | 7/9/2025 | |
| 9.0.130 | 179 | 7/7/2025 |