install
diff --git a/src/main/java/kcc/kccadr/xxx/web/XxxWebController.java b/src/main/java/kcc/kccadr/xxx/web/XxxWebController.java
index 591ea102..05b2a56f 100644
--- a/src/main/java/kcc/kccadr/xxx/web/XxxWebController.java
+++ b/src/main/java/kcc/kccadr/xxx/web/XxxWebController.java
@@ -1,26 +1,6 @@
package kcc.kccadr.xxx.web;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.annotation.Resource;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import kcc.com.cmm.CmmUtil;
@@ -30,18 +10,37 @@ import kcc.com.cmm.service.EgovCmmUseService;
import kcc.com.cmm.service.EgovFileMngService;
import kcc.com.cmm.service.EgovFileMngUtil;
import kcc.com.cmm.service.FileVO;
+import kcc.com.utl.user.service.CheckLoginUtil;
import kcc.kccadr.xxx.service.XxxService;
import kcc.kccadr.xxx.service.XxxVO;
+import kcc.ve.cmm.crt.CertPhoneRequestUtill;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.*;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
/**
* 대국민(사용자)
* XXX에 관한 controller 클래스를 정의한다.
- * @author 이준호
- * @since 2021.08.09
- * @version 1.0
- * @see
*
- *
+ * @author 이준호
+ * @version 1.0
+ * @see
* << 개정이력(Modification Information) >>
*
* 수정일 수정자 수정내용
@@ -49,6 +48,7 @@ import kcc.kccadr.xxx.service.XxxVO;
* 2021.08.09 이준호 최초 생성
*
*
+ * @since 2021.08.09
*/
@Controller
public class XxxWebController {
@@ -66,36 +66,45 @@ public class XxxWebController {
// eGov 공통코드
@Resource(name = "EgovCmmUseService")
private EgovCmmUseService cmmUseService;
-
+
// global 프로퍼티
- @Resource(name="globalSettings")
+ @Resource(name = "globalSettings")
protected Properties propertiesService;
-
+
//첨부파일 경로, realPath 설정
- @Resource(name="EgovFileMngUtil")
+ @Resource(name = "EgovFileMngUtil")
private EgovFileMngUtil fileUtil;
-
+
// 첨부파일 정보
- @Resource(name="EgovFileMngService")
- private EgovFileMngService fileMngService;
-
+ @Resource(name = "EgovFileMngService")
+ private EgovFileMngService fileMngService;
+
+ // 첨부파일 정보
+ @Resource(name = "certPhoneRequestUtill")
+ private CertPhoneRequestUtill certPhoneRequestUtill;
+
+ //로그인 체크 util
+ @Resource(name = "checkLoginUtil")
+ private CheckLoginUtil checkLoginUtil;
+
+
/**
* XXX 목록 화면
*/
@RequestMapping("/web/kccadr/xxx/xxxList.do")
- public String xxxList(@ModelAttribute("searchVO") XxxVO xxxVO, ModelMap model) throws Exception {
+ public String xxxList( @ModelAttribute("searchVO") XxxVO xxxVO, ModelMap model ) throws Exception {
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); //로그인 정보
model.addAttribute("user", user);
-
+
List xxxList = xxxService.selectXxxList(xxxVO); // 목록 조회
-
+
// 페이징 처리 객체
PaginationInfo paginationInfo = CmmUtil.getPageing(xxxVO, xxxVO.getPageUnit());
paginationInfo.setTotalRecordCount(xxxList.size() > 0 ? xxxList.get(0).getTotCnt() : 0);
-
+
//최초조회시 최신것 조회List
- if("".equals(xxxVO.getSearchSortCnd())){
+ if("".equals(xxxVO.getSearchSortCnd())) {
xxxVO.setSearchSortCnd("xxxId");
xxxVO.setSearchSortOrd("desc");
}
@@ -113,7 +122,7 @@ public class XxxWebController {
* XXX 등록화면
*/
@RequestMapping("/web/kccadr/xxx/xxxRegist.do")
- public String xxxRegist(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model) throws Exception {
+ public String xxxRegist( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model ) throws Exception {
return "/web/kccadr/xxx/xxxRegist";
}
@@ -122,42 +131,42 @@ public class XxxWebController {
* XXX 등록 처리
*/
@RequestMapping("/web/kccadr/xxx/insertXxx.do")
- public String insertXxx(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes) throws Exception {
+ public String insertXxx( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes ) throws Exception {
xxxService.insertXxx(xxxVO); // 등록
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.insert")); // 공통메세지
return "redirect:/web/kccadr/xxx/xxxList.do";
}
-
+
/**
- * XXX 등록 Ajax
- */
- @RequestMapping(value = {"/web/kccadr/xxx/insertXxxAjax.do"})
- public ModelAndView insertXxxAjax(final MultipartHttpServletRequest multiRequest
+ * XXX 등록 Ajax
+ */
+ @RequestMapping(value = { "/web/kccadr/xxx/insertXxxAjax.do" })
+ public ModelAndView insertXxxAjax( final MultipartHttpServletRequest multiRequest
, XxxVO xxxVO
, RedirectAttributes redirectAttributes
- , HttpServletRequest request) throws Exception {
-
+ , HttpServletRequest request ) throws Exception {
+
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
-
+
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
-
+
String atchFileId = "";
final Map files = multiRequest.getFileMap();
- if (!files.isEmpty()) {
+ if(!files.isEmpty()) {
//XXX_로 첨부파일 네이밍
List result = fileUtil.parseFileInf(files, "XXX_", 0, "", "", "");
atchFileId = fileMngService.insertFileInfs(result);
//첨부파일Id(atchFileId)를 해당 VO atchFileId변수에 저장
xxxVO.setAtchFileId(atchFileId);
}
-
+
xxxVO.setFrstRegisterId(user.getId());
//게시글 등록 서비스
xxxService.insertXxx(xxxVO);
-
+
modelAndView.addObject("result", "success");
return modelAndView;
}
@@ -166,7 +175,7 @@ public class XxxWebController {
* XXX 상세화면
*/
@RequestMapping("/web/kccadr/xxx/xxxDetail.do")
- public String xxxDetail(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model) throws Exception {
+ public String xxxDetail( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model ) throws Exception {
XxxVO result = xxxService.selectXxxDetail(xxxVO); // 상세 조회
model.addAttribute("result", result);
@@ -178,7 +187,7 @@ public class XxxWebController {
* XXX 수정화면
*/
@RequestMapping("/web/kccadr/xxx/xxxModify.do")
- public String xxxModify(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model) throws Exception {
+ public String xxxModify( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model ) throws Exception {
XxxVO result = xxxService.selectXxxDetail(xxxVO); // 상세 조회
model.addAttribute("result", result);
@@ -190,34 +199,34 @@ public class XxxWebController {
* XXX 수정 처리
*/
@RequestMapping("/web/kccadr/xxx/updateXxx.do")
- public String updateXxx(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes) throws Exception {
-
+ public String updateXxx( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes ) throws Exception {
+
xxxService.updateXxx(xxxVO); // 수정
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.update")); // 공통메세지
return "redirect:/web/kccadr/xxx/xxxDetail.do";
}
-
+
/**
- * xxx 수정 Ajax
- */
- @RequestMapping(value = {"/web/kccadr/xxx/updateXxxAjax.do"})
- public ModelAndView updateXxxAjax(final MultipartHttpServletRequest multiRequest
+ * xxx 수정 Ajax
+ */
+ @RequestMapping(value = { "/web/kccadr/xxx/updateXxxAjax.do" })
+ public ModelAndView updateXxxAjax( final MultipartHttpServletRequest multiRequest
, XxxVO xxxVO
, RedirectAttributes redirectAttributes
- , HttpServletRequest request) throws Exception {
-
+ , HttpServletRequest request ) throws Exception {
+
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
-
+
String atchFileId = "";
final Map files = multiRequest.getFileMap();
-
- if (!files.isEmpty()) {
- if ("".equals(atchFileId)) {
+
+ if(!files.isEmpty()) {
+ if("".equals(atchFileId)) {
//XXX_로 첨부파일 네이밍
List result = fileUtil.parseFileInf(files, "XXX_", 0, atchFileId, "", "");
-
+
atchFileId = fileMngService.insertFileInfs(result);
//첨부파일Id(atchFileId)를 해당 VO atchFileId변수에 저장
xxxVO.setAtchFileId(atchFileId);
@@ -226,13 +235,13 @@ public class XxxWebController {
fvo.setAtchFileId(atchFileId);
int cnt = fileMngService.getMaxFileSN(fvo);
List result = fileUtil.parseFileInf(files, "XXX_", cnt, atchFileId, "", "");
-
+
fileMngService.updateFileInfs(result);
}
}
//게시글 수정 서비스
xxxService.updateXxx(xxxVO);
-
+
modelAndView.addObject("result", "success");
return modelAndView;
}
@@ -241,29 +250,29 @@ public class XxxWebController {
* XXX 삭제 처리
*/
@RequestMapping("/web/kccadr/xxx/deleteXxx.do")
- public String deleteXxx(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes) throws Exception {
+ public String deleteXxx( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap mode, RedirectAttributes redirectAttributes ) throws Exception {
xxxService.deleteXxx(xxxVO); // 삭제
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.delete")); // 공통메세지
-
+
return "redirect:/web/kccadr/xxx/xxxList.do";
}
-
+
/**
- * XXX 삭제 처리(delete가 아닌 useYn컬럼을 상태값으로 'N'처리할때)
+ * XXX 삭제 처리(delete가 아닌 useYn컬럼을 상태값으로 'N'처리할때)
*/
@RequestMapping("/web/kccadr/xxx/deleteXxx2.do")
- public String deleteXxx2(HttpServletRequest request, @ModelAttribute("searchVO") XxxVO xxxVO,
- ModelMap model, RedirectAttributes redirectAttributes)throws Exception {
+ public String deleteXxx2( HttpServletRequest request, @ModelAttribute("searchVO") XxxVO xxxVO,
+ ModelMap model, RedirectAttributes redirectAttributes ) throws Exception {
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
xxxVO.setLastUpdusrId(user.getUniqId());
- xxxVO.setLastUpdusrNm(user.getName()); // 변경이력에 사용
+ xxxVO.setLastUpdusrNm(user.getName()); // 변경이력에 사용
xxxService.deleteXxx2(xxxVO);
xxxVO.setPageIndex(1); //삭제후 첫페이지로 로딩
-
+
redirectAttributes.addAttribute("pageIndex", xxxVO.getPageIndex());
redirectAttributes.addAttribute("searchCnd", xxxVO.getSearchCnd());
redirectAttributes.addAttribute("searchWrd", xxxVO.getSearchWrd());
@@ -271,15 +280,13 @@ public class XxxWebController {
redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("success.common.useN"));
return "redirect:/web/kccadr/xxx/xxxList.do";
}
-
-
-
+
/**
* XXX 팝업화면
*/
@RequestMapping("/web/kccadr/xxx/xxxDetailPop.do")
- public String xxxDetailPop(@ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model) throws Exception {
+ public String xxxDetailPop( @ModelAttribute("xxxVO") XxxVO xxxVO, ModelMap model ) throws Exception {
XxxVO result = xxxService.selectXxxDetail(xxxVO); // 상세 조회
model.addAttribute("result", result);
@@ -291,19 +298,19 @@ public class XxxWebController {
* XXX YYYY(처리) Ajax 처리
*/
@RequestMapping("/web/kccadr/xxx/xxxYyyyAjax.do")
- public ModelAndView xxxYyyyAjax(@ModelAttribute("xxxVO") XxxVO xxxVO, BindingResult bindingResult) throws Exception {
-
+ public ModelAndView xxxYyyyAjax( @ModelAttribute("xxxVO") XxxVO xxxVO, BindingResult bindingResult ) throws Exception {
+
String result = "success";
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
-
+
// YYYY 처리 로직
-
+
// YYYY 처리 상태 체크
- if (1 == 0) {
+ if(1 == 0) {
result = "fail";
}
-
+
modelAndView.addObject("result", result);
return modelAndView;
}
diff --git a/src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java b/src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
index cd02e070..b66af410 100644
--- a/src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
+++ b/src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
@@ -1,30 +1,31 @@
package kcc.let.cop.bbs.web;
-import java.io.OutputStream;
-import java.security.SecureRandom;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
+import NiceID.Check.CPClient;
+import com.penta.scpdb.ScpDbAgent;
+import egovframework.rte.fdl.property.EgovPropertyService;
+import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
+import egovframework.rte.psl.dataaccess.util.EgovMap;
+import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
+import kcc.com.cmm.*;
+import kcc.com.cmm.service.*;
+import kcc.com.cmm.util.StringUtil;
+import kcc.com.cmm.util.WebUtil;
+import kcc.com.uss.ion.cnf.service.ProhibitMngService;
+import kcc.com.uss.ion.cnf.service.WordFilterService;
+import kcc.com.uss.ion.cnf.service.WordFilterVO;
+import kcc.com.utl.fcc.service.EgovStringUtil;
import kcc.com.utl.user.service.CheckLoginUtil;
+import kcc.let.cop.bbs.service.*;
+import kcc.let.sym.mnu.mpm.service.EgovMenuManageService;
+import kcc.let.sym.mnu.mpm.service.MenuManageVO;
+import kcc.let.sym.site.service.EgovSiteManagerService;
+import kcc.let.sym.site.service.SiteManagerVO;
+import kcc.let.uat.uia.service.SsoLoginVO;
+import kcc.let.utl.fcc.service.ITNotiUtil;
+import kcc.let.utl.sim.service.EgovClntInfo;
+import kcc.ve.cmm.VeConstants;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@@ -47,47 +48,15 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springmodules.validation.commons.DefaultBeanValidator;
-import com.penta.scpdb.ScpDbAgent;
-import com.sci.v2.pcc.secu.SciSecuManager;
-import com.sci.v2.pcc.secu.hmac.SciHmac;
-
-import NiceID.Check.CPClient;
-import egovframework.rte.fdl.property.EgovPropertyService;
-import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
-import egovframework.rte.psl.dataaccess.util.EgovMap;
-import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
-import kcc.com.cmm.ComDefaultCodeVO;
-import kcc.com.cmm.EgovMessageSource;
-import kcc.com.cmm.EgovMultiPartEmail;
-import kcc.com.cmm.LoginVO;
-import kcc.com.cmm.ReadVO;
-import kcc.com.cmm.UserVO;
-import kcc.com.cmm.service.EgovCmmUseService;
-import kcc.com.cmm.service.EgovFileMngService;
-import kcc.com.cmm.service.EgovFileMngUtil;
-import kcc.com.cmm.service.FileVO;
-import kcc.com.cmm.service.ReadService;
-import kcc.com.cmm.util.StringUtil;
-import kcc.com.cmm.util.WebUtil;
-import kcc.com.uss.ion.cnf.service.ProhibitMngService;
-import kcc.com.uss.ion.cnf.service.WordFilterService;
-import kcc.com.uss.ion.cnf.service.WordFilterVO;
-import kcc.com.utl.fcc.service.EgovStringUtil;
-import kcc.let.cop.bbs.service.Board;
-import kcc.let.cop.bbs.service.BoardChgHst;
-import kcc.let.cop.bbs.service.BoardMaster;
-import kcc.let.cop.bbs.service.BoardMasterVO;
-import kcc.let.cop.bbs.service.BoardVO;
-import kcc.let.cop.bbs.service.EgovBBSAttributeManageService;
-import kcc.let.cop.bbs.service.EgovBBSManageService;
-import kcc.let.sym.mnu.mpm.service.EgovMenuManageService;
-import kcc.let.sym.mnu.mpm.service.MenuManageVO;
-import kcc.let.sym.site.service.EgovSiteManagerService;
-import kcc.let.sym.site.service.SiteManagerVO;
-import kcc.let.uat.uia.service.SsoLoginVO;
-import kcc.let.utl.fcc.service.ITNotiUtil;
-import kcc.let.utl.sim.service.EgovClntInfo;
-import kcc.ve.cmm.VeConstants;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.OutputStream;
+import java.security.SecureRandom;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.Map.Entry;
/**
* 게시물 관리를 위한 컨트롤러 클래스
@@ -2341,21 +2310,21 @@ public class EgovBBSManageController {
request.getSession().setAttribute("reqNum", reqNum); // 결과값 복호화시 필요
- //01. 암호화 모듈 선언
- SciSecuManager seed = new SciSecuManager();
-
- //02. 1차 암호화
- String encStr = "";
- String reqInfo = SELFAUTH_SITE_ID+"^"+SELFAUTH_SRV_NO+"^"+reqNum+"^"+certDate+"^"+certGb+"^"+addVar+"^"+exVar; // 데이터 암호화
- encStr = seed.getEncPublic(reqInfo);
-
- //03. 위변조 검증 값 생성
- String hmacMsg = SciHmac.HMacEncriptPublic(encStr);
-
- //03. 2차 암호화
- reqInfo = seed.getEncPublic(encStr + "^" + hmacMsg + "^" + "0000000000000000"); //2차암호화
-
- request.getSession().setAttribute("reqInfo", reqInfo); // 본인확인 요청 정보
+// //01. 암호화 모듈 선언
+// SciSecuManager seed = new SciSecuManager();
+//
+// //02. 1차 암호화
+// String encStr = "";
+// String reqInfo = SELFAUTH_SITE_ID+"^"+SELFAUTH_SRV_NO+"^"+reqNum+"^"+certDate+"^"+certGb+"^"+addVar+"^"+exVar; // 데이터 암호화
+// encStr = seed.getEncPublic(reqInfo);
+//
+// //03. 위변조 검증 값 생성
+// String hmacMsg = SciHmac.HMacEncriptPublic(encStr);
+//
+// //03. 2차 암호화
+// reqInfo = seed.getEncPublic(encStr + "^" + hmacMsg + "^" + "0000000000000000"); //2차암호화
+//
+// request.getSession().setAttribute("reqInfo", reqInfo); // 본인확인 요청 정보
request.getSession().setAttribute("SITE_URL", SITE_URL); // 사이트 URL
return "web/cop/selfauth/selfauth";
@@ -2371,41 +2340,41 @@ public class EgovBBSManageController {
@RequestMapping("/web/cop/selfauth/resultSeed.do")
public String resultSeed(HttpServletRequest request, ModelMap model, RedirectAttributes redirectAttributes)throws Exception {
- String retInfo = request.getParameter("retInfo").trim();
- String cookiereqNum = (String)request.getSession().getAttribute("reqNum");
-
- //복화화용 변수
- String encPara = "";
- String encMsg = "";
- String msgChk = "N";
-
- // 1. 암호화 모듈 (jar) Loading
- SciSecuManager sciSecuMg = new SciSecuManager();
- //쿠키에서 생성한 값을 Key로 생성 한다.
- retInfo = sciSecuMg.getDec(retInfo, cookiereqNum);
-
- // 2.1차 파싱---------------------------------------------------------------
- String[] aRetInfo1 = retInfo.split("\\^");
-
- encPara = aRetInfo1[0]; //암호화된 통합 파라미터
- encMsg = aRetInfo1[1]; //암호화된 통합 파라미터의 Hash값
-
- String encMsg2 = sciSecuMg.getMsg(encPara);
- // 3.위/변조 검증 ---------------------------------------------------------------
- if(encMsg2.equals(encMsg)) msgChk="Y";
-
- if(msgChk.equals("N")) {
- // 비정상 접근 처리
- }
-
- retInfo = sciSecuMg.getDec(encPara, cookiereqNum);
-
- String[] aRetInfo = retInfo.split("\\^");
- String name = aRetInfo[0]; //성명
+// String retInfo = request.getParameter("retInfo").trim();
+// String cookiereqNum = (String)request.getSession().getAttribute("reqNum");
+//
+// //복화화용 변수
+// String encPara = "";
+// String encMsg = "";
+// String msgChk = "N";
+//
+// // 1. 암호화 모듈 (jar) Loading
+// SciSecuManager sciSecuMg = new SciSecuManager();
+// //쿠키에서 생성한 값을 Key로 생성 한다.
+// retInfo = sciSecuMg.getDec(retInfo, cookiereqNum);
+//
+// // 2.1차 파싱---------------------------------------------------------------
+// String[] aRetInfo1 = retInfo.split("\\^");
+//
+// encPara = aRetInfo1[0]; //암호화된 통합 파라미터
+// encMsg = aRetInfo1[1]; //암호화된 통합 파라미터의 Hash값
+//
+// String encMsg2 = sciSecuMg.getMsg(encPara);
+// // 3.위/변조 검증 ---------------------------------------------------------------
+// if(encMsg2.equals(encMsg)) msgChk="Y";
+//
+// if(msgChk.equals("N")) {
+// // 비정상 접근 처리
+// }
+//
+// retInfo = sciSecuMg.getDec(encPara, cookiereqNum);
+//
+// String[] aRetInfo = retInfo.split("\\^");
+// String name = aRetInfo[0]; //성명
// String birYMD = aRetInfo[1]; //생년월일
// String sex = aRetInfo[2]; //성별
// String fgnGbn = aRetInfo[3]; //내외국인 구분값
- String di = aRetInfo[4]; //DI
+// String di = aRetInfo[4]; //DI
// String ci1 = aRetInfo[5]; //CI
// String ci2 = aRetInfo[6]; //CI
// String civersion = aRetInfo[7]; //CI Version
@@ -2419,8 +2388,8 @@ public class EgovBBSManageController {
// 사용자 세션생성
UserVO userVO = new UserVO();
- userVO.setName(name);
- userVO.setMblDn(di);
+// userVO.setName(name);
+// userVO.setMblDn(di);
request.getSession().setAttribute("userVO", userVO);
String url = (String)request.getSession().getAttribute("url");
diff --git a/src/main/java/kcc/let/uat/uia/service/impl/EgovLoginServiceImpl.java b/src/main/java/kcc/let/uat/uia/service/impl/EgovLoginServiceImpl.java
index e3c32c27..eae078f1 100644
--- a/src/main/java/kcc/let/uat/uia/service/impl/EgovLoginServiceImpl.java
+++ b/src/main/java/kcc/let/uat/uia/service/impl/EgovLoginServiceImpl.java
@@ -66,9 +66,6 @@ public class EgovLoginServiceImpl extends EgovAbstractServiceImpl implements
LoginVO loginVO = null;
String s_password = vo.getPassword();
String s_ci = vo.getMberCi();
- System.out.println("======1========================"+s_password);
- System.out.println("======1========================"+EgovNewPasswordUtil.hashPassword(s_password));
- System.out.println("======1========================"+EgovFileScrty.encryptPassword(s_password, vo.getId()));
//step1.new 로그인인 경우 loginvo ret
//최고관리자를 제외한 사용자 sso 로그인으로 비밀번호 암호화 삭제(210818, 이준호)
diff --git a/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java b/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java
index 634cf6a7..0e103638 100644
--- a/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java
+++ b/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java
@@ -5,18 +5,19 @@ import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.security.SecureRandom;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
import javax.script.ScriptEngineManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import kcc.ve.cmm.crt.CertPhoneResultUtill;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
@@ -25,6 +26,8 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -189,6 +192,9 @@ public class EgovLoginController {
/** 구동 환경 */
@Value("#{property['Globals.prod.islocal']}")
private String environment;
+
+ @Resource(name = "certPhoneResultUtill")
+ private CertPhoneResultUtill certPhoneResultUtill;
/*
*//**
@@ -725,28 +731,55 @@ public class EgovLoginController {
//일반 로그인이 아니므로 1로 세팅
loginVO.setPassword("1");
-
- // 로그인 정보 check
-// if (loginVO.getId() == null || loginVO.getPassword() == null) {
-// SsoLoginVO SsoLoginSessionChk = (SsoLoginVO) session.getAttribute("SSOLoginVO");
-// // SSOLoginVO 세션 체크
-// if (SsoLoginSessionChk != null) {
-//
-// loginVO.setId(SsoLoginSessionChk.getMembId());
-// loginVO.setPassword("1");
-// } else {
-// model.addAttribute("message", "로그인을 다시 해주세요.");
-// // 로그인 페이지로 이동
-// /*return "/web/kccadr/login/SsoLoginUsr";*/
-// return "redirect:/web/user/login/ssoLogin.do";
-// }
-// }
- if(StringUtil.isEmpty(loginVO.getMberCi())) {
+
+ String retInfo = request.getParameter("retInfo");
+
+ if(StringUtil.isEmpty(retInfo)) {
model.addAttribute("message", "로그인을 다시 해주세요.");
+ redirectAttributes.addAttribute("message", "로그인을 다시 해주세요.");
// 로그인 페이지로 이동
return "redirect:/web/user/login/ssoLogin.do";
}
+ // AES 복호화 설정 (AES/CBC/PKCS5Padding)
+ String reqkey = request.getSession().getAttribute("reqkey").toString();
+ String reqiv = request.getSession().getAttribute("reqiv").toString();
+
+ SecretKeySpec secureKey = new SecretKeySpec(reqkey.getBytes("UTF-8"), "AES");
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.DECRYPT_MODE, secureKey, new IvParameterSpec(reqiv.getBytes("UTF-8")));
+
+ // Base64 디코딩 후 복호화 수행
+ byte[] cipherEnc = Base64.getDecoder().decode(retInfo);
+
+ String resData = new String(cipher.doFinal(cipherEnc), "UTF-8");
+
+ // 복호화된 결과를 다시 JSON으로 파싱
+ JSONParser parser2 = new JSONParser();
+ JSONObject jsonData = (JSONObject) parser2.parse(resData);
+ if(jsonData != null) {
+ System.out.println("===== 복호화된 결과 =====");
+
+ for(Object keyObj : jsonData.keySet()) {
+ String key2 = (String) keyObj;
+ Object value = jsonData.get(key2);
+ System.out.println(key2 + " = " + value);
+ }
+
+ } else {
+ System.out.println("복호화 실패: jsonData가 null 입니다.");
+ model.addAttribute("message", "로그인을 다시 해주세요.");
+ redirectAttributes.addAttribute("message", "로그인을 다시 해주세요.");
+ // 로그인 페이지로 이동
+ return "redirect:/web/user/login/ssoLogin.do";
+ }
+
+ loginVO.setMembName(jsonData.get("userName").toString());
+ loginVO.setMembCelnum(jsonData.get("celNo").toString());
+ loginVO.setSexCode(jsonData.get("gender").toString());
+ loginVO.setMembBirth(jsonData.get("birYMD").toString());
+ loginVO.setMberCi(jsonData.get("ci").toString());
+
// 기존에 있던 회원이 아니면 DB에 일련번호 저장
UserManageVO userManageVO = new UserManageVO();
userManageVO.setMberCi(loginVO.getMberCi());
diff --git a/src/main/java/kcc/ve/cmm/crt/CertPhoneRequestUtill.java b/src/main/java/kcc/ve/cmm/crt/CertPhoneRequestUtill.java
new file mode 100644
index 00000000..e6d6b269
--- /dev/null
+++ b/src/main/java/kcc/ve/cmm/crt/CertPhoneRequestUtill.java
@@ -0,0 +1,102 @@
+package kcc.ve.cmm.crt;
+
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.springframework.stereotype.Service;
+
+import javax.crypto.Cipher;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.MessageDigest;
+import java.util.Base64;
+
+@Service(value = "certPhoneRequestUtill")
+public class CertPhoneRequestUtill {
+
+ public String getEncReqData( String key, String iv, String reqData ) throws Exception {
+ String reqInfo = "";
+ try {
+ SecretKey secureKey = new SecretKeySpec(key.getBytes(), "AES");
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.ENCRYPT_MODE, secureKey, new IvParameterSpec(iv.getBytes()));
+ byte[] encrypted;
+ encrypted = cipher.doFinal(reqData.trim().getBytes());
+ reqInfo = Base64.getEncoder().encodeToString(encrypted);
+ } catch(Exception e) {
+ System.out.println(String.format("(APICERT)(ERR) getEncReqData Exception : %s", e.getMessage()));
+ e.printStackTrace();
+ throw e;
+ }
+ return reqInfo;
+ }
+
+ public String createSymmetricKey( String req_dtim, String req_no, String token_val ) throws Exception {
+ String symmetricKey = "";
+ String value = req_dtim.trim() + req_no.trim() + token_val.trim();
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance("SHA-256");
+ md.update(value.getBytes());
+ byte[] arrHashValue = md.digest();
+ symmetricKey = Base64.getEncoder().encodeToString(arrHashValue);
+ } catch(Exception e) {
+ System.out.println(String.format("(APICERT)(ERR) createSymmetricKey Exception : %s", e.getMessage()));
+ e.printStackTrace();
+ throw e;
+ }
+ return symmetricKey;
+ }
+
+ public byte[] hmac256( byte[] secretKey, byte[] message ) throws Exception {
+ byte[] hmac256 = null;
+ try {
+ Mac mac = Mac.getInstance("HmacSHA256");
+ SecretKeySpec sks = new SecretKeySpec(secretKey, "HmacSHA256");
+ mac.init(sks);
+ hmac256 = mac.doFinal(message);
+ return hmac256;
+ } catch(Exception e) {
+ System.out.println(String.format("(APICERT)(ERR) hmac256 Exception : %s", e.getMessage()));
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ public String getReqData( String id, String srvNo, String reqNum, String retUrl, String certDate, String certGb ) {
+
+ JSONObject msgMap = new JSONObject();
+ msgMap.put("id", id);
+ msgMap.put("srvNo", srvNo);
+ msgMap.put("reqNum", reqNum);
+ msgMap.put("retUrl", retUrl);
+ msgMap.put("certDate", certDate);
+ msgMap.put("certGb", certGb);
+ String reqData = msgMap.toJSONString();
+ return reqData;
+
+ }
+
+ //복호화
+ public JSONObject getResData( String req_info, String key, String iv ) throws Exception {
+ SecretKey secureKey = new SecretKeySpec(key.getBytes(), "AES");
+ Cipher c;
+ String resData = "";
+ try {
+ c = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ c.init(Cipher.DECRYPT_MODE, secureKey, new IvParameterSpec(iv.getBytes()));
+ /*byte[] cipherEnc = Base64.getDecoder().decode(encData);*/
+ byte[] cipherEnc = Base64.getDecoder().decode(req_info);
+ resData = new String(c.doFinal(cipherEnc), "utf-8");
+ } catch(Exception e) {
+ System.out.println(String.format("(APICERT)(ERR) getResData Exception : %s", e.getMessage()));
+ e.printStackTrace();
+ return null;
+ }
+ JSONParser parser = new JSONParser();
+ JSONObject jsonResData = (JSONObject) parser.parse(resData);
+ return jsonResData;
+ }
+
+}
diff --git a/src/main/java/kcc/ve/cmm/crt/CertPhoneResultUtill.java b/src/main/java/kcc/ve/cmm/crt/CertPhoneResultUtill.java
new file mode 100644
index 00000000..05f55586
--- /dev/null
+++ b/src/main/java/kcc/ve/cmm/crt/CertPhoneResultUtill.java
@@ -0,0 +1,355 @@
+package kcc.ve.cmm.crt;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.springframework.http.*;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import javax.crypto.Cipher;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.servlet.http.HttpServletRequest;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.security.SecureRandom;
+import java.text.SimpleDateFormat;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service(value = "certPhoneResultUtill")
+public class CertPhoneResultUtill {
+ public String createCryptoTokenUrl = "https://sciapi.siren24.com:52099/authentication/api/v1.0/common/crypto/token";
+ public String access_token = "994b5d96-3788-4239-a5b0-a0ba2e0cf089 ";
+ public String client_id = "5a2a72e2-16ce-420c-8816-57b3dda0e231";
+
+ public CertPhoneResultUtill() throws Exception {
+ }
+
+
+ public String certResult( HttpServletRequest request ) throws Exception {
+ String reqcryptotokenid = request.getParameter("crypto_token_id");
+ String integrity_value = request.getParameter("integrity_value");
+ System.out.println("crypto_token_id -> " + reqcryptotokenid);
+ System.out.println("integrity_value -> " + integrity_value);
+
+ String id = "SKIP001";
+ String url = "https://pcc.siren24.com/servlet/StoS";
+
+// String reqInfo = certPhoneResultUtill.getReqData(id, crypto_token_id);
+//
+// String key = request.getSession().getAttribute("certPhoneKey").toString();
+// String iv = request.getSession().getAttribute("certPhoneIv").toString();
+// reqInfo = certPhoneResultUtill.getEncReqData(key, iv, reqInfo);
+
+ //암호화키 얻기
+ Date currentDate = new Date();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ String reqDate = sdf.format(currentDate);
+ String reqNo = "koipa_edu";
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
+
+ String cryptoToken = callCreateCryptoTokenAPI(currentDate, reqNo);
+
+ JSONParser parser = new JSONParser();
+ JSONObject cryptoTokenJson = (JSONObject) parser.parse(cryptoToken);
+ JSONObject dataBody = (JSONObject) cryptoTokenJson.get("dataBody");
+
+ String crypto_token_id = (String) dataBody.get("crypto_token_id");
+ String token_val = (String) dataBody.get("crypto_token");
+ String reqInfo = getReqData(id, reqcryptotokenid);
+
+
+ String day = formatter.format(currentDate);
+
+ String symmetricKey = createSymmetricKey(day, reqNo, token_val);
+ String key = symmetricKey.substring(0, 16); // 데이터 암호화할 대칭키
+ String iv = symmetricKey.substring(symmetricKey.length() - 16, symmetricKey.length());// 데이터 암호화할 lnitail Vector
+
+ reqInfo = getEncReqData(key, iv, reqInfo);
+
+ //복호화
+ try {
+ RestTemplate restTemplate = new RestTemplate();
+
+ // 1. Header 설정
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+
+ // 2. Body 생성
+ Map dataHeader = new HashMap<>();
+ dataHeader.put("CNTY_CD", "kr");
+ dataHeader.put("TRAN_ID", id);
+
+ Map dataBody2 = new HashMap<>();
+ dataBody2.put("crypto_token_id", crypto_token_id);
+ dataBody2.put("reqInfo", reqInfo);
+ dataBody2.put("integrity_value", integrity_value);
+
+ Map requestJson = new HashMap<>();
+ requestJson.put("dataHeader", dataHeader);
+ requestJson.put("dataBody", dataBody2);
+
+ HttpEntity