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

Loading…
Cancel
Save