From 45c1775be3b3ad2f37b68742f4039d7a0c99a77f Mon Sep 17 00:00:00 2001 From: toychip Date: Tue, 13 Feb 2024 05:05:27 +0900 Subject: [PATCH] fix: System.out.println() -> log.info() (#51) --- .../api/ttoklip/domain/common/base/BaseEntityConfig.java | 8 +++++--- .../ttoklip/global/security/auth/service/AuthService.java | 6 ++++-- .../security/auth/service/OAuth2UserInfoFactory.java | 4 ++-- .../com/api/ttoklip/global/security/jwt/JwtProvider.java | 6 +++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/api/ttoklip/domain/common/base/BaseEntityConfig.java b/src/main/java/com/api/ttoklip/domain/common/base/BaseEntityConfig.java index 14b75ba6..2b0c6f5c 100644 --- a/src/main/java/com/api/ttoklip/domain/common/base/BaseEntityConfig.java +++ b/src/main/java/com/api/ttoklip/domain/common/base/BaseEntityConfig.java @@ -2,6 +2,7 @@ import com.api.ttoklip.domain.member.domain.Member; import java.util.Optional; +import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.AuditorAware; @@ -9,6 +10,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +@Slf4j @EnableJpaAuditing @Configuration public class BaseEntityConfig { @@ -21,9 +23,9 @@ public AuditorAware auditorProvider() { return Optional.of("AnonymousNULL"); } - System.out.println("authentication = " + authentication); - System.out.println("----------- 클래스 타입" + authentication.getClass()); - System.out.println("----------- 클래스 타입" + authentication.getPrincipal().getClass()); + log.info("authentication = " + authentication); + log.info("----------- 클래스 타입" + authentication.getClass()); + log.info("----------- 클래스 타입" + authentication.getPrincipal().getClass()); Object principal = authentication.getPrincipal(); diff --git a/src/main/java/com/api/ttoklip/global/security/auth/service/AuthService.java b/src/main/java/com/api/ttoklip/global/security/auth/service/AuthService.java index 9bfbfe4c..5c4ed510 100644 --- a/src/main/java/com/api/ttoklip/global/security/auth/service/AuthService.java +++ b/src/main/java/com/api/ttoklip/global/security/auth/service/AuthService.java @@ -11,8 +11,10 @@ import com.api.ttoklip.global.security.auth.userInfo.OAuth2UserInfo; import java.util.Optional; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +@Slf4j @Service @RequiredArgsConstructor public class AuthService { @@ -49,8 +51,8 @@ private LoginResponse getLoginResponse(final Member member, final boolean ifFirs } private Member registerNewMember(final OAuth2UserInfo userInfo, final String provider) { - System.out.println("AuthService.registerNewMember"); - System.out.println("userInfo.getName() = " + userInfo.getName()); + log.info("AuthService.registerNewMember"); + log.info("userInfo.getName() = " + userInfo.getName()); Member newMember = Member.builder() .email(userInfo.getEmail()) .originName(userInfo.getName()) diff --git a/src/main/java/com/api/ttoklip/global/security/auth/service/OAuth2UserInfoFactory.java b/src/main/java/com/api/ttoklip/global/security/auth/service/OAuth2UserInfoFactory.java index acb0515f..643e3824 100644 --- a/src/main/java/com/api/ttoklip/global/security/auth/service/OAuth2UserInfoFactory.java +++ b/src/main/java/com/api/ttoklip/global/security/auth/service/OAuth2UserInfoFactory.java @@ -47,7 +47,7 @@ private KakaoUserInfo getKakaoUserInfo(String accessToken) { .bodyToMono(new ParameterizedTypeReference>() { }) .block(); - System.out.println("---------------------------------------- attributes = " + attributes); + log.info("---------------------------------------- attributes = " + attributes); return new KakaoUserInfo(attributes); } @@ -63,7 +63,7 @@ private OAuth2UserInfo getNaverUserInfo(final String accessToken) { .bodyToMono(new ParameterizedTypeReference>() { }) .block(); - System.out.println("---------------------------------------- naver attributes = " + attributes); + log.info("---------------------------------------- naver attributes = " + attributes); return new NaverUserInfo(attributes); } } diff --git a/src/main/java/com/api/ttoklip/global/security/jwt/JwtProvider.java b/src/main/java/com/api/ttoklip/global/security/jwt/JwtProvider.java index 86c6a75a..36489c33 100644 --- a/src/main/java/com/api/ttoklip/global/security/jwt/JwtProvider.java +++ b/src/main/java/com/api/ttoklip/global/security/jwt/JwtProvider.java @@ -104,11 +104,11 @@ private void setContextHolder(String jwtToken, Member loginMember) { List authorities = getAuthorities(loginMember.getRole()); UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginMember, jwtToken, authorities); - System.out.println("------------------JwtProvider.setContextHolder"); + log.info("------------------JwtProvider.setContextHolder"); SecurityContextHolder.getContext().setAuthentication(authenticationToken); - System.out.println("loginMember = " + loginMember.getEmail()); - System.out.println("------end------------JwtProvider.setContextHolder"); + log.info("loginMember = " + loginMember.getEmail()); + log.info("------end------------JwtProvider.setContextHolder"); } private List getAuthorities(Role role) {