-
Notifications
You must be signed in to change notification settings - Fork 1
[#24] Fix: 여행 계획 API 인증 구조(JWT) 원복 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughFastAPI 통합 엔드포인트에 대한 인증 요구사항이 변경되었습니다. TripPlanController에서 createTripPlanFromFastAPI 메서드의 인증 처리가 허용적 방식에서 필수적 방식으로 전환되었으며, SecurityConfig에서 해당 경로의 공개 접근 권한이 제거되었습니다. Changes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java(1 hunks)src/main/java/com/example/triptalk/global/config/SecurityConfig.java(0 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/com/example/triptalk/global/config/SecurityConfig.java
| HttpServletRequest httpRequest | ||
| ) { | ||
|
|
||
| // 인증이 없어도 동작하도록 변경 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석이 실제 변경 내용과 모순됩니다.
Line 82의 주석은 "인증이 없어도 동작하도록 변경"이라고 되어 있지만, 실제로는 JWT 인증을 필수로 요구하도록 원복하는 것이 이번 PR의 목적입니다. 이 주석은 완전히 잘못되었으며 향후 개발자에게 혼란을 줄 수 있습니다.
다음 diff를 적용하여 주석을 제거하세요:
- // 인증이 없어도 동작하도록 변경
Long userId = authUtil.getUserIdFromRequest(httpRequest);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // 인증이 없어도 동작하도록 변경 | |
| Long userId = authUtil.getUserIdFromRequest(httpRequest); |
🤖 Prompt for AI Agents
In
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java
around line 82, the inline comment "// 인증이 없어도 동작하도록 변경" contradicts the PR
which restores mandatory JWT authentication; remove that incorrect comment and
any other misleading notes on or immediately around line 82 so the code and
comments accurately reflect that JWT authentication is required.
| Long userId = authUtil.getUserIdFromRequest(httpRequest); | ||
| TripPlanResponse.TripPlanDTO response = | ||
| tripPlanService.createTripPlanFromFastAPI(userId, request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find SecurityConfig file
echo "=== Finding SecurityConfig file ==="
find . -name "*SecurityConfig*" -type f
echo ""
echo "=== Checking for /api/trip-plan/from-fastapi in SecurityConfig ==="
rg -n "from-fastapi" --type=java
echo ""
echo "=== Checking for AuthUtil file ==="
find . -name "*AuthUtil*" -type fRepository: TripTalk/BE_SpringBoot
Length of output: 466
🏁 Script executed:
#!/bin/bash
echo "=== Reading SecurityConfig.java ==="
cat -n ./src/main/java/com/example/triptalk/global/config/SecurityConfig.java
echo ""
echo "=== Reading AuthUtil.java ==="
cat -n ./src/main/java/com/example/triptalk/global/security/AuthUtil.java
echo ""
echo "=== Reading TripPlanController around lines 60-90 ==="
sed -n '55,95p' -n ./src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.javaRepository: TripTalk/BE_SpringBoot
Length of output: 7617
코드 주석과 실제 구현이 불일치합니다.
코드의 81번 줄 주석("인증이 없어도 동작하도록 변경")은 실제 구현과 맞지 않습니다. SecurityConfig에서 /api/trip-plan/from-fastapi는 permitAll() 목록에 없으며, 57번 줄의 .anyRequest().authenticated()에 의해 모든 요청이 인증을 요구합니다. 또한 AuthUtil.getUserIdFromRequest()는 토큰이 없거나 유효하지 않을 때 _UNAUTHORIZED 예외를 발생시키므로 인증이 올바르게 강제됩니다. 주석을 제거하거나 실제 구현과 일치하도록 수정하세요.
🤖 Prompt for AI Agents
In
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java
around lines 83 to 85, the inline comment stating "인증이 없어도 동작하도록 변경" conflicts
with the actual behavior (SecurityConfig requires authentication and AuthUtil
throws on missing/invalid tokens); remove or replace that comment so it
correctly states that this endpoint requires authentication, and optionally
mention that AuthUtil.getUserIdFromRequest(...) will throw if the token is
absent/invalid so callers must be authenticated.
#️⃣ 연관된 이슈
📝 작업 내용
📌 공유 사항
✅ 체크리스트
스크린샷 (선택)
💬 리뷰 요구사항 (선택)
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.