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 0cdea4f2..9ff8f4b6 100644 --- a/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java +++ b/src/main/java/kcc/let/uat/uia/web/EgovLoginController.java @@ -1,2448 +1,2450 @@ -package kcc.let.uat.uia.web; - -import java.io.IOException; -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 javax.annotation.Resource; -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 org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -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.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationContext; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; -import org.springframework.security.web.savedrequest.HttpSessionRequestCache; -import org.springframework.security.web.savedrequest.SavedRequest; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.context.support.WebApplicationContextUtils; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; - -import com.bandi.oauth.BandiSSOAgent; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import egovframework.rte.fdl.cmmn.trace.LeaveaTrace; -import egovframework.rte.fdl.property.EgovPropertyService; -import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; -import egovframework.rte.psl.dataaccess.util.EgovMap; -import kcc.com.cmm.EgovMessageSource; -import kcc.com.cmm.LoginVO; -import kcc.com.cmm.captcha.CaptchaUtil; -import kcc.com.cmm.spring.data.util.ProfileUtil; -import kcc.com.cmm.util.WebUtil; -import kcc.com.utl.user.service.CheckLoginUtil; -import kcc.kccadr.cmm.service.SMSOracleService; -import kcc.let.sym.log.clg.service.EgovLoginLogService; -import kcc.let.sym.log.clg.service.LoginLog; -import kcc.let.sym.mnu.mpm.service.MenuManageJTreeVO; -import kcc.let.sym.site.service.EgovSiteManagerService; -import kcc.let.sym.site.service.SiteManagerVO; -import kcc.let.uat.uap.service.EgovLoginPolicyService; -import kcc.let.uat.uap.service.LoginPolicyVO; -import kcc.let.uat.uia.service.EgovLoginService; -import kcc.let.uat.uia.service.SsoLoginVO; -import kcc.let.uss.umt.service.EgovMberManageService; -import kcc.let.uss.umt.service.EgovUserManageService; -import kcc.let.uss.umt.service.MberManageConfigVO; -import kcc.let.uss.umt.service.UserDefaultVO; -import kcc.let.uss.umt.service.UserGuestVO; -import kcc.let.uss.umt.service.UserManageVO; -import kcc.let.utl.fcc.service.EgovCryptoUtil; -import kcc.let.utl.sim.service.EgovClntInfo; -import kcc.ve.instr.tngrVisitEdu.instrInfo.service.VEInstrDetailVO; -import kcc.ve.instr.tngrVisitEdu.instrInfo.service.VEInstrService; - -/** - * 일반 로그인, 인증서 로그인을 처리하는 컨트롤러 클래스 - * - * @author 공통서비스 개발팀 박지욱 - * @since 2009.03.06 - * @version 1.0 - * @see - * - *
- * << 개정이력(Modification Information) >> - * - * 수정일 수정자 수정내용 - * ------- -------- --------------------------- - * 2009.03.06 박지욱 최초 생성 - * 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성 - * - *- */ -@Controller -public class EgovLoginController { - -// static String RSA_WEB_KEY = "_RSA_WEB_Key_"; // 개인키 session key -// static String RSA_INSTANCE = "RSA"; // rsa transformation - private static final Logger LOGGER = LoggerFactory.getLogger(EgovLoginController.class); - - /** 네이버 인증 관련 */ - @Value("#{globalSettings['Globals.kcc.naver.clentId']}") - private String itnNaverClientId; - @Value("#{globalSettings['Globals.kcc.naver.clientSecret']}") - private String itnNaverClientSecret; - @Value("#{globalSettings['Globals.kcc.naver.returnUrl']}") - private String itnNaverReturnUrl; - - /** 카카오 인증 관련 */ - @Value("#{globalSettings['Globals.kcc.kakao.restApiKey']}") - private String itnKakaoRestApiKey; - @Value("#{globalSettings['Globals.kcc.kakao.returnUrl']}") - private String itnKakaoReturnUrl; - - /** SSO return URL */ - @Value("#{globalSettings['Globals.sso.returnSiteUrl']}") - private String returnSiteUrlGlobal; - @Value("#{globalSettings['Globals.sso.returnSiteCode']}") - private String returnSiteCodeGlobal; - - /** SSO 회원관련 URL */ - @Value("#{globalSettings['Globals.sso.joinUrl']}") - private String joinUrl_Global; - @Value("#{globalSettings['Globals.sso.modifyUrl']}") - private String modifyUrl_Global; - @Value("#{globalSettings['Globals.sso.idFindUrl']}") - private String idFindUrl_Global; - @Value("#{globalSettings['Globals.sso.pwFindUrl']}") - private String pwFindUrl_Global; - - //로그인 체크 util - @Resource(name = "checkLoginUtil") - private CheckLoginUtil checkLoginUtil; - - /** EgovLoginService */ - @Resource(name = "loginService") - private EgovLoginService loginService; - - /** EgovMessageSource */ - @Resource(name = "egovMessageSource") - EgovMessageSource egovMessageSource; - - /** EgovLoginPolicyService */ - @Resource(name = "egovLoginPolicyService") - EgovLoginPolicyService egovLoginPolicyService; - - /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; - - /** TRACE */ - @Resource(name = "leaveaTrace") - LeaveaTrace leaveaTrace; - - @Resource(name = "EgovLoginLogService") - private EgovLoginLogService loginLogService; - - @Resource(name = "egovSiteManagerService") - private EgovSiteManagerService egovSiteManagerService; - - /** userManageService */ - @Resource(name = "userManageService") - private EgovUserManageService userManageService; - - /** mberManageService */ - @Resource(name = "mberManageService") - private EgovMberManageService mberManageService; - - @Resource(name = "SMSOracleService") - private SMSOracleService sMSOracleService; - - //강사 정보 - @Resource(name="vEInstrService") - private VEInstrService vEInstrService; - - //암복호화 유틸 - @Resource(name = "egovCryptoUtil") - EgovCryptoUtil egovCryptoUtil; - - /** 구동 환경 */ - @Value("#{property['Globals.prod.islocal']}") - private String environment; - - - /* - *//** - * (관리자)로그인 화면으로 들어간다 - * - * @param vo - 로그인후 이동할 URL이 담긴 LoginVO - * @return 로그인 페이지 - * @exception Exception - *//* - * @RequestMapping(value = "/uat/uia/egovLoginUsr.do") public String - * loginUsrView(@ModelAttribute("loginVO") LoginVO loginVO, HttpServletRequest - * request, HttpServletResponse response, ModelMap model) throws Exception { - * return "uat/uia/EgovLoginUsr"; } - */ - - /** - * (관리자) 로그인 화면. - * - * @return String - * @exception Exception - */ - @RequestMapping(value = "/uat/uia/EgovLoginUsr.do") - public String adminLogin(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { - Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); - - System.out.println("==start="); - - if (isAuthenticated) - return "redirect:/cmm/main/mainPage.do"; -// initRsa(request); - - System.out.println("==end="); - - // 로그인 페이지 IP 체크 - List
+ * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.06 박지욱 최초 생성 + * 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성 + * + *+ */ +@Controller +public class EgovLoginController { + +// static String RSA_WEB_KEY = "_RSA_WEB_Key_"; // 개인키 session key +// static String RSA_INSTANCE = "RSA"; // rsa transformation + private static final Logger LOGGER = LoggerFactory.getLogger(EgovLoginController.class); + + /** 네이버 인증 관련 */ + @Value("#{globalSettings['Globals.kcc.naver.clentId']}") + private String itnNaverClientId; + @Value("#{globalSettings['Globals.kcc.naver.clientSecret']}") + private String itnNaverClientSecret; + @Value("#{globalSettings['Globals.kcc.naver.returnUrl']}") + private String itnNaverReturnUrl; + + /** 카카오 인증 관련 */ + @Value("#{globalSettings['Globals.kcc.kakao.restApiKey']}") + private String itnKakaoRestApiKey; + @Value("#{globalSettings['Globals.kcc.kakao.returnUrl']}") + private String itnKakaoReturnUrl; + + /** SSO return URL */ + @Value("#{globalSettings['Globals.sso.returnSiteUrl']}") + private String returnSiteUrlGlobal; + @Value("#{globalSettings['Globals.sso.returnSiteCode']}") + private String returnSiteCodeGlobal; + + /** SSO 회원관련 URL */ + @Value("#{globalSettings['Globals.sso.joinUrl']}") + private String joinUrl_Global; + @Value("#{globalSettings['Globals.sso.modifyUrl']}") + private String modifyUrl_Global; + @Value("#{globalSettings['Globals.sso.idFindUrl']}") + private String idFindUrl_Global; + @Value("#{globalSettings['Globals.sso.pwFindUrl']}") + private String pwFindUrl_Global; + + //로그인 체크 util + @Resource(name = "checkLoginUtil") + private CheckLoginUtil checkLoginUtil; + + /** EgovLoginService */ + @Resource(name = "loginService") + private EgovLoginService loginService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovLoginPolicyService */ + @Resource(name = "egovLoginPolicyService") + EgovLoginPolicyService egovLoginPolicyService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** TRACE */ + @Resource(name = "leaveaTrace") + LeaveaTrace leaveaTrace; + + @Resource(name = "EgovLoginLogService") + private EgovLoginLogService loginLogService; + + @Resource(name = "egovSiteManagerService") + private EgovSiteManagerService egovSiteManagerService; + + /** userManageService */ + @Resource(name = "userManageService") + private EgovUserManageService userManageService; + + /** mberManageService */ + @Resource(name = "mberManageService") + private EgovMberManageService mberManageService; + + @Resource(name = "SMSOracleService") + private SMSOracleService sMSOracleService; + + //강사 정보 + @Resource(name="vEInstrService") + private VEInstrService vEInstrService; + + //암복호화 유틸 + @Resource(name = "egovCryptoUtil") + EgovCryptoUtil egovCryptoUtil; + + /** 구동 환경 */ + @Value("#{property['Globals.prod.islocal']}") + private String environment; + + + /* + *//** + * (관리자)로그인 화면으로 들어간다 + * + * @param vo - 로그인후 이동할 URL이 담긴 LoginVO + * @return 로그인 페이지 + * @exception Exception + *//* + * @RequestMapping(value = "/uat/uia/egovLoginUsr.do") public String + * loginUsrView(@ModelAttribute("loginVO") LoginVO loginVO, HttpServletRequest + * request, HttpServletResponse response, ModelMap model) throws Exception { + * return "uat/uia/EgovLoginUsr"; } + */ + + /** + * (관리자) 로그인 화면. + * + * @return String + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/EgovLoginUsr.do") + public String adminLogin(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + System.out.println("==start="); + + if (isAuthenticated) + return "redirect:/cmm/main/mainPage.do"; +// initRsa(request); + + System.out.println("==end="); + + // 로그인 페이지 IP 체크 + List
- * << 개정이력(Modification Information) >> - * - * 수정일 수정자 수정내용 - * ------- -------- --------------------------- - * 2021.07.16 조용준 최초 생성 * - * - *- */ -@Component("vEPagingUtil") -public class VEPagingUtil { - - private static final Logger LOGGER = LoggerFactory.getLogger(VEPagingUtil.class); - - - ////////////////////////////////////////////////// - // - // VEInstrAsgnmVO paging - // - - //페이징을 위한 처리 step1 - 페이징 기본 정보 설정 - public PaginationInfo setPagingStep1_VEInstrAsgnmVO( - PaginationInfo p_paginationInfo, - VEInstrAsgnmVO p_VEInstrAsgnmVO - ){ - - try { - LOGGER.debug("VEPagingUtil-setPagingStep1_VEInstrAsgnmVO()"); - - // pageing step1 - p_paginationInfo.setCurrentPageNo(p_VEInstrAsgnmVO.getPageIndex()); - p_paginationInfo.setRecordCountPerPage(p_VEInstrAsgnmVO.getPageUnit()); - p_paginationInfo.setPageSize(p_VEInstrAsgnmVO.getPageSize()); - - } catch(IllegalArgumentException e) { - LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); - } catch (Exception e) { - LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); - } - - return p_paginationInfo; - } - - //페이징을 위한 처리 step2 - 게시물 리스트 수량 설정 및 검색 조건 초기화 - public VEInstrAsgnmVO setPagingStep2_VEInstrAsgnmVO( - VEInstrAsgnmVO p_VEInstrAsgnmVO - , PaginationInfo p_paginationInfo - )throws Exception{ - - try { - LOGGER.debug("VEPagingUtil-setPagingStep2_VEInstrAsgnmVO()"); - - // pageing step2 - p_VEInstrAsgnmVO.setFirstIndex(p_paginationInfo.getFirstRecordIndex()); - p_VEInstrAsgnmVO.setLastIndex(p_paginationInfo.getLastRecordIndex()); - p_VEInstrAsgnmVO.setRecordCountPerPage(p_paginationInfo.getRecordCountPerPage()); - - if("".equals(p_VEInstrAsgnmVO.getSearchSortCnd())){ //최초조회시 최신것 조회List - p_VEInstrAsgnmVO.setSearchSortCnd("prcs_ord"); - p_VEInstrAsgnmVO.setSearchSortOrd("desc"); - } - - } catch(IllegalArgumentException e) { - LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); - } catch (Exception e) { - LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); - } - - return p_VEInstrAsgnmVO; - } - - - //페이징을 위한 처리 step3 - 전체 게시물 수량 설정하기 - public PaginationInfo setPagingStep3_VEInstrAsgnmVO( - List
+ * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2021.07.16 조용준 최초 생성 * + * + *+ */ +@Component("vEPagingUtil") +public class VEPagingUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(VEPagingUtil.class); + + + ////////////////////////////////////////////////// + // + // VEInstrAsgnmVO paging + // + + //페이징을 위한 처리 step1 - 페이징 기본 정보 설정 + public PaginationInfo setPagingStep1_VEInstrAsgnmVO( + PaginationInfo p_paginationInfo, + VEInstrAsgnmVO p_VEInstrAsgnmVO + ){ + + try { + LOGGER.debug("VEPagingUtil-setPagingStep1_VEInstrAsgnmVO()"); + + // pageing step1 + p_paginationInfo.setCurrentPageNo(p_VEInstrAsgnmVO.getPageIndex()); + p_paginationInfo.setRecordCountPerPage(p_VEInstrAsgnmVO.getPageUnit()); + p_paginationInfo.setPageSize(p_VEInstrAsgnmVO.getPageSize()); + + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + + return p_paginationInfo; + } + + //페이징을 위한 처리 step2 - 게시물 리스트 수량 설정 및 검색 조건 초기화 + public VEInstrAsgnmVO setPagingStep2_VEInstrAsgnmVO( + VEInstrAsgnmVO p_VEInstrAsgnmVO + , PaginationInfo p_paginationInfo + )throws Exception{ + + try { + LOGGER.debug("VEPagingUtil-setPagingStep2_VEInstrAsgnmVO()"); + + // pageing step2 + p_VEInstrAsgnmVO.setFirstIndex(p_paginationInfo.getFirstRecordIndex()); + p_VEInstrAsgnmVO.setLastIndex(p_paginationInfo.getLastRecordIndex()); + p_VEInstrAsgnmVO.setRecordCountPerPage(p_paginationInfo.getRecordCountPerPage()); + + if("".equals(p_VEInstrAsgnmVO.getSearchSortCnd())){ //최초조회시 최신것 조회List + p_VEInstrAsgnmVO.setSearchSortCnd("prcs_ord"); + p_VEInstrAsgnmVO.setSearchSortOrd("desc"); + } + + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + + return p_VEInstrAsgnmVO; + } + + + //페이징을 위한 처리 step3 - 전체 게시물 수량 설정하기 + public PaginationInfo setPagingStep3_VEInstrAsgnmVO( + List
- * << 개정이력(Modification Information) >> - * - * 수정일 수정자 수정내용 - * ------- -------- --------------------------- - * 2021.12.16 조용준 최초 생성 - * - *- */ - -@Controller -@RequestMapping("/kccadr/oprtn/adultVisitEdu") -public class EduRsltMngAdultController { - - private static final Logger LOGGER = LoggerFactory.getLogger(EduRsltMngAdultController.class); - - //로그인 체크 util - @Resource(name = "checkLoginUtil") - private CheckLoginUtil checkLoginUtil; - - //과정 관리 - @Resource(name = "vEPrcsService") - private VEPrcsService vEPrcsService; - - //신청과정 관리 - @Resource(name = "vEEduMIXService") - private VEEduMIXService vEEduMIXService; - - //교육신청 - @Resource(name = "vEEduAplctService") - private VEEduAplctService vEEduAplctService; - - //교육과정신청 - @Resource(name = "vEPrcsMIXService") - private VEPrcsMIXService vEPrcsMIXService; - - //차시 - @Resource(name = "vEEduChasiService") - private VEEduChasiService vVEEduChasiService; - - // eGov 공통코드 - @Resource(name = "EgovCmmUseService") - private EgovCmmUseService cmmUseService; - - @Resource(name = "EgovFileMngService") - private EgovFileMngService fileService; - - // global 프로퍼티 - @Resource(name="globalSettings") - protected Properties propertiesService; - - //첨부파일 경로, realPath 설정 - @Resource(name="EgovFileMngUtil") - private EgovFileMngUtil fileUtil; - - // 첨부파일 정보 - @Resource(name="EgovFileMngService") - private EgovFileMngService fileMngService; - - //암복호화 유틸 - @Resource(name = "egovCryptoUtil") - EgovCryptoUtil egovCryptoUtil; - - - @Resource(name="KccadrMgrUdtService") - private KccadrMgrUdtService kccadrMgrUdtService; - - // 교육신청 서비스단 - @Resource(name = "checkAdrProcessUtil") - private CheckAdrProcessUtil checkAdrProcessUtil; - - // 교육패널티 - @Resource(name = "vEEduPnltyService") - private VEEduPnltyService vEEduPnltyService; - - // 강의배정정보 - @Resource(name = "vEAsgnmMIXService") - private VEAsgnmMIXService vEAsgnmMIXService; - - @Resource(name = "egovQustnrRespondInfoService") - private EgovQustnrRespondInfoService egovQustnrRespondInfoService; - - //NOTI 서비스 - @Resource(name="vEAsgnmNotiService") - private VEAsgnmNotiService vEAsgnmNotiService; - - /** - * 교육결과관리 목록 화면 - */ - @RequestMapping("eduRsltMngList.do") - public String eduRsltMngList( - @ModelAttribute("vEEduAplctVO") VEEduAplctVO vEEduAplctVO - , HttpSession session - , ModelMap model - ) throws Exception { - - //로그인 처리==================================== - //로그인 정보 가져오기 - - //String s_oprtnLoginCheckNInfo = checkLoginUtil.oprtnCheckNInfo(model); - //if (!"".equals(s_oprtnLoginCheckNInfo)) return s_oprtnLoginCheckNInfo; - LoginVO user = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; - //로그인 처리==================================== - - // 검색자가 '강사이름'일 때, 암호화하여 검색자에 set한다. - if("2".equals(vEEduAplctVO.getSearchCondition())) { - vEEduAplctVO.setSearchKeyword(egovCryptoUtil.encrypt(vEEduAplctVO.getSearchKeyword())); - } - - - //1.pageing step1 - PaginationInfo paginationInfo = this.setPagingStep1(vEEduAplctVO); - - //2. pageing step2 - vEEduAplctVO = this.setPagingStep2(vEEduAplctVO, paginationInfo); - vEEduAplctVO.setInstrDiv("20"); // 성인 교육 코드 - vEEduAplctVO.setLctrDivCd("20"); - vEEduAplctVO.setAprvlCd("60"); - vEEduAplctVO.setNotiUserId(user.getUniqId()); - vEEduAplctVO.setMenuNo(session.getAttribute("menuNo").toString()); - - vEEduAplctVO = egovCryptoUtil.encryptVEEduAplctVOInfo(vEEduAplctVO); - - - List