Skip to content

merge: (#1034) gateway 서버를 main서버로 흡수 - #1038

Merged
yellowstarr0323 merged 9 commits into
developfrom
feat/1034-gateway-server
Jul 22, 2026
Merged

merge: (#1034) gateway 서버를 main서버로 흡수#1038
yellowstarr0323 merged 9 commits into
developfrom
feat/1034-gateway-server

Conversation

@yellowstarr0323

@yellowstarr0323 yellowstarr0323 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

작업 내용 설명

  • JWT 필터 이관 (gateway의 Passport 기반 인증 → main의 JWT 인증 방식으로 전환)
  • CORS 설정 이관 (gateway의 globalcors 설정을 main으로 이관)
  • dms-gateway 모듈 삭제 및 CI/jacoco 설정 정리

주요 변경 사항

  • gateway의 Mono 기반 JWT 검증 로직을 main에 동기 버전(JwtParser/JwtAuthenticationFilter)으로 포팅, Passport HMAC 무결성 계층(PassportIntegrityGenerator/PassportValidator/PassportProperties 등) 제거
  • gateway의 globalcors 설정을 main의 CorsConfigurationSource 빈(CorsConfig/CorsProperties)으로 포팅
  • dms-gateway(gateway-core, gateway-infrastructure) 모듈 및 Dockerfile 삭제
  • settings.gradle.kts, build.gradle.kts(jacocoGatewayServiceReport 태스크), .github/workflows/CI.yml, codecov.yml에서 gateway 관련 설정 제거
  • contracts 모듈은 main-core/persistence/infrastructure/presentation이 직접 의존 중이라 삭제 대상에서 제외(원래 이슈 체크리스트엔 삭제 대상으로 적혀 있었으나 확인 후 제외)

참고 (리뷰 시 확인 필요)

  • .github/workflows/prod-cd.yml의 gateway 배포 관련 항목은 이번 PR에 포함하지 않음 — 별도로 정리 예정
  • gateway 삭제 후 API 경로 동작은 정적으로만 확인함(gateway가 원래 path rewrite 없이 catch-all로만 라우팅했고, main의 SecurityConfig가 이미 모든 경로를 갖고 있음). 로컬에 DB/Redis 등 인프라가 없어 실제 기동 E2E 테스트는 못 함 — 배포 전 확인 필요
  • gateway가 NAT 인스턴스 역할도 겸하고 있어서, 인프라(Terraform, 별도 리포) 쪽 재설계가 필요함 — 이번 PR 범위 밖

체크리스트

  • 어플리케이션 구동(혹은 테스트)시 오류는 없나요?
  • 생성된 코드에 Javadoc 주석을 추가 하였나요?
  • 생성된 코드에 대한 테스트 코드가 작성 되었나요?

관련 이슈

Summary by CodeRabbit

  • 새로운 기능

    • CORS 정책을 추가해 허용된 출처/메서드/헤더와 노출 헤더를 관리합니다.
    • JWT 기반 인증을 위한 필터/토큰 검증 흐름을 도입했습니다.
  • 변경 사항

    • 게이트웨이 서비스가 빌드/배포 대상에서 제거되었습니다.
    • 인증이 패스포트 기반에서 JWT 기반으로 전환되었고, 패스포트 관련 설정은 더 이상 사용되지 않습니다.
    • 인증 예외(permit-all) 경로가 HTTP 메서드까지 포함해 더 정교하게 동작합니다.
  • 테스트/운영

    • JWT 인증/검증 테스트를 추가하고, 커버리지 보고 범위를 메인 서비스 중심으로 조정했습니다.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 15749340-be65-4de3-aff1-ae993aa8915e

📥 Commits

Reviewing files that changed from the base of the PR and between 137981d and 5dc067f.

📒 Files selected for processing (2)
  • codecov.yml
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt

Walkthrough

Gateway의 JWT 인증과 CORS를 dms-main으로 이전하고, Passport 무결성 계층과 dms-gateway 모듈을 제거했다. Gradle, CI, JaCoCo, Codecov 설정은 main 서비스만 대상으로 조정했다.

Changes

Gateway 기능 통합 및 제거

Layer / File(s) Summary
JWT 인증 흐름 이전
dms-main/main-core/..., dms-main/main-infrastructure/.../security/token/*, .../global/filter/*, .../test/*
JwtParserJwtAuthenticationFilter를 추가하고 메서드별 permit-all 경로, 토큰 검증, 권한별 인증 객체 생성을 구성했다.
Main CORS 구성 통합
dms-main/main-infrastructure/.../global/config/*, .../global/security/*, .../resources/application.yml
CORS 프로퍼티와 설정 빈을 추가하고 Spring Security가 명시적 CorsConfigurationSource를 사용하도록 변경했다.
Gateway 모듈 및 품질 설정 제거
settings.gradle.kts, build.gradle.kts, .github/workflows/CI.yml, codecov.yml, dms-gateway/...
Gateway 모듈과 관련 소스를 제거하고 Gradle·CI·JaCoCo·Codecov 구성을 main 서비스 기준으로 축소했다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • team-aliens/DMS-Backend issue 1036: Gateway 모듈 제거와 기능의 dms-main 이전을 다룬다.
  • team-aliens/DMS-Backend issue 1035: CORS 설정을 dms-main으로 이전한 변경과 연결된다.
  • team-aliens/DMS-Backend issue 1037: Gradle, JaCoCo, CI에서 Gateway 참조를 제거한 변경과 연결된다.

Possibly related PRs

Suggested labels: chore

Suggested reviewers: 4mjeo, ilyoil2, kkm06100

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant JwtAuthenticationFilter
  participant JwtParser
  participant SecurityContext
  Client->>JwtAuthenticationFilter: Bearer JWT 요청
  JwtAuthenticationFilter->>JwtParser: extractUserInfo(token)
  JwtParser-->>JwtAuthenticationFilter: PassportUser
  JwtAuthenticationFilter->>SecurityContext: 인증 객체 저장
  JwtAuthenticationFilter-->>Client: 필터 체인 계속 진행
Loading

Poem

깡충, 게이트웨이 문 닫고
메인 토끼가 길을 잇네
JWT를 귀에 달고
CORS 바람을 맞으며
테스트 당근도 한 아름! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 gateway 기능을 main 서버로 흡수한다는 핵심 변경을 명확히 요약합니다.
Linked Issues check ✅ Passed JWT/Passport 이관, CORS 포팅, gateway 모듈·CI·Jacoco 정리, 단위 테스트 추가 등 #1034 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 gateway 흡수와 모듈 정리에 집중되어 있으며, 목적과 무관한 별도 기능 추가는 보이지 않습니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1034-gateway-server

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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

🧹 Nitpick comments (1)
dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt (1)

34-49: 📐 Maintainability & Code Quality | 🔵 Trivial

예상치 못한 예외의 원인 정보가 사라집니다.

catch (e: Exception) { throw InternalServerError }에서 원본 예외 e를 로깅하거나 cause로 체이닝하지 않아, 실제 운영 환경에서 500 에러가 발생했을 때 근본 원인을 추적하기 어렵습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt`
around lines 34 - 49, Update the unexpected-exception handler in getClaims so
the original exception e is preserved when throwing InternalServerError, either
by chaining it as the cause or logging it through the established error-logging
mechanism. Keep the existing ExpiredJwtException, InvalidClaimException, and
JwtException handling unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@codecov.yml`:
- Line 9: 실제 업로드 수와 일치하도록 codecov.yml 9-9의 after_n_builds 값을 조정하세요.
.github/workflows/CI.yml 23-23의 codecov-action은 main-service에 대해 한 번만 실행되므로 해당
단일 업로드를 기다리도록 설정하고, CI.yml에는 별도 변경이 필요 없습니다.

In
`@dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/JwtAuthenticationFilter.kt`:
- Around line 28-33: Update JwtAuthenticationFilter.shouldNotFilter to consider
the request HTTP method alongside the path, so only methods explicitly allowed
for each SecurityPaths.PERMIT_ALL_PATHS entry bypass JWT parsing. Ensure
/schools/code bypasses authentication for GET but not PATCH, preserving the
existing path-matching behavior for other permitted paths.

In
`@dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt`:
- Around line 52-56: Update the authority parsing in JwtParser so a missing
AUTHORITY claim is also converted to InvalidTokenException. Handle the nullable
result from claims.get(...) together with invalid enum values, while preserving
the existing valid-authority behavior.

---

Nitpick comments:
In
`@dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt`:
- Around line 34-49: Update the unexpected-exception handler in getClaims so the
original exception e is preserved when throwing InternalServerError, either by
chaining it as the cause or logging it through the established error-logging
mechanism. Keep the existing ExpiredJwtException, InvalidClaimException, and
JwtException handling unchanged.
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 9ef59b61-7d59-434b-ae37-ecc02b6799c4

📥 Commits

Reviewing files that changed from the base of the PR and between c286c2a and 6c72769.

📒 Files selected for processing (57)
  • .github/workflows/CI.yml
  • build.gradle.kts
  • codecov.yml
  • dms-gateway/Dockerfile
  • dms-gateway/build.gradle.kts
  • dms-gateway/gateway-core/build.gradle.kts
  • dms-gateway/gateway-core/config/detekt/detekt.yml
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/DmsException.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/ErrorProperty.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/ErrorStatus.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Authority.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Passport.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/UserAuthInfo.kt
  • dms-gateway/gateway-infrastructure/build.gradle.kts
  • dms-gateway/gateway-infrastructure/config/detekt/detekt.yml
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/DmsGatewayApplication.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/JacksonConfig.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/PropertiesScanConfig.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/RouteConfig.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/properties/ServicesProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GatewayGlobalExceptionHandler.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GlobalErrorCode.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GlobalExceptions.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/AuthorizationHeaderGatewayFilterFactory.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/SecurityPaths.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/SecurityProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/ExpiredTokenException.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/InvalidTokenException.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/error/SecurityErrorCode.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportAdapter.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportIntegrityGenerator.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportSecurityProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/resources/application-dev.yml
  • dms-gateway/gateway-infrastructure/src/main/resources/application-local.yml
  • dms-gateway/gateway-infrastructure/src/main/resources/application-prod.yml
  • dms-gateway/gateway-infrastructure/src/main/resources/application.yml
  • dms-gateway/gateway-infrastructure/src/test/kotlin/team/aliens/GatewayApplicationTests.kt
  • dms-main/main-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Passport.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/config/CorsConfig.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/config/PropertiesScanConfig.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/FilterConfig.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/JwtAuthenticationFilter.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/PassportFilter.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/CorsProperties.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/SecurityConfig.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportIntegrityGenerator.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportProperties.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportSecurityProperties.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportValidator.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt
  • dms-main/main-infrastructure/src/main/resources/application.yml
  • dms-main/main-infrastructure/src/test/kotlin/team/aliens/dms/global/filter/JwtAuthenticationFilterTest.kt
  • dms-main/main-infrastructure/src/test/kotlin/team/aliens/dms/global/security/token/JwtParserTest.kt
  • settings.gradle.kts
💤 Files with no reviewable changes (44)
  • dms-gateway/gateway-infrastructure/src/main/resources/application-local.yml
  • dms-gateway/gateway-infrastructure/src/test/kotlin/team/aliens/GatewayApplicationTests.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportSecurityProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/properties/ServicesProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/resources/application.yml
  • dms-gateway/build.gradle.kts
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/UserAuthInfo.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/DmsException.kt
  • dms-gateway/gateway-core/build.gradle.kts
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/DmsGatewayApplication.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/PropertiesScanConfig.kt
  • dms-gateway/Dockerfile
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/ErrorProperty.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GlobalExceptions.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportSecurityProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportProperties.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportValidator.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Authority.kt
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportIntegrityGenerator.kt
  • dms-gateway/gateway-core/config/detekt/detekt.yml
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Passport.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/SecurityPaths.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/InvalidTokenException.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GatewayGlobalExceptionHandler.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtProperties.kt
  • dms-gateway/gateway-infrastructure/src/main/resources/application-dev.yml
  • dms-main/main-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/PassportFilter.kt
  • dms-gateway/gateway-infrastructure/src/main/resources/application-prod.yml
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/error/GlobalErrorCode.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/JacksonConfig.kt
  • dms-gateway/gateway-core/src/main/kotlin/team/aliens/dms/common/error/ErrorStatus.kt
  • dms-gateway/gateway-infrastructure/config/detekt/detekt.yml
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportIntegrityGenerator.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/error/SecurityErrorCode.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/exception/ExpiredTokenException.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/SecurityProperties.kt
  • dms-main/main-core/src/main/kotlin/team/aliens/dms/domain/auth/model/Passport.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/passport/PassportAdapter.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/security/token/JwtParser.kt
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/config/RouteConfig.kt
  • settings.gradle.kts
  • dms-gateway/gateway-infrastructure/build.gradle.kts
  • dms-gateway/gateway-infrastructure/src/main/kotlin/team/aliens/dms/global/filter/AuthorizationHeaderGatewayFilterFactory.kt

Comment thread codecov.yml Outdated
@yellowstarr0323
yellowstarr0323 force-pushed the feat/1034-gateway-server branch from 5dc067f to 008008b Compare July 22, 2026 05:18
@github-actions

Copy link
Copy Markdown

📊 Main Service Coverage Report

Overall Project 15.11% -0.09%
Files changed 80.2% 🍏

File Coverage
InvalidTokenException.kt 100% 🍏
ExpiredTokenException.kt 100% 🍏
Passport.kt 100% 🍏
Authority.kt 100% 🍏
JwtAuthenticationFilter.kt 100% 🍏
SecurityPaths.kt 100% 🍏
JwtParser.kt 92.11% 🍏
SecurityErrorCode.kt 80.49% 🍏
DmsException.kt 75% 🍏
ErrorProperty.kt 0% 🍏
FilterConfig.kt 0% -57.5%
GlobalErrorCode.kt 0% 🍏
SecurityConfig.kt 0% -0.65%

@yellowstarr0323
yellowstarr0323 merged commit 984a3cf into develop Jul 22, 2026
4 checks passed
@yellowstarr0323
yellowstarr0323 deleted the feat/1034-gateway-server branch July 22, 2026 06:33
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.

gateway 서버를 main서버로 흡수

1 participant