Skip to content

BUG/15 회원가입 외 User 서비스 public path 해제 - #16

Merged
mimimya merged 3 commits into
devfrom
bug/15-user-service-public-path-exclusion
May 4, 2026
Merged

mimimya merged 3 commits into
devfrom
bug/15-user-service-public-path-exclusion

Conversation

@mimimya

@mimimya mimimya commented May 4, 2026

Copy link
Copy Markdown
Contributor

📝 작업 내용

이번 PR에서 작업한 내용을 설명해주세요.

  • [BUG] 회원가입 외 User 서비스 public path 해제

  • 회원가입에서만 JWT 검증 필터를 건너뛰도록 public 경로를 설정해야했는데,
    /api/v1/users가 public path로 등록되어있었음.

  • POST /users 요청에 한해서만 검증 처리 하지 않도록 Filter 화이트리스트 설정

  • 에러 응답을 공통 모듈과 같은 형태로 수정

🚀 주요 변경 사항

완료한 이슈 번호
Close #15
관련된 이슈 번호 (닫고 싶지 않은 경우)
Related to #

✅ 자체 체크리스트 (필수)

  • ./gradlew build 실행 결과 정상 (인증샷 첨부)
  • Postman 테스트 완료 (인증샷 첨부)
  • 팀 내 컨벤션 준수 및 불필요한 로그, import 제거
  • 중요한 변경 사항이 팀에 공유되었는지

📸 테스트 인증샷

빌드 결과 및 Postman 실행 화면을 여기에 첨부해 주세요.

image

💬 리뷰어 전달사항 (선택)

특별히 봐주었으면 하는 부분이나 논의가 필요한 점을 적어주세요.

  • 논의점


📎 참고 자료

관련 문서, 레퍼런스 링크 등이 있다면 여기에 첨부해주세요.

Summary by CodeRabbit

  • 새로운 기능

    • 통합 오류 처리와 표준화된 JSON 오류 응답 추가
    • 공통 및 서비스별 오류 코드 체계 도입
  • 개선사항

    • 인증 실패 시 일관된 오류 코드와 메시지 반환
    • 필드 단위 검증 오류 정보를 오류 응답에 포함
  • 기타

    • 브랜치 네이밍 규칙에 bug/ 접두사 허용 추가

mimimya added 2 commits May 4, 2026 12:24
- GatewayExceptionHandler 작성
- 서비스 공통모듈과 같은 형태 적용
@mimimya mimimya self-assigned this May 4, 2026
@mimimya mimimya linked an issue May 4, 2026 that may be closed by this pull request
3 tasks
@coderabbitai

coderabbitai Bot commented May 4, 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 Plus

Run ID: ecf20bab-5b7a-4ed9-93ea-b5601d8a5495

📥 Commits

Reviewing files that changed from the base of the PR and between 238aa06 and 172689a.

📒 Files selected for processing (1)
  • .github/workflows/branch-name-check.yml

📝 Walkthrough

Walkthrough

새로운 중앙 에러 처리 인프라가 추가되었습니다: ErrorCode 계약과 CommonErrorCode/GatewayErrorCode 열거형, BusinessException, ErrorResponse DTO, GatewayExceptionHandler 및 이를 등록하는 ErrorConfig가 도입되었고, AuthenticationFilter는 수동 응답 대신 예외를 던지도록 변경되며 공개 경로 설정에서 /api/v1/users가 제거되었습니다.

Changes

중앙집중형 에러 처리 및 인증 리팩터

Layer / File(s) Summary
데이터 형태 / 계약
src/main/java/com/pagely/gateway/domain/exception/ErrorCode.java
ErrorCode 인터페이스 추가 (getCode(), getMessage(), getHttpStatus()).
공통/게이트웨이 에러 열거형
src/main/java/com/pagely/gateway/domain/exception/CommonErrorCode.java, src/main/java/com/pagely/gateway/domain/exception/GatewayErrorCode.java
CommonErrorCode(여러 4xx/5xx), GatewayErrorCode(토큰 관련 3개)를 추가해 ErrorCode 구현.
핵심 예외 타입
src/main/java/com/pagely/gateway/domain/exception/BusinessException.java
RuntimeException 확장 BusinessException 추가; 불변 ErrorCode 필드와 두 생성자(코드만 / 코드+상세 메시지).
응답 DTO
src/main/java/com/pagely/gateway/domain/exception/ErrorResponse.java
JSON 직렬화용 ErrorResponse DTO 추가 (code, message, 선택적 fieldErrors) 및 FieldError 중첩 클래스.
설정 및 핸들러 등록
src/main/java/com/pagely/gateway/infrastructure/config/ErrorConfig.java
GatewayExceptionHandler@Primary·@Order(-2)로 빈 등록.
예외 처리 구현
src/main/java/com/pagely/gateway/infrastructure/exception/GatewayExceptionHandler.java
WebFlux ErrorWebExceptionHandler 구현: BusinessException에서 ErrorCode 추출, 상태/헤더 설정, ErrorResponse 직렬화 및 쓰기, 직렬화 실패시 폴백 바디.
인증 필터 통합 변경
src/main/java/com/pagely/gateway/infrastructure/security/AuthenticationFilter.java
수동 401 응답 생성 제거. 인증 실패 시 BusinessException(적절한 CommonErrorCode/GatewayErrorCode)을 던지도록 변경. POST /api/v1/users만 인증 스킵 로직 추가.
설정 변경
src/main/resources/application.yml
jwt.public-paths에서 /api/v1/users 제거 (이제 POST 전용으로 필터가 스킵됨).

시퀀스 다이어그램

sequenceDiagram
    actor Client
    participant AuthFilter as AuthenticationFilter
    participant Handler as GatewayExceptionHandler
    participant Spring as Spring Framework
    participant Response

    Client->>AuthFilter: 요청 (예: /api/v1/users, Authorization: Bearer ...)
    alt POST /api/v1/users (회원가입)
        AuthFilter->>Spring: 인증 스킵, 요청 전달
        Spring->>Response: 정상 처리
    else 다른 경로
        AuthFilter->>AuthFilter: 토큰 추출/검증
        alt 토큰 유효
            AuthFilter->>Spring: 헤더 추가 후 전달
            Spring->>Response: 정상 처리
        else 토큰 실패
            AuthFilter->>Handler: BusinessException 발생
            Handler->>Handler: ErrorCode 결정 및 ErrorResponse 생성
            Handler->>Response: JSON 바디와 상태 코드 쓰기
            Response->>Client: 에러 응답
        end
    end
Loading

코드 리뷰 난이도 평가

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Feat/2 jwt authentication #13: AuthenticationFilter 및 JWT 인증 흐름을 도입한 PR로, 본 PR의 인증 예외 처리 리팩터와 강한 관련성 있음.

Suggested reviewers

  • gnoesnooj
  • hhegi
  • jsh9057
  • soo96

🐰 오류는 토끼처럼 뛰어와도,
예외는 정리해 한곳에 담고,
토큰은 검사해 문을 열고 닫아,
회원가입만 살짝 열어두니,
응답은 일관되게, 모두가 웃네.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning application.yml의 public path 제거와 AuthenticationFilter 수정은 #15와 직접 관련이 있으나, 새로운 예외 클래스 및 에러 처리 구조 추가, GitHub 워크플로우 업데이트는 범위를 벗어난 변경입니다. 예외 체계 및 에러 응답 구조 추가, GitHub 워크플로우 수정은 별도 PR로 분리하거나 #15의 요구사항과의 연관성을 명확히 문서화하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 주요 변경 내용인 /api/v1/users의 public path 제거와 관련된 버그 수정을 명확히 설명합니다.
Linked Issues check ✅ Passed PR이 #15의 세 가지 요구사항을 모두 충족합니다: public path에서 /api/v1/users 제거, POST /users만 JWT 검증 제외, 공통 모듈 형식의 에러 응답 구현.

✏️ 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 bug/15-user-service-public-path-exclusion

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Review rate limit: 8/10 reviews remaining, refill in 6 minutes and 8 seconds.

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: 1

🤖 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/java/com/pagely/gateway/infrastructure/exception/GatewayExceptionHandler.java`:
- Around line 65-70: determineErrorCode currently maps every
non-BusinessException to CommonErrorCode.INTERNAL_SERVER_ERROR causing WebFlux
4xx/404 statuses to be lost; update determineErrorCode to detect WebFlux
exceptions (e.g., ResponseStatusException, ServerWebInputException,
WebExchangeBindException) and return appropriate ErrorCode values (map
ServerWebInputException and WebExchangeBindException to a BAD_REQUEST/ErrorCode
matching 400, and for ResponseStatusException derive the ErrorCode from the
exception's status), falling back to CommonErrorCode.INTERNAL_SERVER_ERROR
otherwise; reference determineErrorCode, BusinessException,
ResponseStatusException, ServerWebInputException, WebExchangeBindException and
CommonErrorCode in your change.
🪄 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 Plus

Run ID: b050805c-2ee1-4cde-8a16-935637ba1682

📥 Commits

Reviewing files that changed from the base of the PR and between ccc9e04 and 238aa06.

📒 Files selected for processing (9)
  • src/main/java/com/pagely/gateway/domain/exception/BusinessException.java
  • src/main/java/com/pagely/gateway/domain/exception/CommonErrorCode.java
  • src/main/java/com/pagely/gateway/domain/exception/ErrorCode.java
  • src/main/java/com/pagely/gateway/domain/exception/ErrorResponse.java
  • src/main/java/com/pagely/gateway/domain/exception/GatewayErrorCode.java
  • src/main/java/com/pagely/gateway/infrastructure/config/ErrorConfig.java
  • src/main/java/com/pagely/gateway/infrastructure/exception/GatewayExceptionHandler.java
  • src/main/java/com/pagely/gateway/infrastructure/security/AuthenticationFilter.java
  • src/main/resources/application.yml
💤 Files with no reviewable changes (1)
  • src/main/resources/application.yml

@mimimya

mimimya commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

브렌치 네이밍 bug->fix 다음부터 제대로 적용하겠습니다...!

@mimimya
mimimya merged commit 4256039 into dev May 4, 2026
3 checks passed
@mimimya
mimimya deleted the bug/15-user-service-public-path-exclusion branch May 18, 2026 01:29
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.

[BUG] 회원가입 외 User 서비스 public path 해제

4 participants