Files
pnoker 12dded2225 chore(repo): clear the remaining third-party boot warnings
- springdoc: declare api-docs/swagger-ui enabled explicitly; the boot
  reminder only fires on unset properties, so the intent-declaring
  values keep behavior identical and quiet all six services
- netty: add the macos dns native resolver to the gateway so the
  resolver does not log an error at boot on mac dev machines (the
  no-classifier jar bundles every arch and is inert on linux)
- hibernate-validator HV000271: spring-cloud-gateway 4.3.0 still uses
  container-level @Valid on its List properties. logger-level rules
  cannot suppress it because spring boot's logging re-init installs a
  second loggercontext that resets them, so drop the exact message
  with a turbo filter attached to every context loading this config;
  the class documents the upstream trigger for removal

live verification: five services plus gateway boot with zero warn and
zero error lines, virtual driver included; salt/login probe 200
2026-09-18 18:02:11 +08:00
..

DC3 Gateway

Overview

dc3-gateway is the API Gateway of the IoT DC3 platform, built on Spring Cloud Gateway (WebFlux). It serves as the single ingress point for all external HTTP traffic, providing rate limiting, authentication verification, service routing, and reverse proxying.

Module Information

  • Group ID: io.github.pnoker
  • Artifact ID: dc3-gateway
  • Package: io.github.pnoker.gateway

Service Ports

Protocol Port Override
HTTP 8000 DC3_GATEWAY_PORT

Key Responsibilities

  • Request Routing: Routes /api/v3/{service}/** requests to the corresponding center service via StripPrefix=2
  • Authentication Filter: Authentic filter validates Bearer tokens with the Auth Center before forwarding protected routes
  • Service Addressing: Routes to backend centers via static addresses, overridable through GATEWAY_ROUTE_* / CENTER_*_HOST environment variables (no service registry)
  • gRPC Client: Connects to dc3-center-auth (port 9300) for token validation
  • OAuth2 / MCP Ingress: Exposes the Auth Center's OAuth2 authorization-server and MCP discovery endpoints

Routing Rules

Routes are matched in definition order (first match wins); the public token and OAuth metadata routes are deliberately defined before the /api/v3/auth/** wildcard.

Path Pattern Backend Service Auth Required
/.well-known/oauth-authorization-server, /oauth2/jwks, /oauth2/token, /oauth2/revoke, /oauth2/register dc3-center-auth No
/oauth2/authorize dc3-center-auth Yes
/api/v3/auth/token/** dc3-center-auth No
/api/v3/auth/** dc3-center-auth Yes
/api/v3/manager/** dc3-center-manager Yes
/api/v3/data/** dc3-center-data Yes
/api/v3/agentic/** dc3-center-agentic Yes

The /oauth2/** and /.well-known/** routes expose the Auth Center's OAuth2 authorization-server and MCP discovery endpoints for MCP clients.

Dependencies

Business logic is shared via dc3-common-gateway:

<dependency>
    <groupId>io.github.pnoker</groupId>
    <artifactId>dc3-common-gateway</artifactId>
</dependency>

Configuration

  • application.yml — base port, active profile, facade mode, SpringDoc aggregation
  • application-dev.yml — dev env: profile group and debug logging
  • application-pre.yml — pre-release overrides
  • application-pro.yml — production: disables SpringDoc / Swagger UI

Route definitions and the auth gRPC channel are shared in dc3-common-gateway's application-gateway.yml (overridable via GATEWAY_ROUTE_* / CENTER_*_HOST env vars).

Running Locally

1. Start Infrastructure

make up-db

2. Build

mvn -s .mvn/settings.xml -pl dc3-gateway -am package

3. Run after the required center services are available

java -jar dc3-gateway/target/dc3-gateway.jar

Testing

Run the module tests from the repository root:

mvn -s .mvn/settings.xml -pl dc3-gateway -am test
  • dc3-common-gateway — Authentic filter implementation and gateway utilities
  • dc3-api-auth — gRPC API contracts for token validation
  • dc3-center-auth — Token validation backend