Skip to content

fix : 공개api (swagger, auth) 에서 토큰 검증요구 에러#268

Merged
gisu1102 merged 2 commits intomainfrom
develop
Oct 7, 2025
Merged

fix : 공개api (swagger, auth) 에서 토큰 검증요구 에러#268
gisu1102 merged 2 commits intomainfrom
develop

Conversation

@gisu1102
Copy link
Contributor

@gisu1102 gisu1102 commented Oct 7, 2025

#️⃣ 연관된 이슈

#266
#263

📝 작업 내용

fix : 공개api (swagger, auth) 에서 토큰 검증요구 에러

Summary by CodeRabbit

  • 신기능

    • 공개 API 경로 설정이 추가되어, 지정된 일부 엔드포인트에 인증 없이 접근할 수 있습니다.
    • 보안 필터가 공개 경로를 인식해 불필요한 인증 과정을 생략, 접근성이 향상되었습니다.
  • 개선

    • 보안 설정이 공개/비공개 경로를 명확히 구분하도록 정비되어 전반적 사용 경험이 향상되었습니다.
  • 기타

    • 하위 모듈 참조가 최신 커밋으로 업데이트되었습니다.

gisu1102 and others added 2 commits October 7, 2025 14:07
fix : 공개api (swagger, auth) 에서 토큰 검증요구 에러
@gisu1102 gisu1102 merged commit 3f94a13 into main Oct 7, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

보안 구성에 PublicApiProperties를 도입하여 공개 API 경로를 설정으로 관리하고, SecurityConfig와 JwtAuthenticationFilter에 이를 주입해 필터 흐름에서 공개 경로를 조기 우회하도록 변경했습니다. 리소스 하위모듈 커밋 해시가 갱신되었습니다.

Changes

Cohort / File(s) Change Summary
보안 구성 주입 추가
src/main/java/inu/codin/codin/common/config/SecurityConfig.java
PublicApiProperties 필드/주입 추가. public URL 허용 목록을 publicApiProperties로 확장. JwtAuthenticationFilter 생성자에 publicApiProperties 인자 전달.
공개 API 프로퍼티 도입
src/main/java/inu/codin/codin/common/dto/PublicApiProperties.java
@ConfigurationProperties(prefix = "security.public-api")로 urls(List) 바인딩하는 설정 클래스 신규 추가.
JWT 필터 흐름 수정
src/main/java/inu/codin/codin/common/security/filter/JwtAuthenticationFilter.java
PublicApiProperties 주입/필드 추가. 요청 URI가 permitAll 또는 public-api에 해당하면 조기 우회. isPublicApi 검사 로직 도입 및 제어 흐름 분기 조정.
리소스 서브모듈 갱신
src/main/resources
서브모듈 커밋 해시 업데이트(기능 변화 없음).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant F as JwtAuthenticationFilter
  participant P as PermitAllProperties
  participant A as PublicApiProperties
  participant J as JwtService
  participant S as SecurityContext
  participant H as Downstream Handler

  C->>F: HTTP Request
  F->>P: isPermitAll(requestURI)?
  alt PermitAll
    note over F,H: 공개 경로(permitAll) → 인증 우회
    F-->>H: chain.doFilter
  else Not PermitAll
    F->>A: isPublicApi(requestURI)?
    alt Public API
      note over F,H: 공개 API(public-api) → 인증 우회
      F-->>H: chain.doFilter
    else Protected
      F->>J: parse/validate JWT
      alt Token 유효
        F->>S: set Authentication
        F-->>H: chain.doFilter
      else Token 없음/무효
        note over F: 인증 미설정 상태로 진행 또는 에러 처리(구현에 따름)
        F-->>H: chain.doFilter / error
      end
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

작은 발로 톡톡, 경로를 헤아려 보니 🐇
permitAll 숲 지나 public-api 들판까지 🌿
토큰 문은 잠시 쉬고, 길은 곧장 열리고 🔐
필터는 살짝 비켜서고, 흐름은 매끈히 흐르네 🌐
깡충—설정의 별을 따와 보안 하늘에 달았지 ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72a37a0 and bf3a154.

📒 Files selected for processing (4)
  • src/main/java/inu/codin/codin/common/config/SecurityConfig.java (4 hunks)
  • src/main/java/inu/codin/codin/common/dto/PublicApiProperties.java (1 hunks)
  • src/main/java/inu/codin/codin/common/security/filter/JwtAuthenticationFilter.java (4 hunks)
  • src/main/resources (1 hunks)

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 and usage tips.

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.

1 participant