Skip to content

Commit

Permalink
fix(#125) : loadUserByUsername 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
aeeazip committed Aug 22, 2023
1 parent 86a1cea commit 7ea3475
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,6 +11,7 @@

import static trothly.trothcam.exception.base.ErrorCode.MEMBER_NOT_FOUND;

@Slf4j
@RequiredArgsConstructor
@Service
public class UserDetailServiceImpl implements UserDetailsService {
Expand All @@ -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;
}
}

0 comments on commit 7ea3475

Please sign in to comment.