A lightweight SDK that allows you to expose your gRPC services over HTTP/JSON.
This SDK accepts HTTP requests, invokes the corresponding gRPC service methods, and returns JSON responses generated from protobuf messages.
π No .proto files are required to use your gRPC services with this SDK.
This release introduces JWT Token Authentication with automatic refresh capabilities alongside existing API Key authentication.
- JWT Token Authentication with automatic token refresh
- Pull-based orchestration for token management
- Runtime token validation on every API call
- Centralized protobuf protocol for refresh operations
- Zero downtime token refresh
π See full details in the Authentication System README.
- Expose gRPC services via HTTP endpoints.
- Automatically translates:
- HTTP request β gRPC method call
- Protobuf response β JSON response
- Advanced Authentication support for internal communication between Gateway β Service:
- Supported auth types:
API_KEY- Simple static authenticationJWT_TOKEN- Dynamic authentication with auto-refresh
- Automatic token refresh when JWT tokens expire
- Services can define their own header name and authentication configuration during registration.
- Runtime token validation ensures secure communication
- Services can re-register with new tokens anytime, and the Gateway will automatically use the updated configuration.
- Supported auth types:
- Service Registry with health monitoring
- Simple service registration API with comprehensive configuration options
- Runs as a standalone HTTP service.
- Easy integration with existing gRPC applications.
The Gateway now supports two authentication methods for secure service communication.
When a service registers itself, it can specify the authentication type and provide the required configuration.
- API_KEY - Static authentication with custom headers
- JWT_TOKEN - Dynamic authentication with automatic token refresh
let result = gateway.service_registry.register(ServiceRegisterRequest {
service_name: String::from("users.UserService"),
host: String::from("127.0.0.1"),
port: String::from("50051"),
health_check_endpoint: String::from("/health"),
oauth_config: InternalAuthConfig {
auth_type: AuthType::ApiKey,
auth_refresh_config: None,
},
});let result = gateway.service_registry.register(ServiceRegisterRequest {
service_name: String::from("payment.PaymentService"),
host: String::from("127.0.0.1"),
port: String::from("50052"),
health_check_endpoint: String::from("/health"),
oauth_config: InternalAuthConfig {
auth_type: AuthType::JwtToken,
auth_refresh_config: Some(AuthRefreshConfig {
service_name: String::from("auth-service"),
method: String::from("RefreshAuth"),
header_name: String::from("Authorization"),
access_token: String::from("initial_jwt_token"),
expired_at: 1641024000, // Unix timestamp
refresh_token: String::from("refresh_jwt_token"),
}),
},
});The new JWT authentication system features automatic token refresh:
- Runtime Validation: Token expiry checked on every API call
- Automatic Refresh: Gateway automatically refreshes expired tokens
- Pull-based Orchestration: Gateway initiates refresh when needed
- Standardized Protocol: All services must implement the same refresh protobuf service
- Zero Downtime: Seamless operation during token refresh
All services using JWT authentication must implement this exact protobuf service:
syntax = "proto3";
package refresh;
message RefreshAuthTokenRequest {
string refresh_token = 1;
}
message RefreshAuthTokenResponse {
string access_token = 1;
string refresh_token = 2;
uint64 expired_at = 3;
}
service RefreshAuthService {
rpc RefreshAuth (RefreshAuthTokenRequest) returns (RefreshAuthTokenResponse);
}For Simple Services (API Key):
- Use
AuthType::ApiKey - Set static header name and value
- No additional implementation required
For Production Services (JWT Token):
- Use
AuthType::JwtToken - Implement the required refresh protobuf service
- Configure initial tokens and refresh endpoint
Services must register before starting to enable Gateway communication.
Once registered, the Gateway will:
- Route HTTP requests to your gRPC service
- Handle authentication automatically
- Refresh tokens when needed (JWT only)
- Monitor service health
- Service connection details (host, port)
- Authentication type selection
- Health check endpoints
- Access tokens (auto-refreshed)
- Token expiry times (auto-updated)
- Refresh tokens (auto-rotated)
- Complete Authentication Guide - Detailed setup and configuration
- Migration Guide - Upgrading from API Key to JWT
- Troubleshooting - Common issues and solutions
- Service Registration Required: All services must register before starting
- Protocol Compliance: JWT services must implement the exact protobuf definition
- Backward Compatibility: Existing API Key authentication continues to work
- Recommended: JWT Token authentication for new production services
Version: v0.1.6
Compatibility: Supports both API Key and JWT Token authentication
Migration: Seamless upgrade path from API Key to JWT authentication