Checkpoint
Go Gateway và Identity đã đóng
Checkpoint kỹ thuật ngày 2026-06-25 cho Go API Gateway và Go Identity Service.
Go Gateway và Identity đã đóng
Mục tiêu
Ghi lại checkpoint ngày 2026-06-25: Go API Gateway và Go Identity Service đã đóng cho local compose, frontend auth và select-branch.
Trạng thái hiện tại
Đã đóng:
- API Gateway repo/folder:
api-gateway - Gateway container:
centeros-api-gateway - Gateway image:
dorrissdang/centeros-api-gateway:main - Gateway port:
8080 - Identity Service repo/folder:
identity-service - Identity container:
centeros-identity-service - Identity image:
dorrissdang/centeros-identity-service:main - Identity port:
8081
Java Gateway và Java Identity là legacy/đã xóa, không phải runtime hiện tại.
Validated Gateway behavior:
GET /healthzPOST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/select-branchGET /api/workspaces/current-contextroute được tới Entitlement Service, nhưng Entitlement Service chưa đóng.- CORS preflight được xử lý local tại Gateway,
OPTIONStrả204.
Validated Identity behavior:
GET /healthzGET /.well-known/jwks.jsonPOST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/select-branch
Frontend validation:
- Login works.
- Refresh works after valid session.
- Manager multi-branch login works.
- Select branch works.
- First stale/missing
/api/auth/refreshtrả401là acceptable nếu login/refresh sau đó thành công.
Luồng chính
Frontend
→ Go API Gateway
→ Go Identity Service
→ PostgreSQL
Manager multi-branch
→ POST /api/auth/login
→ accountAccessToken + branches[]
→ POST /api/auth/select-branch
→ branch-scoped accessTokenQuy tắc quan trọng
Token roles:
accountAccessToken: account-scoped token dùng cho select/switch branch.accessToken: branch-scoped token dùng cho business APIs sau khi branch context đã chọn.refreshToken: session rotation token, cũng được set làm HttpOnly cookie khi applicable.
Gateway trusted headers sau branch token:
X-Account-IdX-Workspace-IdX-Member-IdX-Active-Branch-IdX-Branch-IdsX-RolesX-Token-Scope=BRANCHX-Request-IdX-Correlation-Id
Downstream services như Entitlement Service nên consume Gateway trusted headers. Downstream services không nên verify client JWT trong normal internal runtime.
Liên quan
TODO
Remaining work cho Entitlement Service:
- Direct Entitlement Bruno regression.
- Entitlement + Payment Java billing-context integration.
- Gateway -> Entitlement E2E.
- Validate Flow 3 / 4A / 4B.
- Connect FE setup/current-context fully.