From 7ea34754031bd2996467d015a81a245c49ae61bc Mon Sep 17 00:00:00 2001 From: aeeazip Date: Wed, 23 Aug 2023 02:48:56 +0900 Subject: [PATCH] =?UTF-8?q?fix(#125)=20:=20loadUserByUsername=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trothcam/service/auth/UserDetailServiceImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/trothly/trothcam/service/auth/UserDetailServiceImpl.java b/src/main/java/trothly/trothcam/service/auth/UserDetailServiceImpl.java index 9cfc5f4..b71b999 100644 --- a/src/main/java/trothly/trothcam/service/auth/UserDetailServiceImpl.java +++ b/src/main/java/trothly/trothcam/service/auth/UserDetailServiceImpl.java @@ -1,6 +1,7 @@ package trothly.trothcam.service.auth; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -10,6 +11,7 @@ import static trothly.trothcam.exception.base.ErrorCode.MEMBER_NOT_FOUND; +@Slf4j @RequiredArgsConstructor @Service public class UserDetailServiceImpl implements UserDetailsService { @@ -18,7 +20,12 @@ public class UserDetailServiceImpl implements UserDetailsService { @Override public UserDetails loadUserByUsername(String memberId) throws UsernameNotFoundException { System.out.println("로그인한 memberId : " + memberId); - return (UserDetails) memberRepository.findById(Long.parseLong(memberId)) + UserDetails result = (UserDetails) memberRepository.findById(Long.parseLong(memberId)) .orElseThrow(() -> new BadRequestException(MEMBER_NOT_FOUND)); + + log.info("UserDetails: " + result.getUsername()); + log.info("UserDetails: " + result.toString()); + + return result; } }