Просмотр исходного кода

Merge branch 'develop' of http://112.172.147.34:4936/style24/style24.scm.git into develop

eskim 4 лет назад
Родитель
Сommit
a4fc4759b3

+ 62 - 37
src/main/java/com/style24/scm/support/env/TssConstants.java

@@ -1,37 +1,62 @@
-package com.style24.scm.support.env;
-
-/**
- * 변경될 소지가 있는 변수 값을 정의
- *
- * @author gagamel
- * @since 2020. 10. 19
- */
-public class TssConstants {
-
-	public static final String EXCEL_FOOTER_TITLE = "Copyright(c) 2020 STYLE24, All rights reserved.";
-
-	// 사이트코드
-	public static final String SITE_CD = "G047_10";
-	
-	// 정산구분상태
-	public enum OrdDtlItemStat {
-		
-		SALE_PAYMENT_COMPLETE("G720_10"), 			// 판매-결제완료
-		SALE_SHIPPING("G720_20"),					// 판매-배송완료
-		SALE_RETURN_CANCEL("G720_30"), 				// 환입-취소완료
-		SALE_RETURN_SOLDOUT_CANCEL("G720_40"),		// 환입-품절취소
-		SALE_RETURN_RETURN_COMPLETE("G720_50"),		// 환입-반품완료
-		SALE_RETURN_EXCHANGE_COMPLETE("G720_60");	// 환입-교환완료
-
-		private String value;
-
-		private OrdDtlItemStat(String value) {
-			this.value = value;
-		}
-
-		public String value() {
-			return value;
-		}
-	}
-
-}
+package com.style24.scm.support.env;
+
+/**
+ * 변경될 소지가 있는 변수 값을 정의
+ *
+ * @author gagamel
+ * @since 2020. 10. 19
+ */
+public class TssConstants {
+
+	public static final String EXCEL_FOOTER_TITLE = "Copyright(c) 2020 STYLE24, All rights reserved.";
+
+	// 사이트코드
+	public static final String SITE_CD = "G047_10";
+
+	// 정산구분상태
+	public enum OrdDtlItemStat {
+
+		SALE_PAYMENT_COMPLETE("G720_10"), 			// 판매-결제완료
+		SALE_SHIPPING("G720_20"),					// 판매-배송완료
+		SALE_RETURN_CANCEL("G720_30"), 				// 환입-취소완료
+		SALE_RETURN_SOLDOUT_CANCEL("G720_40"),		// 환입-품절취소
+		SALE_RETURN_RETURN_COMPLETE("G720_50"),		// 환입-반품완료
+		SALE_RETURN_EXCHANGE_COMPLETE("G720_60");	// 환입-교환완료
+
+		private String value;
+
+		private OrdDtlItemStat(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
+
+	/**
+	 * 셀러툴 인증키. 인증키는 다음의 형식으로 처리
+	 * 		x-auth-id
+	 * 			샵링커: shoplinker, 사방넷: sabangnet, EC모니터: ecmonitor
+	 * 		x-auth-key
+	 * 			LOWER(FN_ENC_AES(x-auth-id 값))
+	 * @author gagamel
+	 *
+	 */
+	public enum SellerAuthKey {
+		SHOPLINKER("a4e44d618fe36236e5141c863a014cd3"),	// 샵링커
+		SABANGNET("fb92929d6201b71ef8e465addf1a0ce0"),	// 사방넷
+		ECMONITOR("733c8aa0177e43a84555adc4dc60bd33");	// EC모니터
+
+		private String value;
+
+		private SellerAuthKey(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
+
+}

+ 27 - 0
src/main/java/com/style24/scm/support/security/handler/TssLoginSuccessHandler.java

@@ -6,12 +6,14 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
 import org.springframework.stereotype.Component;
 
 import com.style24.scm.biz.service.TssLoginService;
+import com.style24.scm.support.env.TssConstants;
 import com.style24.scm.support.security.TssLoginDetails;
 import com.style24.scm.support.security.session.TssSession;
 
@@ -68,6 +70,31 @@ public class TssLoginSuccessHandler implements AuthenticationSuccessHandler {
 	private void createSession(HttpServletRequest request, TssLoginDetails loginDetails) {
 		TssSession.getNewSess(request, -1);
 		TssSession.setAttribute(request, loginDetails);
+
+		// 입점업체이면서
+		if ("G001_B000".equals(loginDetails.getLoginInfo().getRoleCd())) {
+			String headerAuthId = request.getHeader("x-auth-id");	// 샵링커: shoplinker, 사방넷: sabangnet, EC모니터: ecmonitor
+			String headerAuthKey = request.getHeader("x-auth-key");	// LOWER(FN_ENC_AES(위의 headerAuthId 값))
+			log.info("x-auth-id: {}, x-auth-key: {}", headerAuthId, headerAuthKey);
+
+			// Header에 인증ID와 인증키가 있으면
+			if (StringUtils.isNotBlank(headerAuthId) && StringUtils.isNotBlank(headerAuthKey)) {
+				String authKey = "";
+				if (headerAuthId.equals(TssConstants.SellerAuthKey.SHOPLINKER.name().toLowerCase())) {
+					authKey = TssConstants.SellerAuthKey.SHOPLINKER.value();
+				} else if (headerAuthId.equals(TssConstants.SellerAuthKey.SABANGNET.name().toLowerCase())) {
+					authKey = TssConstants.SellerAuthKey.SABANGNET.value();
+				} else if (headerAuthId.equals(TssConstants.SellerAuthKey.ECMONITOR.name().toLowerCase())) {
+					authKey = TssConstants.SellerAuthKey.ECMONITOR.value();
+				}
+
+				// 입점업체의 인증키와 Header의 인증키가 같으면 2factor인증 skip을 위한 2factor인증 세션을 true로 설정
+				if (authKey.equals(headerAuthKey)) {
+					log.info("x-auth-key is equal!!!");
+					TssSession.setAttribute("isTfcertify", "true");
+				}
+			}
+		}
 	}
 
 }