Merge branch 'jenkins_with_weblogic' of http://192.168.240.178:18080/eapim/elink-online-common.git into jenkins_with_weblogic
This commit is contained in:
+35
-2
@@ -93,7 +93,7 @@ import java.util.Date;
|
||||
* 기능을 제공한다.<br>
|
||||
* 2. 처리 개요 : <br>
|
||||
* * - 2020-09-25: Http Header 받아서 처리할 수 있게 기능 추가<br>
|
||||
* 3. 주의사항 <br>
|
||||
* 3. 주의사항 <br>
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
@@ -164,6 +164,9 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
|
||||
//Outbound 요청에 대한 응답 메시지의 복호화 여부 결정위해 jwhong
|
||||
encryptResponseApply = StringUtils.equalsIgnoreCase(prop.getProperty("ENCRYPT_RESPONSE_APPLY", "N"), "Y");
|
||||
|
||||
//업체 300응답시 특정 http status code 경우 에러 아닌걸로 처리. 광주은행
|
||||
String errIgnore = prop.getProperty("ERROR_IGNORE_CODE", "");
|
||||
|
||||
/**
|
||||
* @formatter:off
|
||||
@@ -496,7 +499,10 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
map.put(HttpAdapterServiceKey.OUTBOUND_RESPONSE_MESSAGE, responseString);
|
||||
map.put(HttpAdapterServiceKey.OUTBOUND_RESPONSE_STATUS, status);
|
||||
|
||||
if (status >= 200 && status <= 207) {
|
||||
|
||||
if (isStatusInIgnore(status,errIgnore )) {
|
||||
// 이경우 정상으로 처리함
|
||||
} else if (status >= 200 && status <= 207) {
|
||||
if (useAdapterToken && StringUtils.equals(tokenErrorHttpStatusCode, "200")) {
|
||||
needReissue = checkTokenRetry(responseMessage, tokenErrorCodeKey, tokenErrorCodeValues,
|
||||
vo.getEncode());
|
||||
@@ -1586,4 +1592,31 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
|
||||
logger.debug("HttpClientAdapterServiceRest] after concatenate url=[" + targetUrl + "] ");
|
||||
return targetUrl;
|
||||
}
|
||||
|
||||
|
||||
private boolean isStatusInIgnore(int status, String errIgnore) {
|
||||
if (errIgnore == null || errIgnore.isEmpty()) return false;
|
||||
|
||||
String[] tokens = errIgnore.split(",");
|
||||
for (String token : tokens) {
|
||||
token = token.trim();
|
||||
if (token.contains("-")) {
|
||||
// 범위 처리
|
||||
String[] range = token.split("-");
|
||||
int start = Integer.parseInt(range[0].trim());
|
||||
int end = Integer.parseInt(range[1].trim());
|
||||
if (status >= start && status <= end) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// 단일 숫자 처리
|
||||
int code = Integer.parseInt(token);
|
||||
if (status == code) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-6
@@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.eactive.eai.adapter.http.HttpMethodType;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
|
||||
import com.eactive.eai.authserver.service.OAuth2Manager;
|
||||
@@ -43,8 +44,7 @@ public class HmacSha256VerifyFilterKjb implements HttpAdapterFilter {
|
||||
String xObpSignatureUrl = request.getHeader("x-obp-signature-url");
|
||||
String xObpSignatureBody = request.getHeader("x-obp-signature-body");
|
||||
if (StringUtils.isBlank(xObpPartnercode)
|
||||
|| StringUtils.isBlank(xObpSignatureUrl)
|
||||
|| StringUtils.isBlank(xObpSignatureBody)) {
|
||||
|| StringUtils.isBlank(xObpSignatureUrl)) {
|
||||
throw new JwtAuthException(
|
||||
String.valueOf(HttpStatus.UNAUTHORIZED.value()),
|
||||
"Can not find mandatory Http Header");
|
||||
@@ -67,10 +67,19 @@ public class HmacSha256VerifyFilterKjb implements HttpAdapterFilter {
|
||||
"Signature verifying failed : x-obp-signature-url");
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(xObpSignatureBody, macBody)) {
|
||||
throw new JwtAuthException(
|
||||
String.valueOf(HttpStatus.UNAUTHORIZED.value()),
|
||||
"Signature verifying failed : x-obp-signature-body");
|
||||
switch (HttpMethodType.getValue(request.getMethod())) {
|
||||
case GET:
|
||||
case DELETE:
|
||||
break;
|
||||
default:
|
||||
if (StringUtils.isNotBlank(inboundBody) && !StringUtils.equals("{}", inboundBody)) {
|
||||
if (!StringUtils.equals(xObpSignatureBody, macBody)) {
|
||||
throw new JwtAuthException(
|
||||
String.valueOf(HttpStatus.UNAUTHORIZED.value()),
|
||||
"Signature verifying failed : x-obp-signature-body");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JwtAuthException e) {
|
||||
|
||||
Reference in New Issue
Block a user