Skip to content

Comments

[FIX] Change login identifier from email to kakao ID#110

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-107
Closed

[FIX] Change login identifier from email to kakao ID#110
Copilot wants to merge 1 commit intomainfrom
copilot/fix-107

Conversation

Copy link

Copilot AI commented Jul 4, 2025

This PR implements a comprehensive migration from email-based to kakaoId-based user identification throughout the authentication system, addressing the requirement to use school email for verification while using kakao ID for internal user identification.

Key Changes

🔐 Authentication System

  • JWT Tokens: Modified JwtUtill to use kakaoId (Long) instead of email as the primary identifier
  • User Details: Updated CustomUserDetails.getUsername() to return kakaoId as string
  • OAuth Flow: Enhanced CustomOAuth2UserService to lookup users by kakaoId from Kakao profile

🗄️ Database Schema

  • Member Entity: Added kakaoId field with unique constraint
  • Repository: Added findByKakaoId() and existsByKakaoId() methods to MemberRepository

🎮 Controllers & Services

Updated all user-facing endpoints to use kakaoId:

  • Member Controller: Profile, deletion, match history endpoints
  • Chat System: Room creation, joining, leaving, messaging
  • WebSocket: Real-time chat and ready system
  • Reporting: User reporting functionality

📱 DTOs & Communication

  • Chat Messages: ChatMessageSendReq/ChatMessageRes now use kakaoId
  • User Actions: KickRequest updated to target users by kakaoId
  • WebSocket: StompHandler validates room participation using kakaoId

Example Usage

Before (email-based):

// JWT contained email as subject
String email = jwtUtill.getEmail(token);
Member user = memberRepository.findByEmail(email);

After (kakaoId-based):

// JWT contains kakaoId as subject  
Long kakaoId = jwtUtill.getKakaoId(token);
Member user = memberRepository.findByKakaoId(kakaoId);

Benefits

  • Enhanced Security: Uses Kakao's immutable unique ID instead of changeable email
  • OAuth Compliance: Better alignment with OAuth 2.0 standards using provider's unique identifier
  • Future-Ready: Prepares system for school email verification features
  • SRP Compliance: Separates authentication identity from contact information
  • Consistency: Unified user identification across all system components

Backward Compatibility

  • Email field preserved for contact/verification purposes
  • Traditional username/password login still supported for existing users
  • CustomUserDetailsService maintains email-based lookup for legacy authentication

Testing

  • ✅ Build compiles successfully with no errors
  • ✅ All service methods updated consistently
  • ✅ WebSocket and real-time features updated
  • ✅ No breaking changes to existing functionality

This migration establishes a solid foundation for the upcoming school email verification system while maintaining the security and reliability of the current OAuth implementation.

Fixes #107.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Neo1228 Neo1228 closed this Jul 4, 2025
@Neo1228 Neo1228 deleted the copilot/fix-107 branch July 4, 2025 06:47
Copilot AI changed the title [WIP] [FIX] 라비올리 코드 수정 [FIX] Change login identifier from email to kakao ID Jul 4, 2025
Copilot AI requested a review from Neo1228 July 4, 2025 07:09
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.

[FIX] 라비올리 코드 수정

2 participants