Skip to content

Comments

리프레쉬 토큰 추가 로직#109

Merged
hiwon-lee merged 2 commits intomainfrom
develop
Feb 1, 2026
Merged

리프레쉬 토큰 추가 로직#109
hiwon-lee merged 2 commits intomainfrom
develop

Conversation

@hiwon-lee
Copy link
Contributor

#️⃣ 연관된 이슈

관련된 이슈 번호를 적어주세요. 예: #이슈번호

#️⃣ 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요. (이미지 첨부 가능)

#️⃣ 테스트 결과

코드 변경에 대해 테스트를 수행한 결과를 요약해주세요. 예: 모든 테스트 통과 여부, 새로 작성한 테스트 케이스 등

#️⃣ 변경 사항 체크리스트

  • 코드에 영향이 있는 모든 부분에 대한 테스트를 작성하고 실행했나요?
  • 문서를 작성하거나 수정했나요? (필요한 경우)
  • 코드 컨벤션에 따라 코드를 작성했나요?
  • 본 PR에서 발생할 수 있는 모든 의존성 문제가 해결되었나요?

#️⃣ 스크린샷 (선택)

관련된 스크린샷이 있다면 여기에 첨부해주세요.

#️⃣ 리뷰 요구사항 (선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요.
예시: 이 부분의 코드가 잘 작동하는지 테스트해 주실 수 있나요?

📎 참고 자료 (선택)

관련 문서, 스크린샷, 또는 예시 등이 있다면 여기에 첨부해주세요

@hiwon-lee hiwon-lee merged commit 54f61fc into main Feb 1, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hiwon-lee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 인증 시스템의 리프레시 토큰 처리 방식을 유연하게 개선합니다. 기존에는 쿠키를 통해서만 리프레시 토큰을 받았지만, 이제 요청 본문을 통해서도 토큰을 받을 수 있도록 확장하여 클라이언트의 다양한 요구사항에 대응할 수 있게 되었습니다. 또한, 불필요한 테스트 엔드포인트를 제거하여 코드의 간결성을 높였습니다.

Highlights

  • 리프레시 토큰 처리 로직 개선: /refresh 엔드포인트가 이제 요청 본문(body)과 쿠키에서 리프레시 토큰을 모두 받아 처리할 수 있도록 변경되었습니다. 요청 본문에 토큰이 있으면 이를 우선적으로 사용하고, 없으면 쿠키에서 토큰을 가져옵니다.
  • 디버깅 로깅 추가: 리프레시 토큰의 존재 여부와 출처(쿠키 또는 본문)를 확인할 수 있도록 디버깅 로그가 추가되었습니다.
  • 테스트 엔드포인트 제거: 이전에 존재했던 /test-auth/token/{memberId} 테스트용 엔드포인트가 제거되었습니다.
  • 새로운 DTO 추가: 리프레시 토큰을 요청 본문으로 받기 위한 RefreshRequest DTO가 새로 추가되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

리프레시 토큰 로직 추가에 대한 PR 잘 보았습니다. 전반적으로 목표한 기능은 잘 구현된 것 같습니다. 다만, 코드 가독성 향상, 잠재적 보안 이슈 해결, 그리고 불필요한 디버깅 코드 제거를 위해 몇 가지 제안 사항을 남깁니다.

Comment on lines +79 to +82
// 디버깅 로그
log.info("[REFRESH] Cookie header = {}", request.getHeader("Cookie"));
log.info("[REFRESH] cookie refresh present = {}", refreshTokenFromCookie != null);
log.info("[REFRESH] body refresh present = {}", body != null && body.getRefreshToken() != null && !body.getRefreshToken().isBlank());
Copy link
Contributor

Choose a reason for hiding this comment

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

high

디버깅 목적으로 추가된 로그들이 INFO 레벨로 기록되고 있습니다. 운영 환경에서 불필요한 로그가 많이 남을 수 있으므로 DEBUG 레벨로 변경하는 것을 권장합니다. 특히 request.getHeader("Cookie")를 그대로 로깅하면 리프레시 토큰 외 다른 민감한 정보가 포함된 쿠키가 노출될 수 있는 보안 위험이 있습니다. 이 로그들은 제거하거나, 꼭 필요하다면 DEBUG 레벨로 변경하고 실제 운영에서는 비활성화하는 것이 안전합니다.

Suggested change
// 디버깅 로그
log.info("[REFRESH] Cookie header = {}", request.getHeader("Cookie"));
log.info("[REFRESH] cookie refresh present = {}", refreshTokenFromCookie != null);
log.info("[REFRESH] body refresh present = {}", body != null && body.getRefreshToken() != null && !body.getRefreshToken().isBlank());
// 디버깅 로그
log.debug("[REFRESH] Cookie header = {}", request.getHeader("Cookie"));
log.debug("[REFRESH] cookie refresh present = {}", refreshTokenFromCookie != null);
log.debug("[REFRESH] body refresh present = {}", body != null && body.getRefreshToken() != null && !body.getRefreshToken().isBlank());


import com.example.tikitaka.global.config.auth.dto.AuthResponse;
import com.example.tikitaka.global.config.auth.dto.KakaoCodeRequest;
import com.example.tikitaka.global.config.auth.dto.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

와일드카드(*) import는 코드 가독성을 해치고 잠재적인 이름 충돌을 유발할 수 있으므로, 필요한 클래스를 명시적으로 import하는 것이 좋습니다. Google Java Style Guide에서도 와일드카드 import 사용을 지양하도록 권장하고 있습니다.

Suggested change
import com.example.tikitaka.global.config.auth.dto.*;
import com.example.tikitaka.global.config.auth.dto.AuthResponse;
import com.example.tikitaka.global.config.auth.dto.KakaoCodeRequest;
import com.example.tikitaka.global.config.auth.dto.LoginResponse;
import com.example.tikitaka.global.config.auth.dto.RefreshRequest;
import com.example.tikitaka.global.config.auth.dto.RefreshResponse;

Comment on lines +85 to +90
String refreshToken = null;
if (body != null && body.getRefreshToken() != null && !body.getRefreshToken().isBlank()) {
refreshToken = body.getRefreshToken().trim();
} else if (refreshTokenFromCookie != null && !refreshTokenFromCookie.isBlank()) {
refreshToken = refreshTokenFromCookie.trim();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

refreshToken을 가져오는 로직이 다소 장황합니다. Spring의 StringUtils.hasText()를 사용하면 코드를 더 간결하고 명확하게 만들 수 있습니다. hasText()null, 빈 문자열, 공백만 있는 문자열을 모두 한 번에 확인해줍니다. 이 제안을 적용하려면 org.springframework.util.StringUtils를 import해야 합니다.

Suggested change
String refreshToken = null;
if (body != null && body.getRefreshToken() != null && !body.getRefreshToken().isBlank()) {
refreshToken = body.getRefreshToken().trim();
} else if (refreshTokenFromCookie != null && !refreshTokenFromCookie.isBlank()) {
refreshToken = refreshTokenFromCookie.trim();
}
String refreshToken = null;
if (body != null && org.springframework.util.StringUtils.hasText(body.getRefreshToken())) {
refreshToken = body.getRefreshToken().trim();
} else if (org.springframework.util.StringUtils.hasText(refreshTokenFromCookie)) {
refreshToken = refreshTokenFromCookie.trim();
}

public Map<String, String> issue(@PathVariable Long memberId) {
String token = jwtTokenProvider.createAccessToken(memberId);
return Map.of("accessToken", token);
// 쿠키가 지금 문제라면 일시적으로 아래 2줄 주석 처리해도 됨
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

개발 중에 임시로 추가된 것으로 보이는 주석이 남아있습니다. 코드베이스를 깔끔하게 유지하기 위해 병합 전에 이런 주석은 제거하는 것이 좋습니다.

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