Skip to content

feat: 헤더 통일 + 서비스별 라우팅 분리 - #3

Merged
HellWorlding merged 4 commits into
mainfrom
feature/#2-gateway-auth
Apr 5, 2026
Merged

feat: 헤더 통일 + 서비스별 라우팅 분리#3
HellWorlding merged 4 commits into
mainfrom
feature/#2-gateway-auth

Conversation

@HellWorlding

@HellWorlding HellWorlding commented Apr 5, 2026

Copy link
Copy Markdown
Member

작업 내용

Summary by CodeRabbit

릴리스 노트

  • 설명서

    • 게이트웨이의 라우팅 규칙, 인증/권한 동작 및 기술 스택(Keycloak JWT 검증, 서비스 디스커버리) 문서화 업데이트
  • 개선사항

    • 여러 API 엔드포인트에 대한 명시적 라우팅 규칙 추가(사용자, 주문, 허브, 재고, 경로, 회사, 항목, 배송)
    • Keycloak 호스트 포트 기본값을 13300으로 변경
    • 요청 처리 시 사용자 인증 헤더 처리 방식 개선(역할 헤더명 변경 및 JWT 클레임 기반 헤더 적용)

@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7103dbde-2a30-496c-a4a8-8b4dfbcc311a

📥 Commits

Reviewing files that changed from the base of the PR and between 2d320b7 and 0f97bf9.

📒 Files selected for processing (1)
  • docker-compose-dev.yml
✅ Files skipped from review due to trivial changes (1)
  • docker-compose-dev.yml

📝 Walkthrough

Walkthrough

게이트웨이의 라우팅 및 인증 관련 문서와 설정을 업데이트했습니다. README에 Spring Security OAuth2 Resource Server(Keycloak JWT 검증), Eureka 클라이언트, 요청 라우팅 규칙 및 UserContextFilter 동작(클레임을 특정 헤더로 변환, name 클레임 URL-인코딩, 기존 사용자 헤더 초기화 및 재적용, 인증 없는 요청 허용)이 추가되었습니다. UserContextFilter에서 사용자 역할 헤더 이름을 X-User-Roles에서 X-User-Role로 변경했고, application.yaml의 Keycloak issuer-uri 포트가 3300에서 13300으로 수정되었으며 단일 /api/** 라우트가 서비스별로 분리된 여러 명시적 라우트로 대체되었습니다. docker-compose-dev.yml의 keycloak 호스트 포트 매핑도 3300:8080에서 13300:8080으로 변경되었습니다.

Suggested reviewers

  • HyeonBin2379
  • oni128
  • yeonhee-Moon
  • sweetRainShin

Poem

🐇 작은 토끼의 게이트웨이 축시

헤더 하나로 통일했네, 부드러운 숨결로,
여덟 갈래 길에 서비스들이 반짝이고,
Keycloak은 멀리 13300으로 이사했지,
JWT 속 이름은 조심스레 인코딩해 전해주리,
hop~ hop~ 새로운 길 위에 깃든 기쁨! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning 변경 사항이 이슈 #2의 주요 요구사항 중 대부분을 충족하나, 공개 경로 설정과 CLAUDE.md 업데이트는 미완료 상태입니다. 공개 경로 설정 기능 구현과 CLAUDE.md 파일 업데이트를 완료하거나, 이들 작업을 별도의 후속 PR로 분리하여 처리하십시오.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 헤더 통일(X-User-Roles → X-User-Role)과 서비스별 라우팅 분리 변경을 정확하게 요약하고 있습니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항이 이슈 #2의 범위 내에 있으며, 요청되지 않은 추가 변경 사항은 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#2-gateway-auth

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/application.yaml`:
- Around line 32-35: The route with id "hub-inventory-service" currently points
to "lb://HUB-SERVICE" which breaks per-service routing separation; update the
route's uri to the inventory-specific service (e.g.,
"lb://HUB-INVENTORY-SERVICE" or the correct inventory service logical name)
while keeping the predicates (Path=/api/hub-inventories/**,
/internal/hub-inventories/**) unchanged; also search for any usages of
"hub-inventory-service" or "HUB-SERVICE" in routing config and tests and update
them to the inventory service name to keep configs consistent.
- Around line 17-55: Security is currently disabled at the gateway because
SecurityConfig uses anyExchange().permitAll(); change the security configuration
so only explicit public endpoints (e.g., /api/auth/**, /api/users/signup) are
allowed via permitAll() and all other routes require authentication by replacing
the global anyExchange().permitAll() with a matcher-based rule that permits the
specific public Path predicates and calls authenticated() (or requires
authentication) for everything else; look for SecurityConfig and the
anyExchange().permitAll() usage and update it to enumerate public paths and
default to authenticated().
- Line 11: The configured default issuer-uri in application.yaml (issuer-uri:
${ISSUER_URI:http://localhost:13300/realms/my-realm}) uses port 13300 which
mismatches the Keycloak mapping in docker-compose-dev.yml (3300:8080); update
the default ISSUER_URI value to use port 3300 (e.g.,
http://localhost:3300/realms/my-realm) or alternatively add a README note
requiring the ISSUER_URI env var for local dev so JWT verification won’t fail;
ensure you modify the issuer-uri line in application.yaml and/or add the
documentation entry referencing ISSUER_URI and the docker-compose-dev.yml
Keycloak port mapping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b76de6c4-8307-4267-8fed-b4fb922ee0d2

📥 Commits

Reviewing files that changed from the base of the PR and between 4dac2ab and 2d320b7.

📒 Files selected for processing (3)
  • README.md
  • src/main/java/com/loopang/gateway/config/UserContextFilter.java
  • src/main/resources/application.yaml

Comment thread src/main/resources/application.yaml
Comment thread src/main/resources/application.yaml
Comment thread src/main/resources/application.yaml
@HellWorlding
HellWorlding merged commit 869d2f9 into main Apr 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Gateway 헤더 통일 + 공개 경로 설정

1 participant