From 9c3d1570b7313e74abb76a0fcc581c9efcd6baff Mon Sep 17 00:00:00 2001 From: TaeJeong Kim Date: Mon, 2 Aug 2021 14:43:37 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20naver=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=EC=98=88=EC=99=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/deploy/start.sh | 2 +- .../authorization/NaverAuthorization.java | 3 +++ .../backjoongwon/cvi/common/EnvSecret.java | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/com/backjoongwon/cvi/common/EnvSecret.java diff --git a/backend/deploy/start.sh b/backend/deploy/start.sh index c96c0479..227d504e 100644 --- a/backend/deploy/start.sh +++ b/backend/deploy/start.sh @@ -28,7 +28,7 @@ if [[ "$1" == prod ]] then nohup java -jar \ -Duser.timezone=Asia/Seoul \ - -Dspring.config.location=classpath:/application.yml,/home/ubuntu/deploy/application-db.yml,/home/ubuntu/deploy/application-jwt.yml \ + -Dspring.config.location=classpath:/application.yml,/home/ubuntu/deploy/application-db.yml,/home/ubuntu/deploy/application-jwt.yml,/home/ubuntu/deploy/application-client-secret.yml \ -Dspring.profiles.active=$IDLE_PROFILE,"$1"\ $JAR_LOCATION > ~/nohup.out 2>&1 & else diff --git a/backend/src/main/java/com/backjoongwon/cvi/auth/domain/authorization/NaverAuthorization.java b/backend/src/main/java/com/backjoongwon/cvi/auth/domain/authorization/NaverAuthorization.java index 639b9035..9c9926c0 100644 --- a/backend/src/main/java/com/backjoongwon/cvi/auth/domain/authorization/NaverAuthorization.java +++ b/backend/src/main/java/com/backjoongwon/cvi/auth/domain/authorization/NaverAuthorization.java @@ -8,6 +8,7 @@ import com.backjoongwon.cvi.common.exception.MappingFailureException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -19,6 +20,7 @@ import org.springframework.web.client.RestTemplate; @Component +@Slf4j public class NaverAuthorization implements Authorization { @Value("${security.auth.naver.client-secret}") @@ -61,6 +63,7 @@ public OAuthToken mapToOAuthToken(ResponseEntity response) { try { return objectMapper.readValue(response.getBody(), NaverOAuthToken.class); } catch (JsonProcessingException e) { + log.info("토근 정보를 매핑하는데 실패했습니다. {}", response.getBody()); throw new MappingFailureException("토큰 정보를 매핑하는데 실패했습니다."); } } diff --git a/backend/src/main/java/com/backjoongwon/cvi/common/EnvSecret.java b/backend/src/main/java/com/backjoongwon/cvi/common/EnvSecret.java new file mode 100644 index 00000000..e8243404 --- /dev/null +++ b/backend/src/main/java/com/backjoongwon/cvi/common/EnvSecret.java @@ -0,0 +1,22 @@ +package com.backjoongwon.cvi.common; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; + +@Slf4j +@Component +public class EnvSecret { + + @Autowired + Environment env; + + @PostConstruct + public void init() { + log.info("naver.client-secret = " + env.getProperty("security.auth.naver.client-secret")); + log.info("jwt.secret-key = " + env.getProperty("security.jwt.token.secret-key")); + } +}