Skip to content

Commit

Permalink
[Fix] 유저정보 로그확인 코드 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
jodonghyeon3 committed Jan 29, 2024
1 parent e3bb6c9 commit 411b1b4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/example/soonsul/util/UserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
public class UserUtil {
private final UserRepository userRepository;

public User getUserByAuthentication(){
Authentication authentication= SecurityContextHolder.getContext().getAuthentication();
public User getUserByAuthentication() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
try {
return userRepository.findById(authentication.getName())
.orElseThrow(() -> new UserNotExist("login user not exist", ErrorCode.USER_NOT_EXIST));
} catch (Exception e) {
log.error(authentication.getName());
log.error("인증이름확인" + authentication.getName());
throw new RuntimeException("");
}


}

public User getUserById(String userId){
public User getUserById(String userId) {
return userRepository.findById(userId)
.orElseThrow(()-> new UserNotExist("login user not exist", ErrorCode.USER_NOT_EXIST));
.orElseThrow(() -> new UserNotExist("login user not exist", ErrorCode.USER_NOT_EXIST));
}
}

0 comments on commit 411b1b4

Please sign in to comment.