Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jun 27, 2025

작업 내용

  • refresh토큰이 헤더에 들어가지 않는 문제 해결

트러블 슈팅

  • Swagger이름과 헤더 이름을 다르게 설정함

해결해야 할 문제

  • 포스트맨에서는 작동하지만 스웨거 이름 아직 변경x

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 버그 수정
    • 토큰 갱신 엔드포인트에서 사용되는 HTTP 헤더가 "JWT_REFRESH"에서 "Authorization"으로 변경되었습니다.
    • 이제 "Authorization" 헤더에서 Bearer 토큰을 추출하도록 동작이 개선되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jun 27, 2025

Walkthrough

토큰 리프레시 엔드포인트의 시큐리티 요구 사항 어노테이션이 "JWT_REFRESH"에서 "Authorization"으로 변경되었습니다. 또한, 리프레시 토큰을 추출하는 HTTP 헤더도 "JWT_REFRESH"에서 "Authorization"으로 변경되었습니다. 토큰 추출 로직은 동일하게 유지됩니다.

Changes

파일/경로 변경 요약
src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java 리프레시 토큰 엔드포인트의 시큐리티 어노테이션과 헤더명을 "JWT_REFRESH"에서 "Authorization"으로 변경

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AuthController
    participant HttpServletRequest

    Client->>AuthController: POST /refresh (Authorization: Bearer <refresh_token>)
    AuthController->>HttpServletRequest: getHeader("Authorization")
    AuthController->>AuthController: "Bearer " 접두사 제거 및 검증
    AuthController-->>Client: 새 토큰 또는 오류 반환
Loading

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • NCookies
  • pokerbearkr

Poem

토큰의 이름이 바뀌었네,
JWT_REFRESH에서 Authorization으로 변신했지!
리프레시의 길을 따라
토끼는 헤더를 꼼꼼히 살펴봐,
Bearer로 시작하면 OK!
인증의 숲에서 오늘도 깡총깡총 뛰어가네. 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java (1)

82-82: 디버그 로그를 제거하는 것을 고려해보세요.

리프레시 토큰 정보를 로그로 출력하는 것은 보안상 위험할 수 있으며, PR 체크리스트에서도 불필요한 console.log 제거를 언급했습니다.

-		log.info("Refresh token 추출 : {}", token);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b26b4dd and f97f026.

📒 Files selected for processing (1)
  • src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java (1)
Learnt from: NCookies
PR: ezcode-my/backend#17
File: src/main/java/org/ezcode/codetest/presentation/problemmanagement/ProblemAdminController.java:25-25
Timestamp: 2025-06-02T06:57:37.929Z
Learning: 이 프로젝트에서는 아직 Spring Security가 적용되지 않아서 @PreAuthorize 어노테이션이 주석 처리되어 있음. Spring Security 도입 전까지는 권한 검증 어노테이션들이 비활성화 상태임.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java (2)

73-73: Swagger 보안 요구사항 변경이 올바르게 적용되었습니다.

JWT_REFRESH에서 Authorization으로 변경한 것은 표준 OAuth2/JWT 관례를 따르는 좋은 개선사항입니다.


78-78: 헤더 추출 로직이 Swagger 어노테이션과 일치하도록 올바르게 변경되었습니다.

Authorization 헤더를 사용하는 것은 로그아웃 메서드(65-67라인)와 일관성을 유지하며 표준 관례를 따릅니다. 다만 기존 클라이언트에서 JWT_REFRESH 헤더를 사용하고 있었다면 breaking change가 될 수 있으니 확인이 필요합니다.

다음 스크립트를 실행하여 기존 클라이언트 코드에서 JWT_REFRESH 헤더 사용을 확인해주세요:

#!/bin/bash
# 설명: JWT_REFRESH 헤더를 사용하는 클라이언트 코드가 있는지 확인
# 예상 결과: 클라이언트 코드에서 JWT_REFRESH 사용 여부 확인

# 테스트: 프로젝트 전체에서 JWT_REFRESH 사용 검색
rg -i "jwt_refresh" --type js --type ts --type java

@minjee2758 minjee2758 merged commit 7faa72d into dev Jun 27, 2025
2 checks passed
@minjee2758 minjee2758 deleted the refactor/refreshToken branch June 27, 2025 13:44
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.

4 participants