fix: Nice 토큰발급 & 공개키 요청 fix

dev
gitea-관리자 11 months ago
parent 60911677cb
commit e9145772ea

@ -17,6 +17,7 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResponse;
import kr.xit.biz.nice.mapper.IBizNiceCiMapper; import kr.xit.biz.nice.mapper.IBizNiceCiMapper;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService; import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.nice.cmm.CmmNiceCiUtils; import kr.xit.ens.nice.cmm.CmmNiceCiUtils;
import kr.xit.ens.nice.service.INiceCiService; import kr.xit.ens.nice.service.INiceCiService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -64,8 +65,29 @@ public class BizNiceCiService extends AbstractService implements IBizNiceCiServi
@Override @Override
@Transactional @Transactional
public NiceTokenResponse generateToken(final NiceCiRequest reqDTO){ public NiceTokenResponse generateToken(final NiceCiRequest reqDTO){
final NiceTokenResponse tokenResponse = niceCiService.generateToken(reqDTO);
final ResponseDataHeader dataHeader = tokenResponse.getDataHeader(); NiceTokenResponse tokenResponse = niceCiService.generateToken(reqDTO);
ResponseDataHeader dataHeader = tokenResponse.getDataHeader();
// token이 만료 및 폐기된 상태
if(dataHeader.getGwRsltCd().equals("1800")){
// 1. 토큰 폐기
try {
final TokenRevokeResponse revokeResDTO = revokeToken(reqDTO);
if(!(revokeResDTO.getDataHeader().getGwRsltCd().equals("1200") && revokeResDTO.getDataBody().isResult())){
throw BizRuntimeException.create(JsonUtils.toJson(revokeResDTO.getDataHeader()));
}
} catch (BizRuntimeException be){
throw be;
} catch (Exception e){
throw BizRuntimeException.create(e.getMessage());
}
// 토큰 폐기후 재발급
tokenResponse = niceCiService.generateToken(reqDTO);
dataHeader = tokenResponse.getDataHeader();
}
if(dataHeader.getGwRsltCd().equals("1200")){ if(dataHeader.getGwRsltCd().equals("1200")){
final TokenResDataBody dataBody = tokenResponse.getDataBody(); final TokenResDataBody dataBody = tokenResponse.getDataBody();

@ -12,14 +12,12 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo;
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader; import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyRegInfo; import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyRegInfo;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResponse;
import kr.xit.biz.nice.service.IBizNiceCiService; import kr.xit.biz.nice.service.IBizNiceCiService;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.util.ApiSpringUtils; import kr.xit.core.spring.util.ApiSpringUtils;
import kr.xit.core.spring.util.CoreSpringUtils; import kr.xit.core.spring.util.CoreSpringUtils;
import kr.xit.core.spring.util.MessageUtil; import kr.xit.core.spring.util.MessageUtil;
import kr.xit.core.support.utils.DateUtils; import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.cmm.CmmEnsUtils; import kr.xit.ens.cmm.CmmEnsUtils;
import kr.xit.ens.nice.service.INiceCiService; import kr.xit.ens.nice.service.INiceCiService;
import lombok.AccessLevel; import lombok.AccessLevel;
@ -70,9 +68,8 @@ public class CmmNiceCiUtils {
* *
* 0. cache call * 0. cache call
* --> * -->
* 1. * 1.
* 2. * 2. cache reload
* 4. cache reload
* @param reqDTO NiceCiRequest * @param reqDTO NiceCiRequest
* @return NiceCiRequest * @return NiceCiRequest
* </pre> * </pre>
@ -84,12 +81,12 @@ public class CmmNiceCiUtils {
if(StringUtils.isNotEmpty(niceDTO.getValidDtim()) if(StringUtils.isNotEmpty(niceDTO.getValidDtim())
&& DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_EMPTY_DLT).compareTo(niceDTO.getValidDtim()) < 0) return niceDTO; && DateUtils.getTodayAndNowTime(ApiConstants.FMT_DT_EMPTY_DLT).compareTo(niceDTO.getValidDtim()) < 0) return niceDTO;
// 1. 토큰 폐기 // // 1. 토큰 폐기
TokenRevokeResponse revokeResDTO = bizNiceService.revokeToken(reqDTO); // TokenRevokeResponse revokeResDTO = bizNiceService.revokeToken(reqDTO);
//
if(!(revokeResDTO.getDataHeader().getGwRsltCd().equals("1200") && revokeResDTO.getDataBody().isResult())){ // if(!(revokeResDTO.getDataHeader().getGwRsltCd().equals("1200") && revokeResDTO.getDataBody().isResult())){
throw BizRuntimeException.create(JsonUtils.toJson(revokeResDTO.getDataHeader())); // throw BizRuntimeException.create(JsonUtils.toJson(revokeResDTO.getDataHeader()));
} // }
// 2. 공개키 발급 처리 // 2. 공개키 발급 처리
//TODO::에러 처리 - throw exception //TODO::에러 처리 - throw exception

Loading…
Cancel
Save