Compare commits

...

5 Commits

10 changed files with 153 additions and 94 deletions

View File

@ -82,6 +82,7 @@ function EgovLoginContent(props) {
EgovNet.requestFetch(loginUrl, EgovNet.requestFetch(loginUrl,
requestOptions, requestOptions,
(resp) => { (resp) => {
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
let accessToken = resp?.accessToken || null; let accessToken = resp?.accessToken || null;
let resultVO = parseJwt(accessToken); let resultVO = parseJwt(accessToken);
let refreshToken = resp?.refreshToken || null; let refreshToken = resp?.refreshToken || null;
@ -89,7 +90,6 @@ function EgovLoginContent(props) {
// setSessionItem('accessToken', accessToken); // setSessionItem('accessToken', accessToken);
setLocalItem('accessToken', accessToken); setLocalItem('accessToken', accessToken);
setLocalItem('refreshToken', refreshToken); setLocalItem('refreshToken', refreshToken);
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
// setSessionItem('loginUser', resultVO); // setSessionItem('loginUser', resultVO);
props.onChangeLogin(resultVO); props.onChangeLogin(resultVO);
if (saveIDFlag) { if (saveIDFlag) {

View File

@ -129,81 +129,81 @@ function EgovMain(props) {
</Row> </Row>
</div> </div>
<div className="right_col"> {/*<div className="right_col">*/}
<div className="mini_board"> {/* <div className="mini_board">*/}
<ul className="tab"> {/* <ul className="tab">*/}
<li><a href="#공지사항" className="on">공지사항</a></li> {/* <li><a href="#공지사항" className="on">공지사항</a></li>*/}
<li><a href="#갤러리">갤러리</a></li> {/* <li><a href="#갤러리">갤러리</a></li>*/}
</ul> {/* </ul>*/}
<div className="list"> {/* <div className="list">*/}
<div className="notice"> {/* <div className="notice">*/}
<h2 className="blind">공지사항</h2> {/* <h2 className="blind">공지사항</h2>*/}
<ul> {/* <ul>*/}
{noticeListTag} {/* {noticeListTag}*/}
</ul> {/* </ul>*/}
<Link to={URL.INFORM_NOTICE} className="more">더보기</Link> {/* <Link to={URL.INFORM_NOTICE} className="more">더보기</Link>*/}
{/* </div>*/}
{/* <div className="gallary">*/}
{/* <h2 className="blind">갤러리</h2>*/}
{/* <ul>*/}
{/* {gallaryListTag}*/}
{/* </ul>*/}
{/* <Link to={URL.INFORM_GALLERY} className="more">더보기</Link>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="banner">*/}
{/* <Link to={URL.SUPPORT_DOWNLOAD} className="bn1">*/}
{/* <strong>자료실</strong>*/}
{/* <span>다양한 자료를<br />다운로드 받으실 수 있습니다.</span>*/}
{/* </Link>*/}
{/* <Link to={URL.ABOUT} className="bn2">*/}
{/* <strong>국가건설기준센터</strong>*/}
{/* <span>국가건설기준센터의<br />약도 등의 정보를 제공합니다.</span>*/}
{/* </Link>*/}
{/* </div>*/}
{/*</div>*/}
</div> </div>
<div className="gallary"> {/*<div className="banner_bot">*/}
<h2 className="blind">갤러리</h2> {/* <div className="b1">*/}
<ul> {/* <div>*/}
{gallaryListTag} {/* <h2>주요사업 소개</h2>*/}
</ul> {/* <p>국가건설기준센터가 제공하는<br />*/}
<Link to={URL.INFORM_GALLERY} className="more">더보기</Link> {/* 주요 사업을 소개합니다.</p>*/}
</div> {/* </div>*/}
</div> {/* <Link to={URL.INTRO_WORKS}>자세히 보기</Link>*/}
</div> {/* </div>*/}
{/* <div className="b2">*/}
<div className="banner"> {/* <div>*/}
<Link to={URL.SUPPORT_DOWNLOAD} className="bn1"> {/* <h2>대표서비스 소개</h2>*/}
<strong>자료실</strong> {/* <p>국가건설기준센터 실행환경의<br />*/}
<span>다양한 자료를<br />다운로드 받으실 있습니다.</span> {/* 서비스 그룹에서 제공하는<br />*/}
</Link> {/* 대표서비스입니다.</p>*/}
<Link to={URL.ABOUT} className="bn2"> {/* </div>*/}
<strong>국가건설기준센터</strong> {/* <Link to={URL.INTRO_SERVICE}>자세히 보기</Link>*/}
<span>국가건설기준센터의<br />약도 등의 정보를 제공합니다.</span> {/* </div>*/}
</Link> {/* <div className="b3">*/}
</div> {/* <div>*/}
</div> {/* <h2>서비스 신청</h2>*/}
</div> {/* <p>국가건설기준센터 경량환경<br />*/}
{/* 홈페이지의 다양한 서비스를<br />*/}
<div className="banner_bot"> {/* 신청 하실 수 있습니다.</p>*/}
<div className="b1"> {/* </div>*/}
<div> {/* <Link to={URL.SUPPORT_APPLY}>자세히 보기</Link>*/}
<h2>주요사업 소개</h2> {/* </div>*/}
<p>국가건설기준센터가 제공하는<br /> {/* <div className="b4">*/}
주요 사업을 소개합니다.</p> {/* <div>*/}
</div> {/* <h2>일정 현황</h2>*/}
<Link to={URL.INTRO_WORKS}>자세히 보기</Link> {/* <p>국가건설기준센터 경량환경<br />*/}
</div> {/* 홈페이지의 전체적인 일정<br />*/}
<div className="b2"> {/* 현황을 조회하실 수 있습니다.</p>*/}
<div> {/* </div>*/}
<h2>대표서비스 소개</h2> {/* <Link to={URL.INFORM}>자세히 보기</Link>*/}
<p>국가건설기준센터 실행환경의<br /> {/* </div>*/}
서비스 그룹에서 제공하는<br /> {/*</div>*/}
대표서비스입니다.</p>
</div>
<Link to={URL.INTRO_SERVICE}>자세히 보기</Link>
</div>
<div className="b3">
<div>
<h2>서비스 신청</h2>
<p>국가건설기준센터 경량환경<br />
홈페이지의 다양한 서비스를<br />
신청 하실 있습니다.</p>
</div>
<Link to={URL.SUPPORT_APPLY}>자세히 보기</Link>
</div>
<div className="b4">
<div>
<h2>일정 현황</h2>
<p>국가건설기준센터 경량환경<br />
홈페이지의 전체적인 일정<br />
현황을 조회하실 있습니다.</p>
</div>
<Link to={URL.INFORM}>자세히 보기</Link>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Pageable;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -41,12 +42,13 @@ public class PopUpApiController {
@GetMapping(value = "/contents/api/popup-manage/list") @GetMapping(value = "/contents/api/popup-manage/list")
public ResultVO contentsApiPopUpManageList( public ResultVO contentsApiPopUpManageList(
@AuthenticationPrincipal LoginVO user, @AuthenticationPrincipal LoginVO user,
HttpServletRequest request) throws Exception { HttpServletRequest request,
Pageable pageable) throws Exception {
ResultVO resultVO = new ResultVO(); ResultVO resultVO = new ResultVO();
try { try {
resultVO = popUpApiService.contentsApiPopUpManageList(resultVO, request, user); resultVO = popUpApiService.contentsApiPopUpManageList(resultVO, request, user, pageable);
} catch (Exception e) { } catch (Exception e) {
resultVO.setResultCode(ResponseCode.FAILED.getCode()); resultVO.setResultCode(ResponseCode.FAILED.getCode());
resultVO.setResultMessage(e.getMessage()); resultVO.setResultMessage(e.getMessage());

View File

@ -2,9 +2,10 @@ package com.dbnt.kcscbackend.admin.contents.popUp.service;
import com.dbnt.kcscbackend.auth.entity.LoginVO; import com.dbnt.kcscbackend.auth.entity.LoginVO;
import com.dbnt.kcscbackend.config.common.ResultVO; import com.dbnt.kcscbackend.config.common.ResultVO;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
public interface PopUpApiService { public interface PopUpApiService {
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception; public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
} }

View File

@ -9,6 +9,9 @@ import com.dbnt.kcscbackend.config.common.ResponseCode;
import com.dbnt.kcscbackend.config.common.ResultVO; import com.dbnt.kcscbackend.config.common.ResultVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -28,7 +31,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
@Override @Override
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception { public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception {
System.out.println( System.out.println(
"\n--------------------------------------------------------------\n" + "\n--------------------------------------------------------------\n" +
@ -39,7 +42,15 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
"\n--------------------------------------------------------------\n" "\n--------------------------------------------------------------\n"
); );
List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(Sort.by(Sort.Direction.DESC, "popupSeq")) PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(pageable.getPageNumber());
paginationInfo.setRecordCountPerPage(pageable.getPageSize());
paginationInfo.setPageSize(5);//hard coded
paginationInfo.setTotalRecordCount(123);//hard coded
//List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(Sort.by(Sort.Direction.DESC, "popupSeq"))
List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(pageable)
.stream() .stream()
.map(item -> { .map(item -> {
Map<String, Object> codeMap = new HashMap<>(); Map<String, Object> codeMap = new HashMap<>();
@ -61,6 +72,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
Map<String, Object> dto = new HashMap<String, Object>(); Map<String, Object> dto = new HashMap<String, Object>();
dto.put("listPopup", listPopup); dto.put("listPopup", listPopup);
dto.put("paginationInfo", paginationInfo);
resultVO.setResult(dto); resultVO.setResult(dto);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage()); resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());

View File

@ -1,8 +1,10 @@
package com.dbnt.kcscbackend.config.security; package com.dbnt.kcscbackend.config.security;
import com.dbnt.kcscbackend.auth.entity.UserInfo; import com.dbnt.kcscbackend.auth.entity.UserInfo;
import com.dbnt.kcscbackend.config.common.ResponseCode;
import com.dbnt.kcscbackend.config.egov.EgovProperties;
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil; import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
import lombok.NoArgsConstructor; import com.dbnt.kcscbackend.config.util.ClientUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -17,11 +19,12 @@ import org.springframework.security.web.savedrequest.RequestCache;
import org.springframework.security.web.savedrequest.SavedRequest; import org.springframework.security.web.savedrequest.SavedRequest;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
@Configuration @Configuration
@ -30,6 +33,8 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
private final EgovJwtTokenUtil jwtTokenUtil; private final EgovJwtTokenUtil jwtTokenUtil;
private RequestCache requestCache = new HttpSessionRequestCache(); private RequestCache requestCache = new HttpSessionRequestCache();
private static final List<String> adminIpList = Arrays.asList(EgovProperties.getProperty("Globals.admin.allow-ip").split(","));
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws ServletException, IOException { Authentication authentication) throws ServletException, IOException {
@ -48,20 +53,24 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
securityUser = (UserInfo) principal; securityUser = (UserInfo) principal;
} }
} }
// application/json(ajax) 요청일 경우 아래의 처리! // application/json(ajax) 요청일 경우 아래의 처리!
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
MediaType jsonMimeType = MediaType.APPLICATION_JSON; MediaType jsonMimeType = MediaType.APPLICATION_JSON;
HashMap<String, Object> resultMap = new HashMap<>();
if(securityUser.getUserId().equals("admin") && !adminIpList.contains(ClientUtils.getRemoteIP(request))){
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
}else{
String accessToken = jwtTokenUtil.generateAccessToken(securityUser, request.getRemoteAddr()); String accessToken = jwtTokenUtil.generateAccessToken(securityUser, request.getRemoteAddr());
String refreshToken = jwtTokenUtil.generateRefreshTokenToken(securityUser, request.getRemoteAddr()); String refreshToken = jwtTokenUtil.generateRefreshTokenToken(securityUser, request.getRemoteAddr());
HashMap<String, Object> resultMap = new HashMap<>(); resultMap.put("resultCode", ResponseCode.SUCCESS.getCode());
resultMap.put("resultCode", "200");
resultMap.put("accessToken", accessToken); resultMap.put("accessToken", accessToken);
resultMap.put("refreshToken", refreshToken); resultMap.put("refreshToken", refreshToken);
// response.addHeader("Authorization", "BEARER "+accessToken); // response.addHeader("Authorization", "BEARER "+accessToken);
// Cookie refreshTokenCookie = new Cookie("refreshToken", refreshToken); // Cookie refreshTokenCookie = new Cookie("refreshToken", refreshToken);
// response.addCookie(refreshTokenCookie); // response.addCookie(refreshTokenCookie);
}
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) { if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response)); jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
} }

View File

@ -0,0 +1,32 @@
package com.dbnt.kcscbackend.config.util;
import javax.servlet.http.HttpServletRequest;
public class ClientUtils {
public static String getRemoteIP(HttpServletRequest request){
String ip = request.getHeader("X-FORWARDED-FOR");
//proxy 환경일 경우
if (ip == null || ip.isEmpty()) {
ip = request.getHeader("Proxy-Client-IP");
}
//웹로직 서버일 경우
if (ip == null || ip.isEmpty()) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.isEmpty()) {
ip = request.getRemoteAddr() ;
}
if (ip == null || ip.isEmpty()) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.isEmpty()) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.isEmpty()) {
ip = request.getRemoteAddr();
}
return ip;
}
}

View File

@ -13,5 +13,8 @@ spring.redis.port=6379
# secret key # secret key
Globals.jwt.secret = qWwMroux3QtiIJcPSIZARNTZEBBnWVH0jZ2Lx7tfFChCYi0ViZllo1bekZdiU0B3FRjJI7g90n0ha120dwlz8JZU8rOkmNCe9Uq0 Globals.jwt.secret = qWwMroux3QtiIJcPSIZARNTZEBBnWVH0jZ2Lx7tfFChCYi0ViZllo1bekZdiU0B3FRjJI7g90n0ha120dwlz8JZU8rOkmNCe9Uq0
# admin allow ip
Globals.admin.allow-ip = 218.49.16.81,218.49.21.183,218.49.16.168,218.49.17.102,218.49.21.222,218.49.17.229,218.49.16.219,218.49.17.66,218.49.16.40,218.49.17.205,218.49.21.164,218.49.17.122,218.49.17.199,218.49.17.121,218.49.17.28,218.49.20.33,218.49.20.207,218.49.16.79,218.49.16.250,58.234.249.138,218.49.22.51,218.49.21.238,127.0.0.1,0:0:0:0:0:0:0:1
#?????? ???? ? #?????? ???? ?
#?? : ??? ??? "egovframe"? ????? ???? ????? ????. #?? : ??? ??? "egovframe"? ????? ???? ????? ????.