-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
1. Issue : 🐞 Fix / Bug
/api/v1/system/test-token 엔드포인트에서 ClassCastException 발생
String을 CustomUserPrincipal로 캐스팅하려다 실패
java.lang.ClassCastException: class java.lang.String cannot be cast to class com.divary.global.config.security.CustomUserPrincipal
at com.divary.global.config.jwt.JwtTokenProvider.generateAccessToken(JwtTokenProvider.java:45)
at com.divary.domain.system.controller.SystemController.generateTestToken(SystemController.java:118)
2. 원인 파악
UsernamePasswordAuthenticationToken의 principal을 String(email)로 설정
JwtTokenProvider.generateAccessToken()은 CustomUserPrincipal을 기대
타입 불일치로 캐스팅 실패
3. 해결 방안
이메일로 Member 조회하고
CustomUserPrincipal 생성해서
Authentication에 CustomUserPrincipal을 principal로 설정하기
Reactions are currently unavailable