Skip to content

Commit

Permalink
hotfix: naver 로그인 예외 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Livenow14 committed Aug 2, 2021
1 parent c40e09f commit 9c3d157
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/deploy/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,6 +20,7 @@
import org.springframework.web.client.RestTemplate;

@Component
@Slf4j
public class NaverAuthorization implements Authorization {

@Value("${security.auth.naver.client-secret}")
Expand Down Expand Up @@ -61,6 +63,7 @@ public OAuthToken mapToOAuthToken(ResponseEntity<String> response) {
try {
return objectMapper.readValue(response.getBody(), NaverOAuthToken.class);
} catch (JsonProcessingException e) {
log.info("토근 정보를 매핑하는데 실패했습니다. {}", response.getBody());
throw new MappingFailureException("토큰 정보를 매핑하는데 실패했습니다.");
}
}
Expand Down
22 changes: 22 additions & 0 deletions backend/src/main/java/com/backjoongwon/cvi/common/EnvSecret.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}

0 comments on commit 9c3d157

Please sign in to comment.