ServiceAPI Gateway
Tổng quan API Gateway
Vai trò hiện tại của Go API Gateway trong runtime CenterOS.
Tổng quan API Gateway
Trạng thái
Go API Gateway là runtime hiện tại của CenterOS.
- Repo/folder:
api-gateway - Container:
centeros-api-gateway - Image:
dorrissdang/centeros-api-gateway:main - Host/container port:
8080:8080 - Đã đóng cho
local composeauth/select-branch.
Java Gateway là legacy/đã xóa, không document như runtime hiện tại.
Gateway làm gì
- Nhận backend traffic từ frontend.
- Route auth calls tới Identity Service.
- Route protected business APIs tới downstream services.
- Validate client
JWTbằng IdentityJWKS. - Guard route family ở mức coarse context: account, branch/platform, system.
- Xóa context headers do client tự gửi.
- Inject
trusted headerstừ verified token claims. - Normalize và propagate
X-Request-Id,X-Correlation-Id. - Ghi structured access logs theo request.
- Xử lý CORS preflight
OPTIONSlocal tại Gateway.
Gateway không làm gì
- Không login user.
- Không issue
JWT. - Không sở hữu
account, credential, session. - Không resolve permission/capability chi tiết.
- Không own setup/billing business behavior.
- Không query business DB.
- Không verify lại token thay downstream theo từng domain permission.
Runtime đóng hiện tại
Validated qua Gateway:
| Hành vi | Trạng thái |
|---|---|
GET /healthz | Đã đóng |
POST /api/auth/login | Đã đóng |
POST /api/auth/refresh | Đã đóng |
POST /api/auth/select-branch | Đã đóng |
CORS OPTIONS trả 204 | Đã đóng |
GET /api/workspaces/current-context route tới Entitlement Service | Reachable, Entitlement chưa đóng |
Liên quan
- Runtime API Gateway
- Routes API Gateway
- JWT validation
- Trusted headers
- Observability API Gateway
- Mô hình token và context
TODO
- Chưa đóng: Entitlement Service E2E qua Gateway.
- Chưa đóng: retry/circuit breaker behavior trong runtime docs.