diff --git a/egovframe-template-simple-react-contribution/src/css/page.css b/egovframe-template-simple-react-contribution/src/css/page.css index 3dc156c..c993903 100644 --- a/egovframe-template-simple-react-contribution/src/css/page.css +++ b/egovframe-template-simple-react-contribution/src/css/page.css @@ -316,6 +316,16 @@ .BRD011 .result .list_item > div:nth-child(12) {width: 60px;} .BRD011 .result .list_item > div:nth-child(13) {width: 60px;} + /* 건설기준관리 - API키 관리*/ + .BRD012 .head > span:nth-child(1) {width: 100px;} + .BRD012 .head > span:nth-child(2) {width: 360px;} + .BRD012 .head > span:nth-child(3) {width: 200px;} + .BRD012 .head > span:nth-child(4) {width: 150px;} + .BRD012 .result .list_item > div:nth-child(1) {width: 100px;} + .BRD012 .result .list_item > div:nth-child(2) {width: 360px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;} + .BRD012 .result .list_item > div:nth-child(3) {width: 200px;} + .BRD012 .result .list_item > div:nth-child(4) {width: 150px;} + /* 게시판 사용관리 등록 */ .BOARD_USE_LIST .board_view2 dl dt {width: 185px;} .BOARD_USE_LIST .board_view2 dl:nth-child(2) dd .f_input2 {width: 490px; margin-left: 17px;} diff --git a/egovframe-template-simple-react-contribution/src/css/response.css b/egovframe-template-simple-react-contribution/src/css/response.css index a7f9f9e..029a2b0 100644 --- a/egovframe-template-simple-react-contribution/src/css/response.css +++ b/egovframe-template-simple-react-contribution/src/css/response.css @@ -480,6 +480,18 @@ .BRD011 .result .list_item > div:nth-child(6)::after {content: ""; display: inline-block; width: 1px; height: 11px; margin-left: 6px; background: #ccc; vertical-align: 0px;} .BRD011 .result .list_item > div:nth-child(6)::after {content: none;} + /* 건설기준관리 - API키 관리*/ + .BRD012 .head {display: none;} + .BRD012 .result .list_item {padding: 16px 0; border-bottom: 1px solid #dde2e5;} + .BRD012 .result .list_item > div {border-bottom: 0; font-size: 14px;} + .BRD012 .result .list_item > div:nth-child(1) {display: none;} + .BRD012 .result .list_item > div:nth-child(2) {width: 100%; padding: 0 0 2px 0; font-weight: 700; text-align: left;} + .BRD012 .result .list_item > div:nth-child(3), + .BRD012 .result .list_item > div:nth-child(4), + .BRD012 .result .list_item > div:nth-child(3)::after, + .BRD012 .result .list_item > div:nth-child(4)::after, + + .BOARD_USE_LIST .board_view2 dl dt {width: 95px;} .BOARD_USE_LIST .board_view2 dl:nth-child(2) dd .f_select {width: 100%;} .BOARD_USE_LIST .board_view2 dl:nth-child(2) dd .f_input2 {width: 100%; margin: 15px 0 0 0;} diff --git a/egovframe-template-simple-react-contribution/src/routes/index.jsx b/egovframe-template-simple-react-contribution/src/routes/index.jsx index 5e102ef..27837f7 100644 --- a/egovframe-template-simple-react-contribution/src/routes/index.jsx +++ b/egovframe-template-simple-react-contribution/src/routes/index.jsx @@ -124,18 +124,22 @@ const RootRoutes = () => { console.group("jwtAuthentication"); console.log("[Start] jwtAuthentication ------------------------------"); - const jwtAuthURL = "/uat/esm/jwtAuthAPI.do"; + const jwtAuthURL = "/auth/token-check"; let requestOptions = { method: "POST", }; - EgovNet.requestFetch(jwtAuthURL, requestOptions, (resp) => { - if (resp === false) { - setMounted(false); - } else { - setMounted(true); // 이 값으로 true 일 때만 페이지를 렌더링이 되는 변수 사용. - } - }); + EgovNet.requestFetch( + jwtAuthURL, + requestOptions, + (resp) => { + if (resp === false) { + setMounted(false); + } else { + setMounted(true); // 이 값으로 true 일 때만 페이지를 렌더링이 되는 변수 사용. + } + } + ); console.log("------------------------------jwtAuthentication [End]"); console.groupEnd("jwtAuthentication"); diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/auth/EgovLoginApiController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/auth/EgovLoginApiController.java index a9b2c5d..cc76029 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/auth/EgovLoginApiController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/auth/EgovLoginApiController.java @@ -8,6 +8,9 @@ import com.dbnt.kcscbackend.config.common.ResponseCode; import com.dbnt.kcscbackend.config.common.ResultVO; import com.dbnt.kcscbackend.config.egov.EgovMessageSource; import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil; +import com.dbnt.kcscbackend.config.jwt.redis.RefreshToken; +import com.dbnt.kcscbackend.config.jwt.redis.RefreshTokenRepository; +import io.jsonwebtoken.Claims; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; @@ -60,15 +63,7 @@ public class EgovLoginApiController extends BaseController { private EgovLoginService loginService; private final EgovJwtTokenUtil egovJwtTokenUtil; - - /** EgovMessageSource */ - @Resource(name = "egovMessageSource") - EgovMessageSource egovMessageSource; - - /** JWT */ - @Autowired - private EgovJwtTokenUtil jwtTokenUtil; - + private final RefreshTokenRepository refreshTokenRepository; @Operation( summary = "회원가입", @@ -177,8 +172,17 @@ public class EgovLoginApiController extends BaseController { return resultMap; } - @RequestMapping("/loginSuccess") - public HashMap loginSuccess(HttpServletRequest request, HttpServletResponse response){ - return new HashMap<>(); + @PostMapping("/token-check") + public boolean tokenCheck(HttpServletRequest request, HttpServletResponse response, @AuthenticationPrincipal UserInfo loginVO){ + String clientToken = request.getHeader("Authorization"); + RefreshToken refreshToken = refreshTokenRepository.findById(egovJwtTokenUtil.getUserSeqFromToken(clientToken)).orElse(null); + if (refreshToken != null){ + String serverToken = refreshToken.getRefreshToken(); + if(egovJwtTokenUtil.getUserSeFromToken(clientToken).equals(egovJwtTokenUtil.getUserSeFromToken(serverToken))){ + return true; + } + } + return false; } + } \ No newline at end of file diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/EgovJwtTokenUtil.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/EgovJwtTokenUtil.java index c6b1dd2..e448128 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/EgovJwtTokenUtil.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/EgovJwtTokenUtil.java @@ -58,6 +58,10 @@ public class EgovJwtTokenUtil implements Serializable{ //retrieve username from jwt token + public String getUserSeqFromToken(String token) { + Claims claims = getClaimFromToken(token); + return claims.get("userSeq").toString(); + } public String getUserIdFromToken(String token) { Claims claims = getClaimFromToken(token); return claims.get("id").toString(); @@ -89,7 +93,8 @@ public class EgovJwtTokenUtil implements Serializable{ // compaction of the JWT to a URL-safe string public String generateToken(UserInfo loginVO, String remoteAddr, Long sec) { Map claims = new HashMap<>(); - claims.put("id", loginVO.getUserId() ); + claims.put("userSeq", loginVO.getUserSeq()); + claims.put("id", loginVO.getUserId()); claims.put("remoteAddr", remoteAddr); claims.put("userSe", loginVO.getUserSe() ); claims.put("type", "Authorization");