Skip to content

Commit

Permalink
Merge pull request #203 from Troth-Cam/fix/product
Browse files Browse the repository at this point in the history
fix(#125) : loadUserByUsername 수정
  • Loading branch information
aeeazip authored Aug 22, 2023
2 parents af79a23 + 7ea3475 commit 7b39f11
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 7b39f11

Please sign in to comment.