Skip to content

Conversation

@gogori6565
Copy link
Contributor

📣 Related Issue

📝 Summary

1. 서비스 클래스 오타
-> MemeberService -> MemberService 오타 수정

2. 스프링시큐리티 세션 정책 명시
-> JWT를 쓰더라도 스프링 시큐리티는 기본적으로 세션을 생성하기에 무상태 설정 추가
http.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));

3. JwtTokenProvider
-> Gradle: io.jsonwebtoken:jjwt-api:0.12.5 버전에서 Jwt.parserBuilder() Deprecated가 되었다고 함

  • Jwts.parser() / Jwts.builder() 사용
    • builder() → 토큰 만들 때 쓰는 것 (클레임·만료시간 설정 후 compact() 호출)
    • parser() → 토큰 검증/파싱할 때 쓰는 것 (키로 검증하고 parseSignedClaims(...)로 클레임 추출)
  • Jwts.claims() → Builder 반환
  • setXxx → xxx (예: subject)
  • 마지막에 build() 호출
  • 파서 호출 방식 변경 (parser() + verifyWith)

4. RestTemplate -> WebClient 수정
-> Spring 5.0 이후부터는 RestTemplate이 Deprecated 예정이라 WebClient로 교체하는걸 권장

5. 예외처리
-> 커스텀 예외 처리 사용함

6. 레이어드 아키텍처 분리 모호
-> @Valid 사용하여 에러처리 + controller & service 역할 확실히 분리

7. 구글 관련 서비스 분리
-> MemberService.java 내 구글 OAuth 관련 코드 OAuthService.java 만들어서 분리시킴

8. PrincipalDetails
-> PrincipalDetails는 원래 Spring Security + OAuth2 세션 기반 인증에서 사용, 현재 우리는 JWT 방식 사용 중이므로 삭제

📬 Reference

}

// 신규 회원가입 처리 로직 (DB 저장)
private Member signUp(String socialId, String email, String name, String picture) {
Copy link
Member

Choose a reason for hiding this comment

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

회원 생성은 여러 DB 쓰기를 하나의 작업으로 묶어 예외 발생 시 전체 롤백 및 데이터 정합성을 보장해야 하므로, 회원가입 메서드에 @transactional을 추가해주세요!

Copy link
Contributor Author

@gogori6565 gogori6565 Dec 11, 2025

Choose a reason for hiding this comment

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

signUp 메서드는 부모 메서드(loginWithGoogle)가 제공하는 트랜잭션 범위 내에서 실행되고 있기 때문에 추가적인 @transactional을 넣지 않았습니다!
피드백 감사합니다 :)

Copy link
Member

@rhkr8521 rhkr8521 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

@rhkr8521 rhkr8521 merged commit 196f4be into develop Dec 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFAC] 구글 OAuth 코드 리뷰 수정

3 participants