Browse Source

수정 중

jsshin 5 years ago
parent
commit
771e10467a
1 changed files with 16 additions and 3 deletions
  1. 16 3
      src/main/java/com/style24/front/biz/thirdparty/NiceCertify.java

+ 16 - 3
src/main/java/com/style24/front/biz/thirdparty/NiceCertify.java

@@ -11,6 +11,7 @@ import com.style24.persistence.domain.Customer;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 
@@ -32,7 +33,8 @@ public class NiceCertify {
 	@Autowired
 	private Environment env;
 
-	public static final String PROTOCOL = "http://";
+	@Value("${has-ssl}")
+	private String hasSsl;
 
 	private String niceId;			// 나이스휴대폰인증ID
 	private String nicePwd;			// 나이스휴대폰인증비밀번호
@@ -41,6 +43,7 @@ public class NiceCertify {
 	private String ipinPwd;			// 나이스아이핀인증비밀번호
 	private String ipinCallback;	// 나이스아이핀콜백URL
 	private String domain;
+	private String protocal;
 
 	@PostConstruct
 	public void init() {
@@ -51,6 +54,14 @@ public class NiceCertify {
 		ipinPwd = env.getProperty("certify.ipin.pwd");
 		ipinCallback = env.getProperty("certify.ipin.callback");
 		domain = env.getProperty("domain.front");
+
+		boolean isSslServer = Boolean.parseBoolean(hasSsl);
+		if (isSslServer) {
+			protocal = "https://";
+		} else {
+			protocal = "http://";
+		}
+
 		log.debug("\n\n---- NiceCertify initialization started ----");
 		log.debug("나이스휴대폰인증(ID: {}, PWD: {}, callback: {})", niceId, nicePwd, domain + niceCallback);
 		log.debug("나이스아이핀인증(ID: {}, PWD: {}, callback: {})", ipinId, ipinPwd, domain + ipinCallback);
@@ -70,7 +81,9 @@ public class NiceCertify {
 		log.info("sRequestNo: {}", sRequestNo);
 		TsfSession.setAttribute("REQ_SEQ", sRequestNo);
 
-		String callback = GagaFileUtil.getConcatenationPath(PROTOCOL + TsfSession.getHttpServletRequest().getServerName(), niceCallback);
+
+
+		String callback = GagaFileUtil.getConcatenationPath(protocal + TsfSession.getHttpServletRequest().getServerName(), niceCallback);
 		log.info("niceCallback: {}", niceCallback);
 
 		String sAuthType = "M";	// 없으면 기본 선택화면, M: 휴대폰, C: 신용카드, X: 공인인증서
@@ -233,7 +246,7 @@ public class NiceCertify {
 	 */
 	public GagaMap certifyIpin() {
 		IPIN2Client ipinClinet = new IPIN2Client();
-		String callback = GagaFileUtil.getConcatenationPath( PROTOCOL + TsfSession.getHttpServletRequest().getServerName(), ipinCallback);
+		String callback = GagaFileUtil.getConcatenationPath( protocal + TsfSession.getHttpServletRequest().getServerName(), ipinCallback);
 
 		String sCPRequestNo = ipinClinet.getRequestNO(ipinId);
 		TsfSession.setAttribute("CPREQUEST", sCPRequestNo);