Skip to content

Conversation

@ohyuchan123
Copy link
Member

@ohyuchan123 ohyuchan123 commented Jan 8, 2025

πŸ“Œ κ΄€λ ¨ 이슈

#28 μ½”λ“œ ꡬ쑰 κ°œμ„ 

✨ 과제 λ‚΄μš©

기쑴에 코더 λž˜λΉ—μ΄ μ œμ‹œν•΄μ€€ μ½”λ“œλ₯Ό ν•΄κ²°ν•˜λŠ”λ°λ§Œ μ§‘μ€‘ν•˜μ—¬ 점점
λΆˆν•„μš”ν•œ μ½”λ“œλ“€μ΄λ‚˜ μ½”λ“œλ“€μ΄ λ’€μ£½λ°•μ£½ λ˜μ–΄κ°€μ„œ μ½”λ“œ ꡬ쑰 및 κΈ°μ‘΄ μ½”λ“œλ“€κ³Ό ν•¨κ»˜ 톡일화 ν•˜λŠ” κ³Όμ •μž…λ‹ˆλ‹€.

πŸ“Έ μŠ€ν¬λ¦°μƒ·(선택)

πŸ“š 레퍼런슀 (λ˜λŠ” μƒˆλ‘œ μ•Œκ²Œ 된 λ‚΄μš©) ν˜Ήμ€ κΆκΈˆν•œ 사항듀

Summary by CodeRabbit

릴리즈 λ…ΈνŠΈ

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • JWT 토큰 관리λ₯Ό μœ„ν•œ ꡬ성 κ°€λŠ₯ν•œ 속성 μΆ”κ°€
    • 이메일 인증 ν”„λ‘œμ„ΈμŠ€ κ°œμ„ 
    • 둜그인 및 νšŒμ›κ°€μž… 응닡 ꡬ쑰 μ΅œμ ν™”
  • κ°œμ„  사항

    • μΏ ν‚€ 생성 및 관리 μœ ν‹Έλ¦¬ν‹° μΆ”κ°€
    • 인증 κ΄€λ ¨ DTO 이름 및 ꡬ쑰 λ¦¬νŒ©ν† λ§
    • λ³΄μ•ˆ μ„€μ • 및 토큰 처리 둜직 κ°•ν™”
  • 버그 μˆ˜μ •

    • 이메일 인증 및 둜그인 ν”„λ‘œμ„ΈμŠ€μ˜ 였λ₯˜ 처리 κ°œμ„ 

@ohyuchan123 ohyuchan123 self-assigned this Jan 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2025

μ›Œν¬μŠ€λ£¨

이 ν’€ λ¦¬ν€˜μŠ€νŠΈλŠ” 인증 및 λ³΄μ•ˆ κ΄€λ ¨ μ½”λ“œμ˜ κ΄‘λ²”μœ„ν•œ λ¦¬νŒ©ν† λ§μ„ ν¬ν•¨ν•©λ‹ˆλ‹€. μ£Όμš” λ³€κ²½ 사항은 DTO 클래슀 이름 λ³€κ²½, JWT 속성 ꡬ성 λ„μž…, μΏ ν‚€ 관리 μœ ν‹Έλ¦¬ν‹° μΆ”κ°€, 이메일 인증 ν”„λ‘œμ„ΈμŠ€ κ°œμ„  등을 ν¬ν•¨ν•©λ‹ˆλ‹€. μ΄λŸ¬ν•œ 변경은 μ½”λ“œμ˜ ꡬ쑰화, ꡬ성 κ°€λŠ₯μ„± 및 였λ₯˜ 처리λ₯Ό ν–₯μƒμ‹œν‚€λŠ” 데 쀑점을 두고 μžˆμŠ΅λ‹ˆλ‹€.

λ³€κ²½ 사항

파일 λ³€κ²½ μš”μ•½
SecurityConfig.java JWT 속성 μ£Όμž… 및 ν•„ν„° ꡬ성 μ—…λ°μ΄νŠΈ
AuthController.java DTO 이름 λ³€κ²½, λ©”μ„œλ“œ μ‹œκ·Έλ‹ˆμ²˜ μ—…λ°μ΄νŠΈ
JWTFilter.java 인증 둜직 λͺ¨λ“ˆν™”, JWT 속성 톡합
JWTUtil.java 토큰 생성 및 검증 둜직 λ¦¬νŒ©ν† λ§
MailService.java 이메일 검증 응닡 ꡬ쑰 κ°œμ„ 
AuthService.java 둜그인, 등둝, λ‘œκ·Έμ•„μ›ƒ λ©”μ„œλ“œ μ—…λ°μ΄νŠΈ

μ œμ•ˆλœ λ ˆμ΄λΈ”

πŸ”¨ Refactor

κ΄€λ ¨ κ°€λŠ₯μ„± μžˆλŠ” PR

μ‹œν€€μŠ€ λ‹€μ΄μ–΄κ·Έλž¨

sequenceDiagram
    participant Client
    participant AuthController
    participant AuthService
    participant MailService
    participant JWTUtil

    Client->>AuthController: 둜그인 μš”μ²­
    AuthController->>AuthService: 둜그인 처리
    AuthService->>JWTUtil: 토큰 생성
    JWTUtil-->>AuthService: 토큰 λ°˜ν™˜
    AuthService-->>AuthController: 둜그인 응닡
    AuthController->>Client: 인증 μΏ ν‚€ 및 둜그인 응닡
Loading

μ‹œ (ν† λΌμ˜ κ΄€μ μ—μ„œ)

🐰 μ½”λ“œμ˜ μˆ²μ„ 달리며
JWT의 μƒˆ 길을 μ—΄μ–΄
λ¦¬νŒ©ν† λ§μ˜ λ°”λžŒκ²°μ—
λ³΄μ•ˆμ€ λ”μš± 단단해지고
우리의 μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ 좀을 μΆ˜λ‹€! 🌟


πŸͺ§ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

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.

@ohyuchan123 ohyuchan123 added βœ… Test test κ΄€λ ¨(storybook, jest...) πŸ”¨ Refactor μ½”λ“œ λ¦¬νŒ©ν† λ§ ✨ Feature κΈ°λŠ₯ 개발 labels Jan 8, 2025
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: 8

🧹 Nitpick comments (13)
src/main/java/com/mycom/socket/auth/service/data/VerificationData.java (2)

15-17: 정적 νŒ©ν† λ¦¬ λ©”μ„œλ“œμ˜ κ΅¬ν˜„μ΄ λͺ…ν™•ν•©λ‹ˆλ‹€λ§Œ, 유효 기간을 μ„€μ • κ°€λŠ₯ν•˜κ²Œ λ§Œλ“œλŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

CODE_VALID_DURATION을 μ„€μ • νŒŒμΌμ΄λ‚˜ ν™˜κ²½ λ³€μˆ˜λ₯Ό 톡해 ꡬ성 κ°€λŠ₯ν•˜κ²Œ λ§Œλ“œλŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”. μ΄λŠ” λ‹€μ–‘ν•œ ν™˜κ²½μ—μ„œμ˜ μœ μ—°μ„±μ„ 높여쀄 κ²ƒμž…λ‹ˆλ‹€.


27-29: λ©”μ„œλ“œ 이름을 더 λͺ…ν™•ν•˜κ²Œ λ³€κ²½ν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

withVerified λ³΄λ‹€λŠ” createVerifiedCopyλ‚˜ markAsVerified와 같이 더 λͺ…μ‹œμ μΈ 이름을 μ‚¬μš©ν•˜λ©΄ λ©”μ„œλ“œμ˜ μ˜λ„λ₯Ό 더 잘 전달할 수 μžˆμ„ 것 κ°™μŠ΅λ‹ˆλ‹€.

-    public VerificationData withVerified() {
+    public VerificationData createVerifiedCopy() {
         return new VerificationData(this.code, this.expiryTime, true);
     }
src/main/java/com/mycom/socket/auth/service/MailService.java (3)

72-72: 이메일 μ£Όμ†Œμ˜ ν˜•μ‹ 검증을 μΆ”κ°€ν•˜λŠ” 것을 ꢌμž₯λ“œλ¦½λ‹ˆλ‹€.

sendMail λ©”μ„œλ“œμ—μ„œ 전달받은 email νŒŒλΌλ―Έν„°μ— λŒ€ν•΄ 이메일 ν˜•μ‹μ΄ μ˜¬λ°”λ₯Έμ§€ κ²€μ¦ν•˜μ—¬ μœ νš¨ν•˜μ§€ μ•Šμ€ μ΄λ©”μΌλ‘œ 메일을 λ°œμ†‘ν•˜λŠ” 것을 λ°©μ§€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.


76-78: verificationDataMap의 만료된 데이터 제거λ₯Ό κ³ λ €ν•΄λ³΄μ„Έμš”.

인증 μ½”λ“œκ°€ λ§Œλ£Œλ˜κ±°λ‚˜ μ‚¬μš©λœ 후에도 verificationDataMap에 데이터가 λ‚¨μ•„μžˆμ–΄ λ©”λͺ¨λ¦¬ λˆ„μˆ˜κ°€ λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€. 만료된 λ°μ΄ν„°λ‚˜ 인증된 데이터λ₯Ό 주기적으둜 μ œκ±°ν•˜λŠ” λ‘œμ§μ„ μΆ”κ°€ν•˜λŠ” 것을 ꢌμž₯ν•©λ‹ˆλ‹€.

Also applies to: 107-108


117-120: isEmailVerified λ©”μ„œλ“œμ˜ null 체크 및 μ˜ˆμ™Έ 처리 κ²€ν† 

isEmailVerified λ©”μ„œλ“œμ—μ„œ verificationDataMap.get(email)이 null인 경우 data.isExpired()μ—μ„œ NullPointerException이 λ°œμƒν•˜μ§€ μ•Šλ„λ‘ μ•ˆμ „ν•œ 접근을 ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ 이메일이 μΈμ¦λ˜μ§€ μ•Šμ•˜μ„ κ²½μš°μ— λŒ€ν•œ λͺ…ν™•ν•œ μ˜ˆμ™Έ μ²˜λ¦¬λ‚˜ 둜그λ₯Ό μΆ”κ°€ν•˜λ©΄ 디버깅에 도움이 될 수 μžˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/dto/response/RegisterResponse.java (1)

9-11: λ©”μ‹œμ§€ 처리 κ°œμ„  μ œμ•ˆ

성곡 λ©”μ‹œμ§€κ°€ μ½”λ“œμ— 직접 ν•˜λ“œμ½”λ”©λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. λ‹€κ΅­μ–΄ μ§€μ›μ΄λ‚˜ λ©”μ‹œμ§€ 관리λ₯Ό μœ„ν•΄ λ³„λ„μ˜ λ©”μ‹œμ§€ μ„€μ • 파일둜 λΆ„λ¦¬ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.

+    private static final String REGISTER_SUCCESS_MESSAGE = "νšŒμ›κ°€μž…μ΄ μ™„λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.";
     public static RegisterResponse of(Long memberId, String email, String nickname) {
-        return new RegisterResponse(memberId, email, nickname, "νšŒμ›κ°€μž…μ΄ μ™„λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.");
+        return new RegisterResponse(memberId, email, nickname, REGISTER_SUCCESS_MESSAGE);
     }
src/main/java/com/mycom/socket/auth/security/CookieUtil.java (1)

28-35: 만료 μΏ ν‚€ 생성 μ‹œ λ³΄μ•ˆ μ„€μ • κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

만료 μΏ ν‚€ 생성 μ‹œ secure 섀정을 ν•˜λ“œμ½”λ”©ν•˜μ§€ 말고 JWTPropertiesμ—μ„œ κ°€μ Έμ˜€λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

-        cookie.setSecure(true);
+        cookie.setSecure(jwtProperties.isSecureCookie());
src/main/java/com/mycom/socket/auth/jwt/JWTFilter.java (1)

Line range hint 44-52: μΏ ν‚€ 검증 둜직 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

null 체크 외에도 μΏ ν‚€ κ°’μ˜ μœ νš¨μ„± 검증을 μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

 private String resolveTokenFromCookie(HttpServletRequest request) {
     Cookie[] cookies = request.getCookies();
     if (cookies != null) {
         for (Cookie cookie : cookies) {
             if (jwtProperties.getCookieName().equals(cookie.getName())) {
-                return cookie.getValue();
+                String value = cookie.getValue();
+                if (StringUtils.hasText(value)) {
+                    return value;
+                }
             }
         }
     }
     return null;
 }
src/main/java/com/mycom/socket/auth/security/LoginFilter.java (1)

Line range hint 44-45: μ˜ˆμ™Έ λ©”μ‹œμ§€λ₯Ό 더 ꡬ체적으둜 μž‘μ„±ν•΄μ£Όμ„Έμš”.

ν˜„μž¬ μ˜ˆμ™Έ λ©”μ‹œμ§€κ°€ λ„ˆλ¬΄ μΌλ°˜μ μž…λ‹ˆλ‹€. μ‚¬μš©μžκ°€ 문제λ₯Ό 더 μ‰½κ²Œ νŒŒμ•…ν•  수 μžˆλ„λ‘ ꡬ체적인 정보λ₯Ό μ œκ³΅ν•˜λ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

-throw new RuntimeException("둜그인 μš”μ²­ 처리 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.", e);
+throw new RuntimeException("둜그인 μš”μ²­ 데이터 νŒŒμ‹± 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€. μš”μ²­ ν˜•μ‹μ„ ν™•μΈν•΄μ£Όμ„Έμš”.", e);
src/test/java/com/mycom/socket/member/service/RegisterServiceTest.java (1)

71-77: λΉ„λ°€λ²ˆν˜Έ 인코딩 검증을 μΆ”κ°€ν•΄μ£Όμ„Έμš”.

νšŒμ›κ°€μž… 성곡 ν…ŒμŠ€νŠΈμ—μ„œ λΉ„λ°€λ²ˆν˜Έ 인코딩이 μ˜¬λ°”λ₯΄κ²Œ μˆ˜ν–‰λ˜μ—ˆλŠ”μ§€ 검증이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 검증을 μΆ”κ°€ν•˜λŠ” 것을 μ œμ•ˆν•©λ‹ˆλ‹€:

 assertThat(response.email()).isEqualTo(request.email());
 assertThat(response.nickname()).isEqualTo(request.nickname());
 assertThat(response.message()).isEqualTo("νšŒμ›κ°€μž…μ΄ μ™„λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.");

 verify(memberRepository).save(any(Member.class));
 verify(mailService).isEmailVerified(request.email());
+verify(passwordEncoder).encode(request.password());
src/test/java/com/mycom/socket/member/service/LoginTest.java (1)

65-69: μΏ ν‚€ 속성을 μƒμˆ˜λ‘œ μΆ”μΆœν•΄μ£Όμ„Έμš”.

ν…ŒμŠ€νŠΈμ˜ 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ„ 높이기 μœ„ν•΄ μΏ ν‚€ 속성값듀을 μƒμˆ˜λ‘œ μΆ”μΆœν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

+private static final String COOKIE_NAME = "Authorization";
+private static final int COOKIE_MAX_AGE = 1800;
+private static final String COOKIE_PATH = "/";

 Cookie authCookie = new Cookie("Authorization", token);
 authCookie.setHttpOnly(true);
 authCookie.setSecure(true);
-authCookie.setPath("/");
-authCookie.setMaxAge(1800);
+authCookie.setPath(COOKIE_PATH);
+authCookie.setMaxAge(COOKIE_MAX_AGE);
src/test/java/com/mycom/socket/member/controller/AuthControllerTest.java (2)

113-119: ν…ŒμŠ€νŠΈ λ°μ΄ν„°μ˜ μƒμˆ˜ν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

ν…ŒμŠ€νŠΈ 헬퍼 λ©”μ„œλ“œμ—μ„œ μ‚¬μš©λ˜λŠ” 고정값듀을 μƒμˆ˜λ‘œ μΆ”μΆœν•˜λ©΄ ν…ŒμŠ€νŠΈμ˜ μ˜λ„κ°€ 더 λͺ…ν™•ν•΄μ§ˆ 것 κ°™μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

+private static final Long TEST_MEMBER_ID = 1L;
+private static final String TEST_EMAIL = "[email protected]";
+private static final String TEST_NICKNAME = "testUser";
+private static final String TEST_PASSWORD = "password123";
+private static final String TEST_INTRO = "μ•ˆλ…•ν•˜μ„Έμš”";

 private RegisterRequest createRegisterRequest(String email, String nickname, String password) {
-    return new RegisterRequest(email, nickname, password, "μ•ˆλ…•ν•˜μ„Έμš”");
+    return new RegisterRequest(email, nickname, password, TEST_INTRO);
 }

 private RegisterResponse createRegisterResponse(Long memberId, String email, String nickname) {
     return RegisterResponse.of(memberId, email, nickname);
 }

97-110: μ†Œκ°œκΈ€(intro) ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검증 ν…ŒμŠ€νŠΈλ₯Ό μΆ”κ°€ν•΄μ£Όμ„Έμš”.

ν˜„μž¬ 이메일, λ‹‰λ„€μž„, λΉ„λ°€λ²ˆν˜Έμ— λŒ€ν•œ μœ νš¨μ„± 검증은 ν…ŒμŠ€νŠΈλ˜κ³  μžˆμ§€λ§Œ, μ†Œκ°œκΈ€ ν•„λ“œμ— λŒ€ν•œ 검증이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€ μΆ”κ°€λ₯Ό μ œμ•ˆν•©λ‹ˆλ‹€:

@Test
@WithMockUser
void νšŒμ›κ°€μž…_μ‹€νŒ¨_μ†Œκ°œκΈ€_길이초과() throws Exception {
    // given
    String longIntro = "a".repeat(1001); // 1000자 초과
    RegisterRequest request = createRegisterRequest(TEST_EMAIL, TEST_NICKNAME, TEST_PASSWORD, longIntro);

    // when
    ResultActions resultActions = performRegisterRequest(request);

    // then
    resultActions
            .andExpect(status().isBadRequest())
            .andExpect(jsonPath("$.message").value("μ†Œκ°œκΈ€μ€ 1000자λ₯Ό μ΄ˆκ³Όν•  수 μ—†μŠ΅λ‹ˆλ‹€."));
}
πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between a86e950 and 15b650b.

πŸ“’ Files selected for processing (24)
  • src/main/java/com/mycom/socket/auth/config/SecurityConfig.java (3 hunks)
  • src/main/java/com/mycom/socket/auth/controller/AuthController.java (2 hunks)
  • src/main/java/com/mycom/socket/auth/dto/request/EmailRequest.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/request/EmailVerificationRequest.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/request/LoginRequest.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/request/RegisterRequest.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationCheckResponseDto.java (0 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationResponse.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationResponseDto.java (0 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/LoginResponse.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/LoginResponseDto.java (0 hunks)
  • src/main/java/com/mycom/socket/auth/dto/response/RegisterResponse.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/jwt/JWTFilter.java (3 hunks)
  • src/main/java/com/mycom/socket/auth/jwt/JWTProperties.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/jwt/JWTUtil.java (2 hunks)
  • src/main/java/com/mycom/socket/auth/security/CookieUtil.java (1 hunks)
  • src/main/java/com/mycom/socket/auth/security/LoginFilter.java (3 hunks)
  • src/main/java/com/mycom/socket/auth/service/AuthService.java (5 hunks)
  • src/main/java/com/mycom/socket/auth/service/MailService.java (3 hunks)
  • src/main/java/com/mycom/socket/auth/service/data/VerificationData.java (1 hunks)
  • src/test/java/com/mycom/socket/member/controller/AuthControllerTest.java (3 hunks)
  • src/test/java/com/mycom/socket/member/service/LoginIntegrationTest.java (3 hunks)
  • src/test/java/com/mycom/socket/member/service/LoginTest.java (4 hunks)
  • src/test/java/com/mycom/socket/member/service/RegisterServiceTest.java (4 hunks)
πŸ’€ Files with no reviewable changes (3)
  • src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationResponseDto.java
  • src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationCheckResponseDto.java
  • src/main/java/com/mycom/socket/auth/dto/response/LoginResponseDto.java
βœ… Files skipped from review due to trivial changes (2)
  • src/main/java/com/mycom/socket/auth/dto/request/RegisterRequest.java
  • src/main/java/com/mycom/socket/auth/dto/request/LoginRequest.java
πŸ”‡ Additional comments (17)
src/main/java/com/mycom/socket/auth/service/data/VerificationData.java (2)

7-11: λ ˆμ½”λ“œ 선언이 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€!

λΆˆλ³€μ„±μ„ 보μž₯ν•˜λŠ” record νƒ€μž…μ˜ μ‚¬μš©μ΄ μ μ ˆν•˜λ©°, 검증 μƒνƒœλ₯Ό μΆ”μ ν•˜κΈ° μœ„ν•œ verified ν•„λ“œμ˜ μΆ”κ°€κ°€ μ’‹μŠ΅λ‹ˆλ‹€.


19-20: μƒμ„±μž κ΅¬ν˜„μ΄ μ μ ˆν•©λ‹ˆλ‹€!

κΈ°λ³Έ μƒμ„±μžκ°€ μ£Ό μƒμ„±μžμ—κ²Œ 적절히 μœ„μž„ν•˜κ³  있으며, κΈ°λ³Έκ°’ 섀정이 일관성 있게 λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/controller/AuthController.java (1)

3-9: μƒˆλ‘œμš΄ DTO ν΄λž˜μŠ€κ°€ μ˜¬λ°”λ₯΄κ²Œ μž„ν¬νŠΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

DTO ν΄λž˜μŠ€λ“€μ˜ νŒ¨ν‚€μ§€ 경둜 및 이름 변경이 μ •ν™•ν•˜κ²Œ λ°˜μ˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/service/AuthService.java (1)

50-50: μΏ ν‚€ μ„€μ • μ‹œ λ³΄μ•ˆ μ˜΅μ…˜μ„ ν™•μΈν•˜μ‹­μ‹œμ˜€.

CookieUtil을 μ‚¬μš©ν•˜μ—¬ μΏ ν‚€λ₯Ό 생성할 λ•Œ, 쿠킀에 HttpOnly, Secure와 같은 λ³΄μ•ˆ 속성이 μ„€μ •λ˜μ–΄ μžˆλŠ”μ§€ ν™•μΈν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. 이λ₯Ό 톡해 μΏ ν‚€ νƒˆμ·¨ λ“±μ˜ μœ„ν—˜μ„ 쀄일 수 μžˆμŠ΅λ‹ˆλ‹€.

Also applies to: 103-103

src/main/java/com/mycom/socket/auth/dto/response/EmailVerificationResponse.java (1)

3-9: EmailVerificationResponse λ ˆμ½”λ“œ μ •μ˜κ°€ μ μ ˆν•©λ‹ˆλ‹€.

κ°„κ²°ν•˜κ³  λΆˆλ³€ 객체λ₯Ό λ‚˜νƒ€λ‚΄κΈ° μœ„ν•΄ μžλ°” λ ˆμ½”λ“œλ₯Ό μ‚¬μš©ν•œ 것은 쒋은 μ„ νƒμž…λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/dto/response/LoginResponse.java (1)

3-10: LoginResponse λ ˆμ½”λ“œ μ •μ˜κ°€ μ μ ˆν•©λ‹ˆλ‹€.

둜그인 응닡 데이터λ₯Ό κ°„κ²°ν•˜κ²Œ ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μžλ°” λ ˆμ½”λ“œλ₯Ό ν™œμš©ν•œ 것은 νš¨μœ¨μ μž…λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/dto/request/EmailRequest.java (1)

Line range hint 6-11: DTO 이름 변경이 일관성 있게 μ μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

클래슀 μ΄λ¦„μ—μ„œ Dto 접미사λ₯Ό μ œκ±°ν•œ 변경이 전체적인 λ¦¬νŒ©ν† λ§ λ°©ν–₯κ³Ό 잘 μΌμΉ˜ν•©λ‹ˆλ‹€. 이메일 μœ νš¨μ„± 검사도 μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/dto/request/EmailVerificationRequest.java (1)

Line range hint 7-15: μœ νš¨μ„± 검사가 잘 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

이메일과 인증 μ½”λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검사가 μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ–΄ 있으며, μ—λŸ¬ λ©”μ‹œμ§€λ„ λͺ…ν™•ν•©λ‹ˆλ‹€. 6자리 숫자 μ½”λ“œμ— λŒ€ν•œ μ •κ·œμ‹ νŒ¨ν„΄λ„ μ •ν™•ν•©λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/security/CookieUtil.java (1)

16-23: μΏ ν‚€ 섀정이 μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ³΄μ•ˆ κ΄€λ ¨ μ„€μ •(httpOnly, secure)이 잘 μ μš©λ˜μ–΄ 있으며, JWTPropertiesλ₯Ό ν†΅ν•œ μ„€μ • 관리가 μ²΄κ³„μ μœΌλ‘œ λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/config/SecurityConfig.java (1)

35-38: JWT ν•„ν„° 섀정이 μ μ ˆν•©λ‹ˆλ‹€.

JWTPropertiesλ₯Ό ν†΅ν•œ μ„€μ • μ£Όμž…μ΄ 잘 λ˜μ–΄μžˆμœΌλ©°, ν•„ν„° 체인에 μ˜¬λ°”λ₯΄κ²Œ ν†΅ν•©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/test/java/com/mycom/socket/member/service/LoginIntegrationTest.java (2)

53-58: ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€κ°€ 잘 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

LoginRequest와 LoginResponseλ₯Ό μ‚¬μš©ν•œ ν…ŒμŠ€νŠΈ ꡬ쑰가 λͺ…ν™•ν•˜λ©°, μ‹€μ œ μ„œλΉ„μŠ€ λ‘œμ§μ„ 잘 κ²€μ¦ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.


66-68: μ„€μ •κ°’ 검증이 μ μ ˆν•©λ‹ˆλ‹€.

JWTProperties의 섀정값듀을 μ΄μš©ν•œ μΏ ν‚€ 속성 검증이 μ²΄κ³„μ μœΌλ‘œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/jwt/JWTFilter.java (2)

Line range hint 28-41: μ˜ˆμ™Έ μ²˜λ¦¬μ™€ λ‘œκΉ…μ΄ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

인증 μ‹€νŒ¨ μ‹œμ˜ μ˜ˆμ™Έ μ²˜λ¦¬μ™€ λ‘œκΉ…μ΄ μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμœΌλ©°, SecurityContext 정리가 μ˜¬λ°”λ₯΄κ²Œ μˆ˜ν–‰λ©λ‹ˆλ‹€.


56-68: 인증 둜직 뢄리가 잘 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

setAuthentication λ©”μ†Œλ“œλ‘œ 인증 λ‘œμ§μ„ λΆ„λ¦¬ν•œ 것이 μ½”λ“œ 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ„ ν–₯μƒμ‹œμΌ°μŠ΅λ‹ˆλ‹€.

src/main/java/com/mycom/socket/auth/security/LoginFilter.java (1)

56-58: μΏ ν‚€ 생성 둜직이 잘 κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

μΏ ν‚€ 생성 λ‘œμ§μ„ CookieUtil둜 λΆ„λ¦¬ν•œ 것은 쒋은 λ¦¬νŒ©ν† λ§μž…λ‹ˆλ‹€. 이λ₯Ό 톡해:

  • μΏ ν‚€ μ„€μ •μ˜ 일관성 μœ μ§€
  • λ³΄μ•ˆ κ΄€λ ¨ μ„€μ •μ˜ 쀑앙화
  • μ½”λ“œ μž¬μ‚¬μš©μ„± ν–₯상
src/test/java/com/mycom/socket/member/service/RegisterServiceTest.java (1)

80-115: μ—λŸ¬ μΌ€μ΄μŠ€μ— λŒ€ν•œ ν…ŒμŠ€νŠΈκ°€ 잘 μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

이메일 미인증과 쀑볡 이메일에 λŒ€ν•œ ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€κ°€ λͺ…ν™•ν•˜κ²Œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ˜ˆμ™Έ λ©”μ‹œμ§€λ„ ꡬ체적이고 μ΄ν•΄ν•˜κΈ° μ‰½κ²Œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/test/java/com/mycom/socket/member/service/LoginTest.java (1)

Line range hint 89-126: 둜그인 μ‹€νŒ¨ ν…ŒμŠ€νŠΈκ°€ 잘 μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

μ‹€νŒ¨ μΌ€μ΄μŠ€μ— λŒ€ν•œ ν…ŒμŠ€νŠΈκ°€ κΌΌκΌΌν•˜κ²Œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€:

  • 이메일 μ—†μŒ μΌ€μ΄μŠ€ 검증
  • 잘λͺ»λœ λΉ„λ°€λ²ˆν˜Έ μΌ€μ΄μŠ€ 검증
  • μ‹€νŒ¨ μ‹œ μΏ ν‚€κ°€ μ„€μ •λ˜μ§€ μ•ŠλŠ”μ§€ 확인

Comment on lines +42 to +43
public EmailVerificationResponse sendVerificationEmail(@Valid @RequestBody EmailRequest request) {
return mailService.sendMail(request.email());
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

μ˜ˆμ™Έ 처리λ₯Ό μΆ”κ°€ν•˜μ—¬ μ•ˆμ •μ„±μ„ ν–₯μƒμ‹œν‚€μ‹­μ‹œμ˜€.

sendVerificationEmail λ©”μ„œλ“œμ—μ„œ 이메일 전솑 쀑 λ°œμƒν•  수 μžˆλŠ” μ˜ˆμ™Έμ— λŒ€ν•œ μ²˜λ¦¬κ°€ μ—†μŠ΅λ‹ˆλ‹€. 이메일 전솑 μ‹€νŒ¨ μ‹œ μ‚¬μš©μžμ—κ²Œ μ μ ˆν•œ ν”Όλ“œλ°±μ„ μ œκ³΅ν•  수 μžˆλ„λ‘ μ˜ˆμ™Έ 처리λ₯Ό μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

Comment on lines +47 to +48
public EmailVerificationResponse verifyEmail(@Valid @RequestBody EmailVerificationRequest request) {
return mailService.verifyCode(request.email(), request.code());
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

μ˜ˆμ™Έ 처리λ₯Ό μΆ”κ°€ν•˜μ—¬ μ•ˆμ •μ„±μ„ ν–₯μƒμ‹œν‚€μ‹­μ‹œμ˜€.

verifyEmail λ©”μ„œλ“œμ—μ„œ 이메일 검증 쀑 λ°œμƒν•  수 μžˆλŠ” μ˜ˆμ™Έμ— λŒ€ν•œ μ²˜λ¦¬κ°€ μ—†μŠ΅λ‹ˆλ‹€. 인증 μ½”λ“œ 검증 μ‹€νŒ¨ μ‹œ μ‚¬μš©μžμ—κ²Œ μ μ ˆν•œ ν”Όλ“œλ°±μ„ μ œκ³΅ν•  수 μžˆλ„λ‘ μ˜ˆμ™Έ 처리λ₯Ό μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

return true;
} catch (Exception e) {
log.warn("JWT 토큰 검증 쀑 μ—λŸ¬ λ°œμƒ: {}", e.getMessage());
log.warn("JWT 토큰 검증 μ‹€νŒ¨", e);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

μ˜ˆμ™Έ λ©”μ‹œμ§€μ— λ―Όκ°ν•œ 정보가 ν¬ν•¨λ˜μ§€ μ•Šλ„λ‘ 둜그λ₯Ό κ°œμ„ ν•˜μ‹­μ‹œμ˜€.

validateToken λ©”μ„œλ“œμ—μ„œ μ˜ˆμ™Έ λ°œμƒ μ‹œ 전체 μ˜ˆμ™Έλ₯Ό λ‘œκ·Έμ— κΈ°λ‘ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ˜ˆμ™Έ λ©”μ‹œμ§€μ— λ―Όκ°ν•œ 정보가 포함될 수 μžˆμœΌλ―€λ‘œ, λ‘œκ·Έμ— μ˜ˆμ™Έ λ©”μ‹œμ§€λ₯Ό ν¬ν•¨ν•˜μ§€ μ•Šκ±°λ‚˜ μ΅œμ†Œν•œμ˜ μ •λ³΄λ§Œ κΈ°λ‘ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

Comment on lines +79 to +84
try {
javaMailSender.send(message);
return true;
}catch (Exception e) {
throw new BaseException("이메일 λ°œμ†‘ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
return EmailVerificationResponse.of("이메일 전솑 성곡");
} catch (Exception e) {
throw new BaseException("이메일 λ°œμ†‘ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: " + e.getMessage(),
HttpStatus.INTERNAL_SERVER_ERROR);
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

μ˜ˆμ™Έ 처리λ₯Ό ꡬ체적인 μ˜ˆμ™Έλ‘œ μ œν•œν•˜λŠ” 것을 μ œμ•ˆν•©λ‹ˆλ‹€.

ν˜„μž¬ sendMail λ©”μ„œλ“œμ—μ„œ λͺ¨λ“  μ˜ˆμ™Έλ₯Ό ν¬κ΄„ν•˜λŠ” Exception을 μΊμΉ˜ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ˜ˆμ™Έμ˜ 원인을 νŒŒμ•…ν•˜κΈ° μ–΄λ ΅κ²Œ λ§Œλ“€ 수 μžˆμœΌλ―€λ‘œ, MailExceptionμ΄λ‚˜ MessagingExceptionκ³Ό 같은 ꡬ체적인 μ˜ˆμ™Έλ₯Ό μΊμΉ˜ν•˜μ—¬ μ •ν™•ν•œ μ˜ˆμ™Έ 처리λ₯Ό ꢌμž₯ν•©λ‹ˆλ‹€.

@ConfigurationProperties(prefix = "jwt")
public class JWTProperties {
private String secret;
private long accessTokenValidityInSeconds = 1800;
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

토큰 유효 기간에 λŒ€ν•œ μ΅œμ†Œκ°’ 검증 ν•„μš”

토큰 유효 기간이 λ„ˆλ¬΄ μ§§μ§€ μ•Šλ„λ‘ μ΅œμ†Œκ°’ 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

-    private long accessTokenValidityInSeconds = 1800;
+    @Min(value = 300, message = "토큰 유효 기간은 μ΅œμ†Œ 5λΆ„ 이상이어야 ν•©λ‹ˆλ‹€.")
+    private long accessTokenValidityInSeconds = 1800;
πŸ“ 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.

Suggested change
private long accessTokenValidityInSeconds = 1800;
@Min(value = 300, message = "토큰 유효 기간은 μ΅œμ†Œ 5λΆ„ 이상이어야 ν•©λ‹ˆλ‹€.")
private long accessTokenValidityInSeconds = 1800;

@Component
@ConfigurationProperties(prefix = "jwt")
public class JWTProperties {
private String secret;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

JWT secret ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검사 ν•„μš”

JWT secret은 ν•„μˆ˜ κ°’μ΄λ―€λ‘œ @NotEmpty μ–΄λ…Έν…Œμ΄μ…˜μ„ μΆ”κ°€ν•˜μ—¬ μœ νš¨μ„± 검사λ₯Ό μˆ˜ν–‰ν•΄μ•Ό ν•©λ‹ˆλ‹€.

-    private String secret;
+    @NotEmpty(message = "JWT secret은 ν•„μˆ˜ κ°’μž…λ‹ˆλ‹€.")
+    private String secret;
πŸ“ 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.

Suggested change
private String secret;
@NotEmpty(message = "JWT secret은 ν•„μˆ˜ κ°’μž…λ‹ˆλ‹€.")
private String secret;

private long accessTokenValidityInSeconds = 1800;
private String cookieName = "Authorization";
private String issuer = "go_socket";
private boolean secureCookie = false;
Copy link

Choose a reason for hiding this comment

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

πŸ’‘ Codebase verification

⚠️ Potential issue

λ³΄μ•ˆ μΏ ν‚€ μ„€μ • 문제 확인됨

ν˜„μž¬ κ΅¬μ„±μ—μ„œ λ‹€μŒκ³Ό 같은 μ‹¬κ°ν•œ λ³΄μ•ˆ λ¬Έμ œκ°€ ν™•μΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€:

  • JWTProperties의 secureCookie 기본값이 false둜 섀정됨
  • ν”„λ‘œλ•μ…˜ ν™˜κ²½μ„ ν¬ν•¨ν•œ μ–΄λ–€ ν™˜κ²½ μ„€μ • νŒŒμΌμ—μ„œλ„ 이 값을 μž¬μ •μ˜ν•˜μ§€ μ•ŠμŒ
  • SecurityConfigμ—μ„œλ„ μΏ ν‚€ λ³΄μ•ˆ 섀정을 λ³„λ„λ‘œ κ΅¬μ„±ν•˜μ§€ μ•ŠμŒ

ν”„λ‘œλ•μ…˜ ν™˜κ²½μ˜ λ³΄μ•ˆμ„ μœ„ν•΄ λ°˜λ“œμ‹œ secureCookieλ₯Ό true둜 μ„€μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€.

πŸ”— Analysis chain

λ³΄μ•ˆ μΏ ν‚€ μ„€μ • κ²€ν†  ν•„μš”

ν”„λ‘œλ•μ…˜ ν™˜κ²½μ—μ„œλŠ” λ³΄μ•ˆ μΏ ν‚€λ₯Ό ν™œμ„±ν™”ν•΄μ•Ό ν•©λ‹ˆλ‹€. ν˜„μž¬ 기본값이 false둜 μ„€μ •λ˜μ–΄ μžˆμ–΄ λ³΄μ•ˆμƒ μœ„ν—˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if secureCookie is properly configured in different environments

# Check application properties files for secure cookie configuration
echo "Checking application properties files for secure cookie configuration..."
rg -l "jwt\.secure-cookie" 

Length of output: 183


Script:

#!/bin/bash
# Search for various possible property naming patterns
echo "Checking different property naming patterns..."
rg -l "jwt\.(secure-?cookie|cookie\.secure|secureCookie)"

echo -e "\nChecking for application properties/yml files..."
fd -e properties -e yml

echo -e "\nChecking for security configuration classes..."
fd -e java -x grep -l "SecurityConfig\|WebSecurityConfig"

Length of output: 730


Script:

#!/bin/bash
echo "Checking application.yml content..."
cat src/main/resources/application.yml

echo -e "\nChecking application-dev.yml content..."
cat src/main/resources/yaml/application-dev.yml

echo -e "\nChecking SecurityConfig.java for cookie configurations..."
cat src/main/java/com/mycom/socket/auth/config/SecurityConfig.java

Length of output: 2900

Comment on lines +60 to +65
// 둜그인 응닡 생성
LoginResponse loginResponse = new LoginResponse(member.getEmail(), member.getNickname());

response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
objectMapper.writeValue(response.getWriter(), ApiResponse.success("둜그인 성곡", loginResponse));
objectMapper.writeValue(response.getWriter(), loginResponse);
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

응닡 μ²˜λ¦¬μ— μ˜ˆμ™Έ 처리λ₯Ό μΆ”κ°€ν•΄μ£Όμ„Έμš”.

objectMapper.writeValue() 호좜 μ‹œ λ°œμƒν•  수 μžˆλŠ” IOException에 λŒ€ν•œ μ˜ˆμ™Έ μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

 // 둜그인 응닡 생성
 LoginResponse loginResponse = new LoginResponse(member.getEmail(), member.getNickname());

 response.setContentType(MediaType.APPLICATION_JSON_VALUE);
 response.setCharacterEncoding("UTF-8");
-objectMapper.writeValue(response.getWriter(), loginResponse);
+try {
+    objectMapper.writeValue(response.getWriter(), loginResponse);
+} catch (IOException e) {
+    throw new RuntimeException("둜그인 응닡 생성 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.", e);
+}
πŸ“ 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.

Suggested change
// 둜그인 응닡 생성
LoginResponse loginResponse = new LoginResponse(member.getEmail(), member.getNickname());
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
objectMapper.writeValue(response.getWriter(), ApiResponse.success("둜그인 성곡", loginResponse));
objectMapper.writeValue(response.getWriter(), loginResponse);
// 둜그인 응닡 생성
LoginResponse loginResponse = new LoginResponse(member.getEmail(), member.getNickname());
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
try {
objectMapper.writeValue(response.getWriter(), loginResponse);
} catch (IOException e) {
throw new RuntimeException("둜그인 응닡 생성 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.", e);
}

@ohyuchan123 ohyuchan123 merged commit 16bf7a5 into develop Jan 8, 2025
2 checks passed
@ohyuchan123 ohyuchan123 changed the title File Directory Refactor πŸ”€ File Directory Refactor Jan 8, 2025
@ohyuchan123 ohyuchan123 added 🐞 BugFix Something isn't working and removed βœ… Test test κ΄€λ ¨(storybook, jest...) labels Jan 8, 2025
This was referenced Jan 14, 2025
@ohyuchan123 ohyuchan123 deleted the refactor/file-directory branch January 15, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working ✨ Feature κΈ°λŠ₯ 개발 πŸ”¨ Refactor μ½”λ“œ λ¦¬νŒ©ν† λ§

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants