File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package itn.let.utl.user.service;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import itn.com.cmm.EgovMessageSource;
/**
*
* 로그인 체크에 대한 Util 클래스
* @author 사업기술본부 조용준(ITN)
* @since 2021.07.16
* @version 1.0
* @see
*
* <pre>
* << 개정이력(Modification Information) >>
*
* 수정일 수정자 수정내용
* ------- -------- ---------------------------
* 2021.07.16 조용준 최초 생성 *
*
* </pre>
*/
@Service("checkLoginUtil")
public class CheckLoginUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CheckLoginUtil.class);
/** EgovMessageSource */
@Resource(name="egovMessageSource")
EgovMessageSource egovMessageSource;
/**
* //사용자 로그인 여부 체크 - 페이지 이동
*
* @param encrypt
*/
//사용자 로그인 여부 체크 페이지 이동
//페이지 이동시
public String isUserLogin4PageMove(
RedirectAttributes p_redirectAttributes
) throws Exception{
//LOGGER.debug("commonLoginUtil.isUserLogin()");
return this.p_isUserLogin4PageMove(p_redirectAttributes);
}
/**
* //관리자 로그인 여부 체크 - 페이지 이동
*
* @param encrypt
*/
public String isAdminLogin4PageMove(
RedirectAttributes p_redirectAttributes
) throws Exception{
//LOGGER.debug("commonLoginUtil.isAdminLogin()");
return this.p_isAdminLogin4PageMove(p_redirectAttributes);
}
/**
* //json 로그인 여부 체크
*
* @param encrypt
*/
//json html 호출시
public String isLoginCheck4JsonPage(
RedirectAttributes p_redirectAttributes
) throws Exception{
//LOGGER.debug("commonLoginUtil.isUserLogin()");
return this.p_isLoginCheck4JsonPage(p_redirectAttributes);
}
//json action 처리시
public String isLoginCheck4JsonAction(
ModelAndView p_modelAndView
) throws Exception{
//LOGGER.debug("commonLoginUtil.isJsonLogin()");
return this.p_isLoginCheck4JsonAction(p_modelAndView);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
// private function
//
//
/**
* //사용자 로그인 여부 체크
*
* @param encrypt
*/
private String p_isUserLogin4PageMove(
RedirectAttributes p_redirectAttributes
) throws Exception{
try {
LOGGER.debug("commonLoginUtil.p_isUserLogin4PageMove()");
//사용자 로그인 여부 체크
if (!EgovUserDetailsHelper.isAuthenticated()){ //인증
p_redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("info.user.login"));
return "redirect:/web/user/login/login.do";
}
} catch(IllegalArgumentException e) {
LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage());
} catch (Exception e) {
LOGGER.error("[" + e.getClass() +"] :" + e.getMessage());
}
return "Y";
}
/**
* //관리자 로그인 여부 체크
*
* @param encrypt
*/
private String p_isAdminLogin4PageMove(
RedirectAttributes p_redirectAttributes
) throws Exception{
try {
LOGGER.debug("commonLoginUtil.p_isAdminLogin4PageMove()");
//관리자 로그인 여부 체크
if (!EgovUserDetailsHelper.isAuthenticated()){ //인증
p_redirectAttributes.addFlashAttribute("message", egovMessageSource.getMessage("info.user.login"));
return "redirect:/uat/uia/EgovLoginUsr.do";
}
} catch(IllegalArgumentException e) {
LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage());
} catch (Exception e) {
LOGGER.error("[" + e.getClass() +"] :" + e.getMessage());
}
return "Y";
}
/**
* //json 로그인 여부 체크 4 page call
*
* @param encrypt
*/
private String p_isLoginCheck4JsonPage(
RedirectAttributes p_redirectAttributes
) throws Exception{
try {
LOGGER.debug("commonLoginUtil.p_isLoginCheck4JsonPage()");
//사용자 로그인 여부 체크
if (!EgovUserDetailsHelper.isAuthenticated()){ //인증
return "N";
}
} catch(IllegalArgumentException e) {
LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage());
} catch (Exception e) {
LOGGER.error("[" + e.getClass() +"] :" + e.getMessage());
}
return "Y";
}
/**
* //json 로그인 여부 체크 4 json action call
*
* @param encrypt
*/
private String p_isLoginCheck4JsonAction(
ModelAndView p_modelAndView
) throws Exception{
try {
LOGGER.debug("commonLoginUtil.p_isLoginCheck4JsonAction()");
//로그인 여부 체크 for json
if (!EgovUserDetailsHelper.isAuthenticated()){ //인증
p_modelAndView.addObject("message", egovMessageSource.getMessage("info.user.login"));
p_modelAndView.addObject("result", "fail");
return "N";
}
} catch(IllegalArgumentException e) {
LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage());
} catch (Exception e) {
LOGGER.error("[" + e.getClass() +"] :" + e.getMessage());
}
return "Y";
}
}