

250324 김혜민 mber 리팩토링 및 중복로그인 레디스 추가
@501ce4b23c365392658799faae109b8967850f66
--- build.gradle
+++ build.gradle
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 |
implementation 'org.springframework.boot:spring-boot-starter-validation' |
36 | 36 |
implementation 'org.springframework.boot:spring-boot-starter-security' |
37 | 37 |
implementation 'org.springframework.boot:spring-boot-starter-web-services' |
38 |
-// implementation 'org.springframework.boot:spring-boot-devtools' |
|
38 |
+ implementation 'org.springframework.boot:spring-boot-starter-data-redis' |
|
39 | 39 |
implementation 'org.springframework.boot:spring-boot-starter-cache' |
40 | 40 |
|
41 | 41 |
implementation ('org.egovframe.rte:org.egovframe.rte.ptl.mvc:4.2.0'){ |
--- build/resources/main/mybatis/mapper-ora/ums/ums-SQL.xml
... | ... | @@ -1,29 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | -<mapper namespace="com.takensoft.ums.dao.UmsDAO"> | |
4 | - <insert id="save" parameterType="UmsVO"> | |
5 | - INSERT INTO CUSTOMER_SMS_SEND ( | |
6 | - USER_ID | |
7 | - , SCHEDULE_TYPE | |
8 | - , TITLE | |
9 | - ,MSG_CONTENT | |
10 | - , CALLING_NUM | |
11 | - ,PHONE_NUM | |
12 | - , RESERV_DTTM | |
13 | - , REG_DTTM | |
14 | - ) VALUES ( | |
15 | - #{userId}, | |
16 | - #{scheduleType}, | |
17 | - #{title}, | |
18 | - #{msgContent}, | |
19 | - #{callingNum}, | |
20 | - #{phoneNum}, | |
21 | - NULL, | |
22 | - TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') | |
23 | - ) | |
24 | - </insert> | |
25 | - | |
26 | - <select id="findAll" resultType="UmsVO"> | |
27 | - SELECT * FROM CUSTOMER_SMS_SEND | |
28 | - </select> | |
29 | -</mapper>(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/accesCtrl/service/Impl/SystemAccesCtrlServiceImpl.java
+++ src/main/java/com/takensoft/cms/accesCtrl/service/Impl/SystemAccesCtrlServiceImpl.java
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 |
import com.takensoft.cms.accesCtrl.service.AccesCtrlService; |
4 | 4 |
import com.takensoft.cms.accesCtrl.service.SystemAccesCtrlService; |
5 | 5 |
import com.takensoft.cms.accesCtrl.vo.AccesCtrlVO; |
6 |
-import com.takensoft.common.util.CommonUtils; |
|
6 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
7 | 7 |
import lombok.RequiredArgsConstructor; |
8 | 8 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
9 | 9 |
import org.springframework.dao.DataAccessException; |
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 |
|
13 | 13 |
import jakarta.servlet.http.HttpServletRequest; |
14 | 14 |
|
15 |
-import java.net.UnknownHostException; |
|
16 | 15 |
import java.util.List; |
17 | 16 |
import java.util.Map; |
18 | 17 |
|
... | ... | @@ -35,7 +34,7 @@ |
35 | 34 |
@RequiredArgsConstructor |
36 | 35 |
public class SystemAccesCtrlServiceImpl extends EgovAbstractServiceImpl implements SystemAccesCtrlService { |
37 | 36 |
|
38 |
- private final CommonUtils commonUtils; |
|
37 |
+ private final HttpRequestUtil httpRequestUtil; |
|
39 | 38 |
private final AccesCtrlService accesCtrlService; |
40 | 39 |
|
41 | 40 |
/** |
... | ... | @@ -43,7 +42,6 @@ |
43 | 42 |
* @param req : HTTP 요청 객체 |
44 | 43 |
* @return boolean : 접근 여부 |
45 | 44 |
* @throws DataAccessException : db 관련 예외 발생 시 |
46 |
- * @throws UnknownHostException : 아이피 정보 조회 실패 시 |
|
47 | 45 |
* @throws Exception : 그 외 예외 발생 시 |
48 | 46 |
* |
49 | 47 |
* 접근 제어 조회(시스템용 - 라우터) |
... | ... | @@ -51,7 +49,7 @@ |
51 | 49 |
@Override |
52 | 50 |
public boolean routerAccesCheck(Map params, HttpServletRequest req) { |
53 | 51 |
try { |
54 |
- String ipAdrs = commonUtils.getIp(req); // 아이피 정보 |
|
52 |
+ String ipAdrs = httpRequestUtil.getIp(req); // 아이피 정보 |
|
55 | 53 |
String path = params.get("path").toString(); // 접근 경로 |
56 | 54 |
// 공통 접근 경로인 경우 |
57 | 55 |
if (isPath(path, "/cmmn/**")) { |
... | ... | @@ -79,8 +77,6 @@ |
79 | 77 |
return matches(list, path); |
80 | 78 |
} catch (DataAccessException dae) { |
81 | 79 |
throw dae; |
82 |
- } catch (UnknownHostException ukhe) { |
|
83 |
- throw new RuntimeException("호스트의 IP정보를 알 수가 없습니다.", ukhe); |
|
84 | 80 |
} catch (Exception e) { |
85 | 81 |
throw e; |
86 | 82 |
} |
--- src/main/java/com/takensoft/cms/accesCtrl/web/SystemAccesCtrlController.java
+++ src/main/java/com/takensoft/cms/accesCtrl/web/SystemAccesCtrlController.java
... | ... | @@ -49,7 +49,7 @@ |
49 | 49 |
* 접근 제어 관련 사용자 확인 |
50 | 50 |
*/ |
51 | 51 |
@PostMapping(value = "/accessCheck.json") |
52 |
- public ResponseEntity<?> accessCheck(@RequestBody Map params, HttpServletRequest req) throws Exception { |
|
52 |
+ public ResponseEntity<?> accessCheck(@RequestBody Map params, HttpServletRequest req) { |
|
53 | 53 |
boolean result = systemAccesCtrlService.routerAccesCheck(params, req); |
54 | 54 |
|
55 | 55 |
// 응답 처리 |
--- src/main/java/com/takensoft/cms/bbs/web/BbsCnController.java
+++ src/main/java/com/takensoft/cms/bbs/web/BbsCnController.java
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 |
* 게시판 내용 등록 |
65 | 65 |
*/ |
66 | 66 |
@PostMapping(path = "/saveBbsCn.file") |
67 |
- public ResponseEntity<?> saveBbsCn(@RequestPart BbsCnVO bbsCn, List<MultipartFile> multipartFileList, List<MultipartFile> multipartImgList) throws Exception { |
|
67 |
+ public ResponseEntity<?> saveBbsCn(@RequestPart BbsCnVO bbsCn, List<MultipartFile> multipartFileList, List<MultipartFile> multipartImgList){ |
|
68 | 68 |
// 게시판 내용 등록 |
69 | 69 |
HashMap<String, Object> result = bbsCnService.saveBbsCn(bbsCn, multipartFileList, multipartImgList); |
70 | 70 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 |
* 게시판 내용 목록 조회 |
78 | 78 |
*/ |
79 | 79 |
@PostMapping("/findAll.json") |
80 |
- public ResponseEntity<?> findAll(@RequestBody HashMap<String, String> params) throws Exception { |
|
80 |
+ public ResponseEntity<?> findAll(@RequestBody HashMap<String, String> params) { |
|
81 | 81 |
// 게시판 내용 목록 조회 |
82 | 82 |
Map<String, Object> result = bbsCnService.findAllBbsCn(params); |
83 | 83 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
... | ... | @@ -90,7 +90,7 @@ |
90 | 90 |
* 게시판 내용 상세 조회 |
91 | 91 |
*/ |
92 | 92 |
@PostMapping("/findByBbsCn.json") |
93 |
- public ResponseEntity<?> findByBbsCn(@RequestBody BbsCnVO bbsCnVO) throws Exception { |
|
93 |
+ public ResponseEntity<?> findByBbsCn(@RequestBody BbsCnVO bbsCnVO) { |
|
94 | 94 |
// 게시판 관리 정보 조회 |
95 | 95 |
BbsMngVO bbsMng = bbsMngService.findByBbsMngId(bbsCnVO.getBbsMngId()); |
96 | 96 |
// 게시판 내용 상세 조회 |
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 |
* 게시판 내용 수정 |
130 | 130 |
*/ |
131 | 131 |
@PostMapping(path = "/updateBbsCn.file") |
132 |
- public ResponseEntity<?> updateBbsCn(@RequestPart HashMap<String, Object> params, @RequestPart List<HashMap<String, Object>> deleteFileList, List<MultipartFile> multipartFileList, @RequestPart List<HashMap<String, Object>> deleteImgFileList, List<MultipartFile> multipartImgList) throws Exception { |
|
132 |
+ public ResponseEntity<?> updateBbsCn(@RequestPart HashMap<String, Object> params, @RequestPart List<HashMap<String, Object>> deleteFileList, List<MultipartFile> multipartFileList, @RequestPart List<HashMap<String, Object>> deleteImgFileList, List<MultipartFile> multipartImgList){ |
|
133 | 133 |
// 게시판 내용 수정 |
134 | 134 |
HashMap<String, Object> result = bbsCnService.updateBbsCn(params, deleteFileList, multipartFileList, deleteImgFileList, multipartImgList); |
135 | 135 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
--- src/main/java/com/takensoft/cms/mber/Schedule/RefreshScheduler.java
+++ src/main/java/com/takensoft/cms/mber/Schedule/RefreshScheduler.java
... | ... | @@ -1,13 +1,17 @@ |
1 | 1 |
package com.takensoft.cms.mber.Schedule; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.mber.dao.RefreshTokenDAO; |
4 |
+import com.takensoft.common.exception.CustomUpdateFailException; |
|
5 |
+import org.springframework.dao.DataAccessException; |
|
4 | 6 |
import org.springframework.scheduling.annotation.Scheduled; |
5 | 7 |
import org.springframework.stereotype.Component; |
6 | 8 |
import org.springframework.transaction.annotation.Transactional; |
7 |
- |
|
8 | 9 |
/** |
9 | 10 |
* @author : takensoft |
10 | 11 |
* @since : 2024.04.01 |
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
11 | 15 |
* |
12 | 16 |
* RefreshToken 만료 기한이 된 token 제거를 위한 스케쥴러 |
13 | 17 |
*/ |
... | ... | @@ -15,14 +19,11 @@ |
15 | 19 |
public class RefreshScheduler { |
16 | 20 |
|
17 | 21 |
private final RefreshTokenDAO refreshTokenDAO; |
18 |
- |
|
19 | 22 |
public RefreshScheduler(RefreshTokenDAO refreshTokenDAO) { |
20 | 23 |
this.refreshTokenDAO = refreshTokenDAO; |
21 | 24 |
} |
22 | 25 |
|
23 | 26 |
/** |
24 |
- * @author takensoft |
|
25 |
- * @since 2024.04.05 |
|
26 | 27 |
* refresh token 삭제 스케쥴러 |
27 | 28 |
* 매일 자정에 만료 기한이 지난 refresh token 삭제 |
28 | 29 |
*/ |
--- src/main/java/com/takensoft/cms/mber/dao/AdmMbrDAO.java
+++ src/main/java/com/takensoft/cms/mber/dao/AdmMbrDAO.java
... | ... | @@ -9,84 +9,87 @@ |
9 | 9 |
|
10 | 10 |
import java.util.HashMap; |
11 | 11 |
import java.util.List; |
12 |
- |
|
13 | 12 |
/** |
14 |
- * @author : 박정하 |
|
15 |
- * @since : 2024.06.21 |
|
13 |
+ * @author 박정하 |
|
14 |
+ * @since 2024.06.21 |
|
15 |
+ * @modification |
|
16 |
+ * since | author | description |
|
17 |
+ * 2024.06.21 | 박정하 | 최초 등록 |
|
16 | 18 |
* |
17 | 19 |
* 회원정보 관련 Mapper |
18 | 20 |
*/ |
19 | 21 |
@Mapper("admMbrDAO") |
20 | 22 |
public interface AdmMbrDAO { |
21 |
- /** |
|
22 |
- * @author : 박정하 |
|
23 |
- * @since : 2024.06.21 |
|
24 |
- * |
|
25 |
- * 회원정보 목록 갯수 |
|
26 |
- */ |
|
27 |
- public int mbrListCnt(Pagination pagination) throws Exception; |
|
28 | 23 |
|
29 | 24 |
/** |
30 |
- * @author : 박정하 |
|
31 |
- * @since : 2024.06.21 |
|
25 |
+ * @param pagination - 페이징 정보 |
|
26 |
+ * @return int - 회원정보 목록 갯수 결과 |
|
27 |
+ * |
|
28 |
+ * 회원정보 목록 갯수 조회 |
|
29 |
+ */ |
|
30 |
+ public int mbrListCnt(Pagination pagination); |
|
31 |
+ |
|
32 |
+ /** |
|
33 |
+ * @param pagination - 페이징 정보 |
|
34 |
+ * @return List<AdmMbrDTO> - 회원정보 관련 목록 조회 결과 |
|
32 | 35 |
* |
33 | 36 |
* 회원정보 목록 조회 |
34 | 37 |
*/ |
35 |
- public List<AdmMbrDTO> mbrList(Pagination pagination) throws Exception; |
|
38 |
+ public List<AdmMbrDTO> mbrList(Pagination pagination); |
|
36 | 39 |
|
37 | 40 |
/** |
38 |
- * @author : 박정하 |
|
39 |
- * @since : 2024.06.21 |
|
41 |
+ * @param mbrId - 회원 아이디 |
|
42 |
+ * @return AdmMbrDTO - 회원정보 상세 조회 결과 |
|
40 | 43 |
* |
41 | 44 |
* 회원정보 상세 조회 |
42 | 45 |
*/ |
43 |
- public AdmMbrDTO mbrDetail(String mbrId) throws Exception; |
|
46 |
+ public AdmMbrDTO mbrDetail(String mbrId); |
|
44 | 47 |
|
45 | 48 |
/** |
46 |
- * @author : 박정하 |
|
47 |
- * @since : 2024.06.21 |
|
49 |
+ * @param admMbrDTO - 회원정보 관련 DTO |
|
50 |
+ * @return int - 회원정보 수정 결과 |
|
48 | 51 |
* |
49 | 52 |
* 회원정보 수정 |
50 | 53 |
*/ |
51 |
- public int updateMbr(AdmMbrDTO admMbrDTO) throws Exception; |
|
54 |
+ public int updateMbr(AdmMbrDTO admMbrDTO); |
|
52 | 55 |
|
53 | 56 |
/** |
54 |
- * @author : 박정하 |
|
55 |
- * @since : 2024.06.21 |
|
57 |
+ * @param mbrId - 회원 아이디 |
|
58 |
+ * @return int - 회원정보 권한 목록 삭제 결과 |
|
56 | 59 |
* |
57 | 60 |
* 회원정보 권한 목록 삭제 (mbrId 사용) |
58 | 61 |
*/ |
59 |
- public int deleteAuthorListByMbrId(String mbrId) throws Exception; |
|
62 |
+ public int deleteAuthorListByMbrId(String mbrId); |
|
60 | 63 |
|
61 | 64 |
/** |
62 |
- * @author : 박정하 |
|
63 |
- * @since : 2024.06.21 |
|
65 |
+ * @param mberAuthorVO - 사용자 권한 관련 VO |
|
66 |
+ * @return int - 회원 권한 목록 삭제 결과 |
|
64 | 67 |
* |
65 | 68 |
* 회원 권한 목록 삭제 (mbrId 사용) |
66 | 69 |
*/ |
67 |
- public int insertAuthor(MberAuthorVO mberAuthorVO) throws Exception; |
|
70 |
+ public int insertAuthor(MberAuthorVO mberAuthorVO); |
|
68 | 71 |
|
69 | 72 |
/** |
70 |
- * @author : 박정하 |
|
71 |
- * @since : 2024.06.21 |
|
73 |
+ * @param joinDTO - 회원 가입 관련 DTO |
|
74 |
+ * @return int - 회원정보 등록 결과 |
|
72 | 75 |
* |
73 | 76 |
* 회원정보 등록 |
74 | 77 |
*/ |
75 |
- public int mbrInsert(JoinDTO joinDTO) throws Exception; |
|
78 |
+ public int mbrInsert(JoinDTO joinDTO); |
|
76 | 79 |
|
77 | 80 |
/** |
78 |
- * @author : 박정하 |
|
79 |
- * @since : 2024.07.03 |
|
81 |
+ * @param mbrVO - 회원 정보 관련 VO |
|
82 |
+ * @return String - 로그인 아이디 |
|
80 | 83 |
* |
81 | 84 |
* 아이디 찾기 (로그인 아이디) |
82 | 85 |
*/ |
83 |
- public String lgnIdSearch(MberVO mbrVO) throws Exception; |
|
86 |
+ public String lgnIdSearch(MberVO mbrVO); |
|
84 | 87 |
|
85 | 88 |
/** |
86 |
- * @author : 박정하 |
|
87 |
- * @since : 2024.07.03 |
|
89 |
+ * @param admMbrDTO - 회원정보 관련 DTO |
|
90 |
+ * @return String - 회원 아이디 |
|
88 | 91 |
* |
89 |
- * 아이디 찾기 (멤버 아이디) |
|
92 |
+ * 아이디 찾기 (회원 아이디) |
|
90 | 93 |
*/ |
91 |
- public String mbrIdSearch(AdmMbrDTO admMbrDTO) throws Exception; |
|
94 |
+ public String mbrIdSearch(AdmMbrDTO admMbrDTO); |
|
92 | 95 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/dao/LgnHstryDAO.java
+++ src/main/java/com/takensoft/cms/mber/dao/LgnHstryDAO.java
... | ... | @@ -8,33 +8,37 @@ |
8 | 8 |
import java.util.List; |
9 | 9 |
|
10 | 10 |
/** |
11 |
- * @author : takensoft |
|
12 |
- * @since : 2024.04.09 |
|
11 |
+ * @author takensoft |
|
12 |
+ * @since 2024.04.09 |
|
13 |
+ * @modification |
|
14 |
+ * since | author | description |
|
15 |
+ * 2024.04.09 | takensoft | 최초 등록 |
|
13 | 16 |
* |
14 | 17 |
* 로그인 이력 관련 Mapper |
15 | 18 |
*/ |
16 | 19 |
@Mapper("lgnHstryDAO") |
17 | 20 |
public interface LgnHstryDAO { |
18 | 21 |
/** |
19 |
- * @author takensoft |
|
20 |
- * @since 2024.04.09 |
|
22 |
+ * @param lgnHstryVO - 로그인 이력 정보 관련 VO |
|
23 |
+ * @return int - 로그인 이력 등록 결과 |
|
24 |
+ * |
|
21 | 25 |
* 로그인 이력 등록 |
22 | 26 |
*/ |
23 | 27 |
int save(LgnHstryVO lgnHstryVO); |
24 | 28 |
|
25 | 29 |
/** |
26 |
- * @author : 박정하 |
|
27 |
- * @since : 2024.05.13 |
|
30 |
+ * @param pagination - 페이징 정보 |
|
31 |
+ * @return int - 로그인 이력 등록 결과 |
|
28 | 32 |
* |
29 |
- * 로그인 이력 목록 갯수 |
|
33 |
+ * 로그인 이력 등록 |
|
30 | 34 |
*/ |
31 |
- public int selectLgnHstryListCnt(Pagination pagination) throws Exception; |
|
35 |
+ public int selectLgnHstryListCnt(Pagination pagination); |
|
32 | 36 |
|
33 | 37 |
/** |
34 |
- * @author : 박정하 |
|
35 |
- * @since : 2024.05.13 |
|
38 |
+ * @param pagination - 페이징 정보 |
|
39 |
+ * @return List<LgnHstryVO> - 로그인 이력 목록 조회 결과 |
|
36 | 40 |
* |
37 | 41 |
* 로그인 이력 목록 조회 |
38 | 42 |
*/ |
39 |
- public List<LgnHstryVO> selectLgnHstryList(Pagination pagination) throws Exception; |
|
43 |
+ public List<LgnHstryVO> selectLgnHstryList(Pagination pagination); |
|
40 | 44 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/dao/MberDAO.java
+++ src/main/java/com/takensoft/cms/mber/dao/MberDAO.java
... | ... | @@ -8,53 +8,61 @@ |
8 | 8 |
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
9 | 9 |
|
10 | 10 |
import java.util.*; |
11 |
- |
|
12 | 11 |
/** |
13 |
- * @author : takensoft |
|
14 |
- * @since : 2024.04.01 |
|
12 |
+ * @author takensoft |
|
13 |
+ * @since 2024.04.01 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
15 | 17 |
* |
16 | 18 |
* 회원 정보 관련 Mapper |
17 | 19 |
*/ |
18 | 20 |
@Mapper("mberDAO") |
19 | 21 |
public interface MberDAO { |
20 | 22 |
/** |
21 |
- * @author takensoft |
|
22 |
- * @since 2024.04.03 |
|
23 |
+ * @param lgnId - 로그인 아이디 |
|
24 |
+ * @return MberVO - 사용자 정보 조회 결과 |
|
25 |
+ * |
|
23 | 26 |
* 사용자 정보 조회 [security 용] |
24 | 27 |
*/ |
25 | 28 |
MberVO findByMberSecurity(String lgnId); |
26 | 29 |
|
27 | 30 |
/** |
28 |
- * @author takensoft |
|
29 |
- * @since 2024.04.03 |
|
31 |
+ * @param lgnId - 로그인 아이디 |
|
32 |
+ * @return boolean - 아이디 중복 여부 |
|
33 |
+ * |
|
30 | 34 |
* 아이디 중복 검사 |
31 | 35 |
*/ |
32 | 36 |
boolean findByCheckLoginId(String lgnId); |
33 | 37 |
|
34 | 38 |
/** |
35 |
- * @author takensoft |
|
36 |
- * @since 2024.04.03 |
|
39 |
+ * @param joinDTO - 회원 가입 관련 DTO |
|
40 |
+ * @return int - 회원가입 결과 |
|
41 |
+ * |
|
37 | 42 |
* 회원가입 |
38 | 43 |
*/ |
39 | 44 |
int save(JoinDTO joinDTO); |
40 | 45 |
|
41 | 46 |
/** |
42 |
- * @author takensoft |
|
43 |
- * @since 2024.04.03 |
|
47 |
+ * @param mberAuthorVO - 사용자 권한 관련 VO |
|
48 |
+ * @return int - 사용자 권한 등록 결과 |
|
49 |
+ * |
|
44 | 50 |
* 사용자 권한 등록 |
45 | 51 |
*/ |
46 | 52 |
int authorSave(MberAuthorVO mberAuthorVO); |
47 | 53 |
|
48 | 54 |
/** |
49 |
- * @author takensoft |
|
50 |
- * @since 2024.04.15 |
|
55 |
+ * @param passwordDTO -비밀 번호 변경 관련 DTO |
|
56 |
+ * @return int - 비밀 번호 변경 결과 |
|
57 |
+ * |
|
51 | 58 |
* 비밀 번호 변경 |
52 | 59 |
*/ |
53 | 60 |
int updatePassword(PasswordDTO passwordDTO); |
54 | 61 |
|
55 | 62 |
/** |
56 |
- * @author takensoft |
|
57 |
- * @since 2024.04.15 |
|
63 |
+ * @param mbrId -회원 아이디 |
|
64 |
+ * @return MberVO - 사용자 정보 조회 결과 |
|
65 |
+ * |
|
58 | 66 |
* 사용자 정보 조회 |
59 | 67 |
*/ |
60 | 68 |
MberVO findByMber(String mbrId); |
--- src/main/java/com/takensoft/cms/mber/dao/RefreshTokenDAO.java
+++ src/main/java/com/takensoft/cms/mber/dao/RefreshTokenDAO.java
... | ... | @@ -6,37 +6,44 @@ |
6 | 6 |
/** |
7 | 7 |
* @author : takensoft |
8 | 8 |
* @since : 2024.04.01 |
9 |
+ * @modification |
|
10 |
+ * since | author | description |
|
11 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
9 | 12 |
* |
10 | 13 |
* RefreshToken 관련 Mapper |
14 |
+ * |
|
11 | 15 |
*/ |
12 | 16 |
@Mapper("refreshTokenDAO") |
13 | 17 |
public interface RefreshTokenDAO { |
14 | 18 |
|
15 | 19 |
/** |
16 |
- * @author takensoft |
|
17 |
- * @since 2024.04.04 |
|
20 |
+ * @param refreshVO - RefreshToken 정보 관련 VO |
|
21 |
+ * @return int - refresh token 등록 결과 |
|
22 |
+ * |
|
18 | 23 |
* refresh token 등록 |
19 | 24 |
*/ |
20 | 25 |
int save(RefreshVO refreshVO); |
21 | 26 |
|
22 | 27 |
/** |
23 |
- * @author takensoft |
|
24 |
- * @since 2024.04.04 |
|
28 |
+ * @param refreshVO - RefreshToken 정보 관련 VO |
|
29 |
+ * @return int - refresh token 삭제 결과 |
|
30 |
+ * |
|
25 | 31 |
* refresh token 삭제 |
26 | 32 |
*/ |
27 | 33 |
int deleteByRefresh(RefreshVO refreshVO); |
28 | 34 |
|
29 | 35 |
/** |
30 |
- * @author takensoft |
|
31 |
- * @since 2024.04.04 |
|
36 |
+ * @return int - 기한 만료된 refresh token 삭제 결과 |
|
37 |
+ * |
|
32 | 38 |
* 기한 만료된 refresh token 삭제 [ Schedule 용 ] |
33 | 39 |
*/ |
34 | 40 |
int cleanExpiredRefreshTokens(); |
35 | 41 |
|
36 | 42 |
/** |
37 |
- * @author takensoft |
|
38 |
- * @since 2024.04.17 |
|
39 |
- * refresh token 등록 유무 확인 |
|
43 |
+ * @param refreshVO - RefreshToken 정보 관련 VO |
|
44 |
+ * @return boolean - refresh token 등록 여부 |
|
45 |
+ * |
|
46 |
+ * refresh token 등록 여부 확인 |
|
40 | 47 |
*/ |
41 | 48 |
boolean findByCheckRefresh(RefreshVO refreshVO); |
42 | 49 |
} |
--- src/main/java/com/takensoft/cms/mber/dto/AdmMbrDTO.java
+++ src/main/java/com/takensoft/cms/mber/dto/AdmMbrDTO.java
... | ... | @@ -5,10 +5,12 @@ |
5 | 5 |
|
6 | 6 |
import java.util.ArrayList; |
7 | 7 |
import java.util.List; |
8 |
- |
|
9 | 8 |
/** |
10 | 9 |
* @author : 박정하 |
11 | 10 |
* @since : 2024.06.21 |
11 |
+ * @modification |
|
12 |
+ * since | author | description |
|
13 |
+ * 2024.06.21 | 박정하 | 코드 리펙토링 |
|
12 | 14 |
* |
13 | 15 |
* 회원정보 관련 DTO |
14 | 16 |
*/ |
... | ... | @@ -19,119 +21,33 @@ |
19 | 21 |
@Builder |
20 | 22 |
@ToString |
21 | 23 |
public class AdmMbrDTO { |
22 |
- /** |
|
23 |
- * 회원 아이디 |
|
24 |
- */ |
|
25 |
- private String mbrId; |
|
26 |
- /** |
|
27 |
- * 로그인 아이디 |
|
28 |
- */ |
|
29 |
- private String lgnId; |
|
30 |
- /** |
|
31 |
- * 회원 이름 |
|
32 |
- */ |
|
33 |
- private String mbrNm; |
|
34 |
- /** |
|
35 |
- * 닉네임 |
|
36 |
- */ |
|
37 |
- private String ncnm; |
|
38 |
- /** |
|
39 |
- * 비밀번호 |
|
40 |
- */ |
|
41 |
- private String pswd; |
|
42 |
- /** |
|
43 |
- * 휴대폰번호 |
|
44 |
- */ |
|
45 |
- private String mblTelno; |
|
46 |
- /** |
|
47 |
- * 전화번호 |
|
48 |
- */ |
|
49 |
- private String telno; |
|
50 |
- /** |
|
51 |
- * 이메일 |
|
52 |
- */ |
|
53 |
- private String eml; |
|
54 |
- /** |
|
55 |
- * 우편번호 |
|
56 |
- */ |
|
57 |
- private String zip; |
|
58 |
- /** |
|
59 |
- * 주소 |
|
60 |
- */ |
|
61 |
- private String addr; |
|
62 |
- /** |
|
63 |
- * 상세주소 |
|
64 |
- */ |
|
65 |
- private String daddr; |
|
66 |
- /** |
|
67 |
- * 회원상태 |
|
68 |
- * 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
69 |
- */ |
|
70 |
- private String mbrStts; |
|
71 |
- /** |
|
72 |
- * 사용여부 |
|
73 |
- */ |
|
74 |
- private String useYn; |
|
75 |
- /** |
|
76 |
- * 차단일 |
|
77 |
- */ |
|
78 |
- private String cntrlDt; |
|
79 |
- /** |
|
80 |
- * 차단사유 |
|
81 |
- */ |
|
82 |
- private String cntrlRsn; |
|
83 |
- /** |
|
84 |
- * 문자수신여부 |
|
85 |
- * 0: 거부, 1: 허용 |
|
86 |
- */ |
|
87 |
- private String smsRcptnAgreYn; |
|
88 |
- /** |
|
89 |
- * 이메일수신여부 |
|
90 |
- * 0: 거부, 1: 허용 |
|
91 |
- */ |
|
92 |
- private String emlRcptnAgreYn; |
|
93 |
- /** |
|
94 |
- * 개인정보공개여부 |
|
95 |
- * 0: 거부, 1: 허용 |
|
96 |
- */ |
|
97 |
- private String prvcRlsYn; |
|
98 |
- /** |
|
99 |
- * 회원형태 |
|
100 |
- * S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
101 |
- */ |
|
102 |
- private String mbrType; |
|
103 |
- /** |
|
104 |
- * 비밀번호 변경일 |
|
105 |
- */ |
|
106 |
- private String pswdChgDt; |
|
107 |
- /** |
|
108 |
- * 최초등록 아이디 |
|
109 |
- */ |
|
110 |
- private String frstRegIp; |
|
111 |
- /** |
|
112 |
- * 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 |
|
113 |
- * 0: 시스템, 1: 사용자 |
|
114 |
- */ |
|
115 |
- private String sysPvsnYn; |
|
116 |
- /** |
|
117 |
- * 등록자 |
|
118 |
- */ |
|
119 |
- private String rgtr; |
|
120 |
- /** |
|
121 |
- * 등록일 |
|
122 |
- */ |
|
123 |
- private String regDt; |
|
124 |
- /** |
|
125 |
- * 수정자 |
|
126 |
- */ |
|
127 |
- private String mdfr; |
|
128 |
- /** |
|
129 |
- * 수정일 |
|
130 |
- */ |
|
131 |
- private String mdfcnDt; |
|
132 |
- /** |
|
133 |
- * 권한 정보 |
|
134 |
- */ |
|
24 |
+ |
|
25 |
+ private String mbrId; // 회원 아이디 |
|
26 |
+ private String lgnId; // 로그인 아이디 |
|
27 |
+ private String mbrNm; // 회원 이름 |
|
28 |
+ private String ncnm; // 닉네임 |
|
29 |
+ private String pswd; // 비밀번호 |
|
30 |
+ private String mblTelno; // 휴대폰번호 |
|
31 |
+ private String telno; // 전화번호 |
|
32 |
+ private String eml; // 이메일 |
|
33 |
+ private String zip; // 우편번호 |
|
34 |
+ private String addr; // 주소 |
|
35 |
+ private String daddr; // 상세주소 |
|
36 |
+ private String mbrStts; // 회원상태 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
37 |
+ private String useYn; // 사용여부 |
|
38 |
+ private String cntrlDt; // 차단일 |
|
39 |
+ private String cntrlRsn; // 차단사유 |
|
40 |
+ private String smsRcptnAgreYn; // 문자수신여부 0: 거부, 1: 허용 |
|
41 |
+ private String emlRcptnAgreYn; // 이메일수신여부 0: 거부, 1: 허용 |
|
42 |
+ private String prvcRlsYn; // 개인정보공개여부 0: 거부, 1: 허용 |
|
43 |
+ private String mbrType; // 회원형태 S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
44 |
+ private String pswdChgDt; // 비밀번호 변경일 |
|
45 |
+ private String frstRegIp; // 최초등록 아이디 |
|
46 |
+ private String sysPvsnYn; // 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 0: 시스템, 1: 사용자 |
|
47 |
+ private String rgtr; // 등록자 |
|
48 |
+ private String regDt; // 등록일 |
|
49 |
+ private String mdfr; // 수정자 |
|
50 |
+ private String mdfcnDt; // 수정일 |
|
135 | 51 |
@Builder.Default |
136 |
- private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); |
|
52 |
+ private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); // 권한 정보 |
|
137 | 53 |
} |
--- src/main/java/com/takensoft/cms/mber/dto/JoinDTO.java
+++ src/main/java/com/takensoft/cms/mber/dto/JoinDTO.java
... | ... | @@ -8,10 +8,12 @@ |
8 | 8 |
import javax.validation.constraints.Size; |
9 | 9 |
import java.util.ArrayList; |
10 | 10 |
import java.util.List; |
11 |
- |
|
12 | 11 |
/** |
13 |
- * @author : takensoft |
|
14 |
- * @since : 2024.04.01 |
|
12 |
+ * @author takensoft |
|
13 |
+ * @since 2024.04.01 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
15 | 17 |
* |
16 | 18 |
* 회원 가입 관련 DTO |
17 | 19 |
*/ |
... | ... | @@ -22,125 +24,39 @@ |
22 | 24 |
@Builder |
23 | 25 |
@ToString |
24 | 26 |
public class JoinDTO { |
25 |
- /** |
|
26 |
- * 회원 아이디 |
|
27 |
- */ |
|
28 |
- private String mbrId; |
|
29 |
- /** |
|
30 |
- * 로그인 아이디 |
|
31 |
- */ |
|
27 |
+ |
|
28 |
+ private String mbrId; // 회원 아이디 |
|
32 | 29 |
@NotBlank(message = "로그인 아이디는 필수 입력 값입니다.") |
33 | 30 |
@Size(min = 5, max = 50) |
34 |
- private String lgnId; |
|
35 |
- /** |
|
36 |
- * 회원 이름 |
|
37 |
- */ |
|
31 |
+ private String lgnId; // 로그인 아이디 |
|
38 | 32 |
@NotBlank(message = "이름은 필수 입력 값입니다.") |
39 | 33 |
@Size(min = 2, max = 50) |
40 |
- private String mbrNm; |
|
41 |
- /** |
|
42 |
- * 닉네임 |
|
43 |
- */ |
|
44 |
- private String ncnm; |
|
45 |
- /** |
|
46 |
- * 비밀번호 |
|
47 |
- */ |
|
34 |
+ private String mbrNm; // 회원 이름 |
|
35 |
+ private String ncnm; // 닉네임 |
|
48 | 36 |
@NotBlank(message = "비밀번호는 필수 입력 값입니다.") |
49 |
- private String pswd; |
|
50 |
- /** |
|
51 |
- * 휴대폰번호 |
|
52 |
- */ |
|
53 |
- private String mblTelno; |
|
54 |
- /** |
|
55 |
- * 전화번호 |
|
56 |
- */ |
|
57 |
- private String telno; |
|
58 |
- /** |
|
59 |
- * 이메일 |
|
60 |
- */ |
|
37 |
+ private String pswd; // 비밀번호 |
|
38 |
+ private String mblTelno; // 휴대폰번호 |
|
39 |
+ private String telno; // 전화번호 |
|
61 | 40 |
@Email(message = "이메일 형식에 맞지 않습니다.") |
62 |
- private String eml; |
|
63 |
- /** |
|
64 |
- * 우편번호 |
|
65 |
- */ |
|
66 |
- private String zip; |
|
67 |
- /** |
|
68 |
- * 주소 |
|
69 |
- */ |
|
70 |
- private String addr; |
|
71 |
- /** |
|
72 |
- * 상세주소 |
|
73 |
- */ |
|
74 |
- private String daddr; |
|
75 |
- /** |
|
76 |
- * 회원상태 |
|
77 |
- * 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
78 |
- */ |
|
79 |
- private String mbrStts; |
|
80 |
- /** |
|
81 |
- * 사용여부 |
|
82 |
- */ |
|
83 |
- private String useYn; |
|
84 |
- /** |
|
85 |
- * 차단일 |
|
86 |
- */ |
|
87 |
- private String cntrlDt; |
|
88 |
- /** |
|
89 |
- * 차단사유 |
|
90 |
- */ |
|
91 |
- private String cntrlRsn; |
|
92 |
- /** |
|
93 |
- * 문자수신여부 |
|
94 |
- * 0: 거부, 1: 허용 |
|
95 |
- */ |
|
96 |
- private String smsRcptnAgreYn; |
|
97 |
- /** |
|
98 |
- * 이메일수신여부 |
|
99 |
- * 0: 거부, 1: 허용 |
|
100 |
- */ |
|
101 |
- private String emlRcptnAgreYn; |
|
102 |
- /** |
|
103 |
- * 개인정보공개여부 |
|
104 |
- * 0: 거부, 1: 허용 |
|
105 |
- */ |
|
106 |
- private String prvcRlsYn; |
|
107 |
- /** |
|
108 |
- * 회원형태 |
|
109 |
- * S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
110 |
- */ |
|
111 |
- private String mbrType; |
|
112 |
- /** |
|
113 |
- * 비밀번호 변경일 |
|
114 |
- */ |
|
115 |
- private String pswdChgDt; |
|
116 |
- /** |
|
117 |
- * 최초등록 아이디 |
|
118 |
- */ |
|
119 |
- private String frstRegIp; |
|
120 |
- /** |
|
121 |
- * 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 |
|
122 |
- * 0: 시스템, 1: 사용자 |
|
123 |
- */ |
|
124 |
- private String sysPvsnYn; |
|
125 |
- /** |
|
126 |
- * 등록자 |
|
127 |
- */ |
|
128 |
- private String rgtr; |
|
129 |
- /** |
|
130 |
- * 등록일 |
|
131 |
- */ |
|
132 |
- private String regDt; |
|
133 |
- /** |
|
134 |
- * 수정자 |
|
135 |
- */ |
|
136 |
- private String mdfr; |
|
137 |
- /** |
|
138 |
- * 수정일 |
|
139 |
- */ |
|
140 |
- private String mdfcnDt; |
|
141 |
- /** |
|
142 |
- * 권한 정보 |
|
143 |
- */ |
|
41 |
+ private String eml; // 이메일 |
|
42 |
+ private String zip; // 우편번호 |
|
43 |
+ private String addr; // 주소 |
|
44 |
+ private String daddr; // 상세주소 |
|
45 |
+ private String mbrStts; // 회원상태 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
46 |
+ private String useYn; // 사용여부 |
|
47 |
+ private String cntrlDt; // 차단일 |
|
48 |
+ private String cntrlRsn; //차단사유 |
|
49 |
+ private String smsRcptnAgreYn; // 문자수신여부 0: 거부, 1: 허용 |
|
50 |
+ private String emlRcptnAgreYn; // 이메일수신여부 0: 거부, 1: 허용 |
|
51 |
+ private String prvcRlsYn; // 개인정보공개여부 0: 거부, 1: 허용 |
|
52 |
+ private String mbrType; // 회원형태 S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
53 |
+ private String pswdChgDt; // 비밀번호 변경일 |
|
54 |
+ private String frstRegIp; // 최초등록 아이디 |
|
55 |
+ private String sysPvsnYn; // 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 0: 시스템, 1: 사용자 |
|
56 |
+ private String rgtr; // 등록자 |
|
57 |
+ private String regDt; // 등록일 |
|
58 |
+ private String mdfr; // 수정자 |
|
59 |
+ private String mdfcnDt; // 수정일 |
|
144 | 60 |
@Builder.Default |
145 |
- private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); |
|
61 |
+ private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); // 권한 정보 |
|
146 | 62 |
} |
--- src/main/java/com/takensoft/cms/mber/dto/LoginDTO.java
+++ src/main/java/com/takensoft/cms/mber/dto/LoginDTO.java
... | ... | @@ -6,10 +6,12 @@ |
6 | 6 |
import lombok.NoArgsConstructor; |
7 | 7 |
|
8 | 8 |
import javax.validation.constraints.NotNull; |
9 |
- |
|
10 | 9 |
/** |
11 | 10 |
* @author : takensoft |
12 | 11 |
* @since : 2024.04.01 |
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
13 | 15 |
* |
14 | 16 |
* 로그인 관련 DTO |
15 | 17 |
*/ |
... | ... | @@ -18,18 +20,10 @@ |
18 | 20 |
@NoArgsConstructor |
19 | 21 |
@Builder |
20 | 22 |
public class LoginDTO { |
21 |
- /** |
|
22 |
- * 로그인 아이디 |
|
23 |
- */ |
|
23 |
+ |
|
24 | 24 |
@NotNull |
25 |
- private String lgnId; |
|
26 |
- /** |
|
27 |
- * 비밀번호 |
|
28 |
- */ |
|
25 |
+ private String lgnId; // 로그인 아이디 |
|
29 | 26 |
@NotNull |
30 |
- private String pswd; |
|
31 |
- /** |
|
32 |
- * refreshToken 정보 |
|
33 |
- */ |
|
34 |
- private String refreshToken; |
|
27 |
+ private String pswd; // 비밀번호 |
|
28 |
+ private String refreshToken; // refreshToken 정보 |
|
35 | 29 |
} |
--- src/main/java/com/takensoft/cms/mber/dto/PasswordDTO.java
+++ src/main/java/com/takensoft/cms/mber/dto/PasswordDTO.java
... | ... | @@ -4,12 +4,14 @@ |
4 | 4 |
import lombok.*; |
5 | 5 |
|
6 | 6 |
import javax.validation.constraints.NotBlank; |
7 |
- |
|
8 | 7 |
/** |
9 | 8 |
* @author : takensoft |
10 | 9 |
* @since : 2024.04.01 |
10 |
+ * @modification |
|
11 |
+ * since | author | description |
|
12 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
11 | 13 |
* |
12 |
- * 비밀 번호 변경 |
|
14 |
+ * 비밀 번호 변경 관련 DTO |
|
13 | 15 |
*/ |
14 | 16 |
@Setter |
15 | 17 |
@Getter |
... | ... | @@ -18,20 +20,10 @@ |
18 | 20 |
@Builder |
19 | 21 |
@ToString |
20 | 22 |
public class PasswordDTO { |
21 |
- /** |
|
22 |
- * 회원 아이디 |
|
23 |
- */ |
|
24 |
- private String mbrId; |
|
25 | 23 |
|
26 |
- /** |
|
27 |
- * 비밀번호[현재 비밀번호] |
|
28 |
- */ |
|
24 |
+ private String mbrId; // 회원 아이디 |
|
29 | 25 |
@NotBlank(message = "비밀번호는 필수 입력 값입니다.") |
30 |
- private String pswd; |
|
31 |
- |
|
32 |
- /** |
|
33 |
- * 비밀번호[변경될 비밀번호] |
|
34 |
- */ |
|
26 |
+ private String pswd; // 비밀번호[현재 비밀번호] |
|
35 | 27 |
@NotBlank(message = "변경할 비밀번호는 필수 입력 값입니다.") |
36 |
- private String newPswd; |
|
28 |
+ private String newPswd; // 비밀번호[변경될 비밀번호] |
|
37 | 29 |
} |
--- src/main/java/com/takensoft/cms/mber/service/AdmMbrService.java
+++ src/main/java/com/takensoft/cms/mber/service/AdmMbrService.java
... | ... | @@ -5,60 +5,70 @@ |
5 | 5 |
import com.takensoft.cms.mber.vo.MberVO; |
6 | 6 |
|
7 | 7 |
import jakarta.servlet.http.HttpServletRequest; |
8 |
-import java.util.HashMap; |
|
8 |
+import org.springframework.dao.DataAccessException; |
|
9 | 9 |
|
10 |
+import java.util.HashMap; |
|
10 | 11 |
/** |
11 |
- * @author : 박정하 |
|
12 |
- * @since : 2024.06.21 |
|
12 |
+ * @author 박정하 |
|
13 |
+ * @since 2024.06.21 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2024.06.21 | 박정하 | 최초 등록 |
|
13 | 17 |
* |
14 | 18 |
* 회원정보 관련 인터페이스 |
15 | 19 |
*/ |
16 | 20 |
public interface AdmMbrService { |
17 | 21 |
/** |
18 |
- * @author : 박정하 |
|
19 |
- * @since : 2024.06.21 |
|
22 |
+ * @param params - 회원정보 |
|
23 |
+ * @return HashMap<String, Object> |
|
24 |
+ * - result : 회원정보 |
|
25 |
+ * - pagination : 페이징 정보 |
|
20 | 26 |
* |
21 | 27 |
* 회원정보 목록 조회 |
22 | 28 |
*/ |
23 |
- public HashMap<String, Object> mbrList(HashMap<String, String> params) throws Exception; |
|
29 |
+ public HashMap<String, Object> mbrList(HashMap<String, String> params); |
|
24 | 30 |
|
25 | 31 |
/** |
26 |
- * @author : 박정하 |
|
27 |
- * @since : 2024.06.21 |
|
32 |
+ * @param mbrId - 회원 아이디 |
|
33 |
+ * @return AdmMbrDTO - 회원정보 상세 조회 결과 |
|
28 | 34 |
* |
29 | 35 |
* 회원정보 상세 조회 |
30 | 36 |
*/ |
31 |
- public AdmMbrDTO mbrDetail(String mbrId) throws Exception; |
|
37 |
+ public AdmMbrDTO mbrDetail(String mbrId); |
|
32 | 38 |
|
33 | 39 |
/** |
34 |
- * @author : 박정하 |
|
35 |
- * @since : 2024.06.21 |
|
40 |
+ * @param admMbrDTO -회원정보 |
|
41 |
+ * @return int - 회원정보 수정 결과 |
|
36 | 42 |
* |
37 | 43 |
* 회원정보 수정 |
38 | 44 |
*/ |
39 |
- public int updateMbr(AdmMbrDTO admMbrDTO) throws Exception; |
|
45 |
+ public int updateMbr(AdmMbrDTO admMbrDTO); |
|
40 | 46 |
|
41 | 47 |
/** |
42 |
- * @author : 박정하 |
|
43 |
- * @since : 2024.06.21 |
|
48 |
+ * @param req - HTTP 요청 객체 |
|
49 |
+ * @param joinDTO -회원정보 |
|
50 |
+ * @return HashMap<String, Object> - 회원정보 등록 결과 |
|
51 |
+ * - mbrId : 회원 아이디 |
|
52 |
+ * - insertResult : 회원등록정보 결과 |
|
44 | 53 |
* |
45 | 54 |
* 회원정보 등록 |
46 | 55 |
*/ |
47 |
- public HashMap<String, Object> mbrInsert(HttpServletRequest req, JoinDTO joinDTO) throws Exception; |
|
56 |
+ public HashMap<String, Object> mbrInsert(HttpServletRequest req, JoinDTO joinDTO); |
|
48 | 57 |
|
49 | 58 |
/** |
50 |
- * @author : 박정하 |
|
51 |
- * @since : 2024.07.03 |
|
59 |
+ * @param mbrVO -회원정보 |
|
60 |
+ * @return String - 로그인 아이디 |
|
52 | 61 |
* |
53 | 62 |
* 아이디 찾기 (로그인 아이디) |
54 | 63 |
*/ |
55 |
- public String lgnIdSearch(MberVO mbrVO) throws Exception; |
|
64 |
+ public String lgnIdSearch(MberVO mbrVO); |
|
56 | 65 |
|
57 | 66 |
/** |
58 |
- * @author : 박정하 |
|
59 |
- * @since : 2024.07.03 |
|
67 |
+ * @param resetPswd -초기화비밀번호 |
|
68 |
+ * @param admMbrDTO -회원정보 |
|
69 |
+ * @return int - 회원정보 등록 결과 |
|
60 | 70 |
* |
61 |
- * 아이디 찾기 (멤버 아이디) |
|
71 |
+ * 아이디 찾기 (회원 아이디) |
|
62 | 72 |
*/ |
63 |
- public int mbrIdSearch(String resetPswd, AdmMbrDTO admMbrDTO) throws Exception; |
|
73 |
+ public int mbrIdSearch(String resetPswd, AdmMbrDTO admMbrDTO); |
|
64 | 74 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/service/Impl/AdmMbrServiceImpl.java
+++ src/main/java/com/takensoft/cms/mber/service/Impl/AdmMbrServiceImpl.java
... | ... | @@ -10,24 +10,27 @@ |
10 | 10 |
import com.takensoft.cms.mber.vo.MberVO; |
11 | 11 |
import com.takensoft.common.Pagination; |
12 | 12 |
import com.takensoft.common.idgen.service.IdgenService; |
13 |
-import com.takensoft.common.util.CommonUtils; |
|
13 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
14 | 14 |
import com.takensoft.common.util.JWTUtil; |
15 | 15 |
import com.takensoft.common.util.Secret; |
16 | 16 |
import lombok.RequiredArgsConstructor; |
17 | 17 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
18 |
+import org.springframework.dao.DataAccessException; |
|
18 | 19 |
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
19 | 20 |
import org.springframework.stereotype.Service; |
20 | 21 |
import org.springframework.transaction.annotation.Transactional; |
21 | 22 |
|
22 | 23 |
import jakarta.servlet.http.HttpServletRequest; |
24 |
+ |
|
23 | 25 |
import java.util.HashMap; |
24 | 26 |
import java.util.List; |
25 |
- |
|
26 | 27 |
/** |
27 |
- * @author : 박정하 |
|
28 |
- * @since : 2024.06.21 |
|
28 |
+ * @author 박정하 |
|
29 |
+ * @since 2024.06.21 |
|
30 |
+ * @modification |
|
31 |
+ * since | author | description |
|
32 |
+ * 2024.06.21 | 박정하 | 최초 등록 |
|
29 | 33 |
* |
30 |
- * 회원정보 관련 구현체 |
|
31 | 34 |
* EgovAbstractServiceImpl : 전자정부 상속 |
32 | 35 |
* AdmMbrService : 회원정보 인터페이스 상속 |
33 | 36 |
*/ |
... | ... | @@ -36,19 +39,24 @@ |
36 | 39 |
public class AdmMbrServiceImpl extends EgovAbstractServiceImpl implements AdmMbrService { |
37 | 40 |
private final JWTUtil jwtUtil; |
38 | 41 |
private final IdgenService mberIdgn; |
39 |
- private final CommonUtils commonUtils; |
|
42 |
+ private final HttpRequestUtil httpRequestUtil; |
|
40 | 43 |
private final BCryptPasswordEncoder bCryptPasswordEncoder; |
41 | 44 |
private final AdmMbrDAO admMbrDAO; |
42 | 45 |
private final MberService mbrService; |
43 | 46 |
|
44 | 47 |
/** |
45 |
- * @author : 박정하 |
|
46 |
- * @since : 2024.06.21 |
|
48 |
+ * @param params - 회원정보 |
|
49 |
+ * @return HashMap<String, Object> |
|
50 |
+ * - result : 회원정보 |
|
51 |
+ * - pagination : 페이징 정보 |
|
52 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
53 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
47 | 54 |
* |
48 | 55 |
* 회원정보 목록 조회 |
49 | 56 |
*/ |
50 | 57 |
@Override |
51 |
- public HashMap<String, Object> mbrList(HashMap<String, String> params) throws Exception { |
|
58 |
+ public HashMap<String, Object> mbrList(HashMap<String, String> params) { |
|
59 |
+ try { |
|
52 | 60 |
Pagination search = new Pagination(0, params); |
53 | 61 |
int cnt = admMbrDAO.mbrListCnt(search); |
54 | 62 |
|
... | ... | @@ -66,17 +74,25 @@ |
66 | 74 |
result.put("list", list); |
67 | 75 |
result.put("pagination", pagination); |
68 | 76 |
return result; |
77 |
+ } catch (DataAccessException dae) { |
|
78 |
+ throw dae; |
|
79 |
+ } catch (Exception e) { |
|
80 |
+ throw e; |
|
81 |
+ } |
|
69 | 82 |
|
70 | 83 |
} |
71 | 84 |
|
72 | 85 |
/** |
73 |
- * @author : 박정하 |
|
74 |
- * @since : 2024.06.21 |
|
86 |
+ * @param mbrId - 회원 아이디 |
|
87 |
+ * @return AdmMbrDTO - 회원정보 상세 조회 결과 |
|
88 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
89 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
75 | 90 |
* |
76 | 91 |
* 회원정보 상세 조회 |
77 | 92 |
*/ |
78 | 93 |
@Override |
79 |
- public AdmMbrDTO mbrDetail(String mbrId) throws Exception { |
|
94 |
+ public AdmMbrDTO mbrDetail(String mbrId){ |
|
95 |
+ try { |
|
80 | 96 |
AdmMbrDTO admMbrDTO = new AdmMbrDTO(); |
81 | 97 |
|
82 | 98 |
// mbrId가 있는 경우 |
... | ... | @@ -100,19 +116,26 @@ |
100 | 116 |
admMbrDTO.setSmsRcptnAgreYn("Y"); |
101 | 117 |
admMbrDTO.setEmlRcptnAgreYn("Y"); |
102 | 118 |
} |
103 |
- |
|
104 | 119 |
return admMbrDTO; |
120 |
+ } catch (DataAccessException dae) { |
|
121 |
+ throw dae; |
|
122 |
+ } catch (Exception e) { |
|
123 |
+ throw e; |
|
124 |
+ } |
|
105 | 125 |
} |
106 | 126 |
|
107 | 127 |
/** |
108 |
- * @author : 박정하 |
|
109 |
- * @since : 2024.06.21 |
|
128 |
+ * @param admMbrDTO -회원정보 |
|
129 |
+ * @return int - 회원정보 수정 결과 |
|
130 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
131 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
110 | 132 |
* |
111 | 133 |
* 회원정보 수정 |
112 | 134 |
*/ |
113 | 135 |
@Override |
114 | 136 |
@Transactional(rollbackFor = Exception.class) |
115 |
- public int updateMbr(AdmMbrDTO admMbrDTO) throws Exception { |
|
137 |
+ public int updateMbr(AdmMbrDTO admMbrDTO){ |
|
138 |
+ try { |
|
116 | 139 |
// 비밀번호 변경 |
117 | 140 |
if (admMbrDTO.getPswd() != null && !admMbrDTO.getPswd().equals("")) { |
118 | 141 |
PasswordDTO passwordDTO = new PasswordDTO(); |
... | ... | @@ -147,89 +170,121 @@ |
147 | 170 |
} |
148 | 171 |
} |
149 | 172 |
} |
150 |
- |
|
151 | 173 |
return result; |
174 |
+ } catch (DataAccessException dae) { |
|
175 |
+ throw dae; |
|
176 |
+ } catch (Exception e) { |
|
177 |
+ throw e; |
|
178 |
+ } |
|
152 | 179 |
} |
153 | 180 |
|
154 |
- /** |
|
155 |
- * @author : 박정하 |
|
156 |
- * @since : 2024.06.21 |
|
157 |
- * |
|
158 |
- * 회원정보 등록 |
|
159 |
- */ |
|
160 |
- @Override |
|
161 |
- @Transactional(rollbackFor = Exception.class) |
|
162 |
- public HashMap<String, Object> mbrInsert(HttpServletRequest req, JoinDTO joinDTO) throws Exception { |
|
163 |
- // 회원 아이디 생성 |
|
164 |
- String mbrId = mberIdgn.getNextStringId(); |
|
165 |
- joinDTO.setMbrId(mbrId); |
|
181 |
+ /** |
|
182 |
+ * @param req - HTTP 요청 객체 |
|
183 |
+ * @param joinDTO -회원정보 |
|
184 |
+ * @return HashMap<String, Object> - 회원정보 등록 결과 |
|
185 |
+ * - mbrId : 회원 아이디 |
|
186 |
+ * - insertResult : 회원등록정보 결과 |
|
187 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
188 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
189 |
+ * |
|
190 |
+ * 회원정보 등록 |
|
191 |
+ */ |
|
192 |
+ @Override |
|
193 |
+ @Transactional(rollbackFor = Exception.class) |
|
194 |
+ public HashMap<String, Object> mbrInsert(HttpServletRequest req, JoinDTO joinDTO){ |
|
195 |
+ try { |
|
196 |
+ // 회원 아이디 생성 |
|
197 |
+ String mbrId = mberIdgn.getNextStringId(); |
|
198 |
+ joinDTO.setMbrId(mbrId); |
|
166 | 199 |
|
167 |
- // 비밀번호 암호화 |
|
168 |
- joinDTO.setPswd(bCryptPasswordEncoder.encode(joinDTO.getPswd())); |
|
200 |
+ // 비밀번호 암호화 |
|
201 |
+ joinDTO.setPswd(bCryptPasswordEncoder.encode(joinDTO.getPswd())); |
|
169 | 202 |
|
170 |
- // 연락처 암호화 |
|
171 |
- if(joinDTO.getMblTelno() != null && !joinDTO.getMblTelno().equals("")) { |
|
172 |
- joinDTO.setMblTelno(Secret.encrypt(joinDTO.getMblTelno())); |
|
173 |
- } |
|
174 |
- if(joinDTO.getTelno() != null && !joinDTO.getTelno().equals("")) { |
|
175 |
- joinDTO.setTelno(Secret.encrypt(joinDTO.getTelno())); |
|
176 |
- } |
|
203 |
+ // 연락처 암호화 |
|
204 |
+ if(joinDTO.getMblTelno() != null && !joinDTO.getMblTelno().equals("")) { |
|
205 |
+ joinDTO.setMblTelno(Secret.encrypt(joinDTO.getMblTelno())); |
|
206 |
+ } |
|
207 |
+ if(joinDTO.getTelno() != null && !joinDTO.getTelno().equals("")) { |
|
208 |
+ joinDTO.setTelno(Secret.encrypt(joinDTO.getTelno())); |
|
209 |
+ } |
|
177 | 210 |
|
178 |
- // 아이피 등록 |
|
179 |
- String ip = commonUtils.getIp(req); |
|
180 |
- joinDTO.setFrstRegIp(ip); |
|
211 |
+ // 아이피 등록 |
|
212 |
+ String ip = httpRequestUtil.getIp(req); |
|
213 |
+ joinDTO.setFrstRegIp(ip); |
|
181 | 214 |
|
182 |
- // 작성자 등록 |
|
183 |
- String writer = jwtUtil.getWriter(); |
|
184 |
- if(writer != null && !writer.equals("")) { |
|
185 |
- joinDTO.setRgtr(writer); |
|
186 |
- } |
|
215 |
+ // 작성자 등록 |
|
216 |
+ String writer = jwtUtil.getWriter(); |
|
217 |
+ if(writer != null && !writer.equals("")) { |
|
218 |
+ joinDTO.setRgtr(writer); |
|
219 |
+ } |
|
187 | 220 |
|
188 |
- // 회원정보 등록 |
|
189 |
- int insertResult = admMbrDAO.mbrInsert(joinDTO); |
|
221 |
+ // 회원정보 등록 |
|
222 |
+ int insertResult = admMbrDAO.mbrInsert(joinDTO); |
|
190 | 223 |
|
191 |
- // 권한 등록 |
|
192 |
- if(joinDTO.getAuthorList().size() > 0) { |
|
193 |
- for(MberAuthorVO mberAuthorVO : joinDTO.getAuthorList()) { |
|
194 |
- mberAuthorVO.setMbrId(joinDTO.getMbrId()); |
|
195 |
- mberAuthorVO.setRgtr(writer); |
|
196 |
- insertResult += admMbrDAO.insertAuthor(mberAuthorVO); |
|
224 |
+ // 권한 등록 |
|
225 |
+ if(joinDTO.getAuthorList().size() > 0) { |
|
226 |
+ for(MberAuthorVO mberAuthorVO : joinDTO.getAuthorList()) { |
|
227 |
+ mberAuthorVO.setMbrId(joinDTO.getMbrId()); |
|
228 |
+ mberAuthorVO.setRgtr(writer); |
|
229 |
+ insertResult += admMbrDAO.insertAuthor(mberAuthorVO); |
|
230 |
+ } |
|
231 |
+ } |
|
232 |
+ |
|
233 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
234 |
+ result.put("mbrId", mbrId); |
|
235 |
+ result.put("insertResult", insertResult); |
|
236 |
+ return result; |
|
237 |
+ } catch (DataAccessException dae) { |
|
238 |
+ throw dae; |
|
239 |
+ } catch (Exception e) { |
|
240 |
+ throw e; |
|
197 | 241 |
} |
198 | 242 |
} |
199 | 243 |
|
200 |
- HashMap<String, Object> result = new HashMap<>(); |
|
201 |
- result.put("mbrId", mbrId); |
|
202 |
- result.put("insertResult", insertResult); |
|
203 |
- return result; |
|
204 |
- } |
|
205 |
- |
|
206 | 244 |
/** |
207 |
- * @author : 박정하 |
|
208 |
- * @since : 2024.07.03 |
|
245 |
+ * @param mbrVO -회원정보 |
|
246 |
+ * @return String - 로그인 아이디 |
|
247 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
248 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
209 | 249 |
* |
210 | 250 |
* 아이디 찾기 (로그인 아이디) |
211 | 251 |
*/ |
212 |
- public String lgnIdSearch(MberVO mbrVO) throws Exception { |
|
213 |
- return admMbrDAO.lgnIdSearch(mbrVO); |
|
252 |
+ public String lgnIdSearch(MberVO mbrVO){ |
|
253 |
+ try { |
|
254 |
+ return admMbrDAO.lgnIdSearch(mbrVO); |
|
255 |
+ } catch (DataAccessException dae) { |
|
256 |
+ throw dae; |
|
257 |
+ } catch (Exception e) { |
|
258 |
+ throw e; |
|
259 |
+ } |
|
214 | 260 |
} |
215 | 261 |
|
216 | 262 |
/** |
217 |
- * @author : 박정하 |
|
218 |
- * @since : 2024.07.03 |
|
263 |
+ * @param resetPswd -초기화비밀번호 |
|
264 |
+ * @param admMbrDTO -회원정보 |
|
265 |
+ * @return int - 회원정보 등록 결과 |
|
266 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
267 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
219 | 268 |
* |
220 |
- * 아이디 찾기 (멤버 아이디) |
|
269 |
+ * 아이디 찾기 (회원 아이디) |
|
221 | 270 |
*/ |
222 |
- public int mbrIdSearch(String resetPswd, AdmMbrDTO admMbrDTO) throws Exception { |
|
223 |
- String mbrId = admMbrDAO.mbrIdSearch(admMbrDTO); |
|
271 |
+ public int mbrIdSearch(String resetPswd, AdmMbrDTO admMbrDTO){ |
|
272 |
+ try { |
|
273 |
+ String mbrId = admMbrDAO.mbrIdSearch(admMbrDTO); |
|
224 | 274 |
|
225 |
- PasswordDTO passwordDTO = new PasswordDTO(); |
|
226 |
- passwordDTO.setMbrId(mbrId); |
|
227 |
- passwordDTO.setPswd(admMbrDTO.getPswd()); |
|
228 |
- passwordDTO.setNewPswd(resetPswd); |
|
275 |
+ PasswordDTO passwordDTO = new PasswordDTO(); |
|
276 |
+ passwordDTO.setMbrId(mbrId); |
|
277 |
+ passwordDTO.setPswd(admMbrDTO.getPswd()); |
|
278 |
+ passwordDTO.setNewPswd(resetPswd); |
|
229 | 279 |
|
230 |
- // 비밀번호 변경 |
|
231 |
- int result = mbrService.updatePassword(passwordDTO); |
|
280 |
+ // 비밀번호 변경 |
|
281 |
+ int result = mbrService.updatePassword(passwordDTO); |
|
232 | 282 |
|
233 |
- return result; |
|
283 |
+ return result; |
|
284 |
+ } catch (DataAccessException dae) { |
|
285 |
+ throw dae; |
|
286 |
+ } catch (Exception e) { |
|
287 |
+ throw e; |
|
288 |
+ } |
|
234 | 289 |
} |
235 | 290 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/service/Impl/LgnHstryServiceImpl.java
+++ src/main/java/com/takensoft/cms/mber/service/Impl/LgnHstryServiceImpl.java
... | ... | @@ -13,18 +13,22 @@ |
13 | 13 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
14 | 14 |
import org.slf4j.Logger; |
15 | 15 |
import org.slf4j.LoggerFactory; |
16 |
+import org.springframework.dao.DataAccessException; |
|
16 | 17 |
import org.springframework.stereotype.Service; |
17 | 18 |
|
18 | 19 |
import java.util.HashMap; |
19 | 20 |
import java.util.List; |
20 |
- |
|
21 | 21 |
/** |
22 |
- * @author : takensoft |
|
23 |
- * @since : 2024.04.09 |
|
22 |
+ * @author takensoft |
|
23 |
+ * @since 2024.04.09 |
|
24 |
+ * @modification |
|
25 |
+ * since | author | description |
|
26 |
+ * 2024.04.09 | takensoft | 최초 등록 |
|
24 | 27 |
* |
25 | 28 |
* 로그인 이력 정보 관련 구현체 |
26 | 29 |
* EgovAbstractServiceImpl : 전자정부 상속 |
27 | 30 |
* LgnHstryService : 로그인 이력 정보 인터페이스 상속 |
31 |
+ * |
|
28 | 32 |
*/ |
29 | 33 |
@Service("lgnHstryService") |
30 | 34 |
@RequiredArgsConstructor |
... | ... | @@ -33,34 +37,56 @@ |
33 | 37 |
private final CodeManageService codeManageService; |
34 | 38 |
|
35 | 39 |
/** |
36 |
- * @author takensoft |
|
37 |
- * @since 2024.04.09 |
|
40 |
+ * @param lgnHstryVO - 로그인 이력 정보 |
|
41 |
+ * @return int - 로그인 이력 결과 |
|
42 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
43 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
44 |
+ * |
|
38 | 45 |
* 로그인 이력 등록 |
39 | 46 |
*/ |
40 | 47 |
@Override |
41 |
- public int LgnHstrySave(LgnHstryVO lgnHstryVO) throws Exception { |
|
42 |
- return lgnHstryDAO.save(lgnHstryVO); |
|
48 |
+ public int LgnHstrySave(LgnHstryVO lgnHstryVO){ |
|
49 |
+ try { |
|
50 |
+ int result = lgnHstryDAO.save(lgnHstryVO); |
|
51 |
+ |
|
52 |
+ return result; |
|
53 |
+ } catch (DataAccessException dae) { |
|
54 |
+ throw dae; |
|
55 |
+ } catch (Exception e) { |
|
56 |
+ throw e; |
|
57 |
+ } |
|
43 | 58 |
} |
44 | 59 |
|
45 | 60 |
/** |
46 |
- * @author : 박정하 |
|
47 |
- * @since : 2024.05.13 |
|
61 |
+ * @param params -회원정보 |
|
62 |
+ * @return HashMap<String, Object> |
|
63 |
+ * - list : 로그인 이력 목록 |
|
64 |
+ * - pagination : 페이징 정보 |
|
65 |
+ * - codeList : 공통 코드 조회(로그인이력) |
|
66 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
67 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
48 | 68 |
* |
49 | 69 |
* 로그인 이력 목록 조회 |
50 | 70 |
*/ |
51 | 71 |
@Override |
52 |
- public HashMap<String, Object> lgnHstryList(HashMap<String, String> params) throws Exception { |
|
53 |
- Pagination search = new Pagination(0, params); |
|
54 |
- int cnt = lgnHstryDAO.selectLgnHstryListCnt(search); |
|
72 |
+ public HashMap<String, Object> lgnHstryList(HashMap<String, String> params){ |
|
73 |
+ try { |
|
74 |
+ Pagination search = new Pagination(0, params); |
|
75 |
+ int cnt = lgnHstryDAO.selectLgnHstryListCnt(search); |
|
55 | 76 |
|
56 |
- Pagination pagination = new Pagination(cnt, params); |
|
57 |
- List<LgnHstryVO> list = lgnHstryDAO.selectLgnHstryList(pagination); |
|
58 |
- List<CodeManageVO> codeList = codeManageService.findByChildCdCache("lgnHstry"); // 검색 조건 |
|
77 |
+ Pagination pagination = new Pagination(cnt, params); |
|
78 |
+ List<LgnHstryVO> list = lgnHstryDAO.selectLgnHstryList(pagination); |
|
79 |
+ List<CodeManageVO> codeList = codeManageService.findByChildCdCache("lgnHstry"); // 검색 조건 |
|
59 | 80 |
|
60 |
- HashMap<String, Object> result = new HashMap<>(); |
|
61 |
- result.put("list", list); |
|
62 |
- result.put("pagination", pagination); |
|
63 |
- result.put("codeList", codeList); |
|
64 |
- return result; |
|
81 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
82 |
+ result.put("list", list); |
|
83 |
+ result.put("pagination", pagination); |
|
84 |
+ result.put("codeList", codeList); |
|
85 |
+ return result; |
|
86 |
+ } catch (DataAccessException dae) { |
|
87 |
+ throw dae; |
|
88 |
+ } catch (Exception e) { |
|
89 |
+ throw e; |
|
90 |
+ } |
|
65 | 91 |
} |
66 | 92 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/service/Impl/MberServiceImpl.java
+++ src/main/java/com/takensoft/cms/mber/service/Impl/MberServiceImpl.java
... | ... | @@ -7,11 +7,12 @@ |
7 | 7 |
import com.takensoft.cms.mber.vo.MberAuthorVO; |
8 | 8 |
import com.takensoft.cms.mber.vo.MberVO; |
9 | 9 |
import com.takensoft.common.idgen.service.IdgenService; |
10 |
-import com.takensoft.common.util.CommonUtils; |
|
10 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
11 | 11 |
import com.takensoft.common.util.JWTUtil; |
12 | 12 |
import com.takensoft.common.util.Secret; |
13 | 13 |
import lombok.RequiredArgsConstructor; |
14 | 14 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
15 |
+import org.springframework.dao.DataAccessException; |
|
15 | 16 |
import org.springframework.security.core.userdetails.UserDetails; |
16 | 17 |
import org.springframework.security.core.userdetails.UserDetailsService; |
17 | 18 |
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
... | ... | @@ -20,11 +21,14 @@ |
20 | 21 |
import org.springframework.transaction.annotation.Transactional; |
21 | 22 |
|
22 | 23 |
import jakarta.servlet.http.HttpServletRequest; |
23 |
-import java.util.HashMap; |
|
24 | 24 |
|
25 |
+import java.util.HashMap; |
|
25 | 26 |
/** |
26 |
- * @author : takensoft |
|
27 |
- * @since : 2024.04.01 |
|
27 |
+ * @author takensoft |
|
28 |
+ * @since 2024.04.01 |
|
29 |
+ * @modification |
|
30 |
+ * since | author | description |
|
31 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
28 | 32 |
* |
29 | 33 |
* 회원 정보 관련 구현체 |
30 | 34 |
* EgovAbstractServiceImpl : 전자정부 상속 |
... | ... | @@ -38,112 +42,146 @@ |
38 | 42 |
private final IdgenService mberIdgn; |
39 | 43 |
private final BCryptPasswordEncoder bCryptPasswordEncoder; |
40 | 44 |
private final JWTUtil jwtUtil; |
41 |
- private final CommonUtils commonUtils; |
|
45 |
+ private final HttpRequestUtil httpRequestUtil; |
|
42 | 46 |
|
43 | 47 |
/** |
44 |
- * @author takensoft |
|
45 |
- * @since 2024.04.03 |
|
48 |
+ * @param username -회원이름 |
|
49 |
+ * @return UserDetails - Spring Security에서 사용자의 정보를 담는 인터페이스 |
|
50 |
+ * @throws UsernameNotFoundException - 가입하지 않은 계정으로 로그인 시도 시 |
|
51 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
46 | 52 |
* |
47 | 53 |
* security 상속 시 Override 하는 메소드 |
48 | 54 |
*/ |
49 | 55 |
@Override |
50 | 56 |
@Transactional(readOnly = true) |
51 |
- public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
|
52 |
- return mberDAO.findByMberSecurity(username); |
|
53 |
- } |
|
57 |
+ public UserDetails loadUserByUsername(String username){ |
|
58 |
+ try { |
|
59 |
+ UserDetails userDetails = mberDAO.findByMberSecurity(username); |
|
54 | 60 |
|
61 |
+ return userDetails; |
|
62 |
+ } catch (UsernameNotFoundException Unfe) { |
|
63 |
+ throw Unfe; |
|
64 |
+ } catch (Exception e) { |
|
65 |
+ throw e; |
|
66 |
+ } |
|
67 |
+ } |
|
55 | 68 |
/** |
56 |
- * @author takensoft |
|
57 |
- * @since 2024.04.03 |
|
69 |
+ * @param lgnId - 로그인 아이디 |
|
70 |
+ * @return boolean - 아이디 아이디 중복 여부 |
|
58 | 71 |
* |
59 | 72 |
* 아이디 중복 검사 |
60 | 73 |
*/ |
61 | 74 |
@Override |
62 |
- public boolean findByCheckLoginId(String lgnId) throws Exception { |
|
75 |
+ public boolean findByCheckLoginId(String lgnId) { |
|
63 | 76 |
return mberDAO.findByCheckLoginId(lgnId); |
64 | 77 |
} |
65 | 78 |
|
66 | 79 |
/** |
67 |
- * @author takensoft |
|
68 |
- * @since 2024.04.03 |
|
80 |
+ * @param req - HTTP 요청 객체 |
|
81 |
+ * @param joinDTO -회원정보 |
|
82 |
+ * @return HashMap<String, Object> - 회원정보 등록 결과 |
|
83 |
+ * - mbrId : 회원 아이디 |
|
84 |
+ * - result : 회원등록정보 결과 |
|
85 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
86 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
87 |
+ * |
|
69 | 88 |
* 회원가입 |
70 | 89 |
*/ |
71 | 90 |
@Override |
72 | 91 |
@Transactional(rollbackFor = Exception.class) |
73 |
- public HashMap<String, Object> userJoin(HttpServletRequest req, JoinDTO joinDTO) throws Exception { |
|
74 |
- // 회원 아이디 생성 |
|
75 |
- String mbrId = mberIdgn.getNextStringId(); |
|
76 |
- joinDTO.setMbrId(mbrId); |
|
92 |
+ public HashMap<String, Object> userJoin(HttpServletRequest req, JoinDTO joinDTO){ |
|
93 |
+ try { |
|
94 |
+ // 회원 아이디 생성 |
|
95 |
+ String mbrId = mberIdgn.getNextStringId(); |
|
96 |
+ joinDTO.setMbrId(mbrId); |
|
77 | 97 |
|
78 |
- // 비밀번호 암호화 |
|
79 |
- joinDTO.setPswd(bCryptPasswordEncoder.encode(joinDTO.getPswd())); |
|
98 |
+ // 비밀번호 암호화 |
|
99 |
+ joinDTO.setPswd(bCryptPasswordEncoder.encode(joinDTO.getPswd())); |
|
80 | 100 |
|
81 |
- // 연락처 암호화 |
|
82 |
- if(joinDTO.getMblTelno() != null && !joinDTO.getMblTelno().equals("")) { |
|
83 |
- joinDTO.setMblTelno(Secret.encrypt(joinDTO.getMblTelno())); |
|
84 |
- } |
|
85 |
- if(joinDTO.getTelno() != null && !joinDTO.getTelno().equals("")) { |
|
86 |
- joinDTO.setTelno(Secret.encrypt(joinDTO.getTelno())); |
|
87 |
- } |
|
88 |
- |
|
89 |
- // 아이피 조회 및 등록 |
|
90 |
- joinDTO.setFrstRegIp(commonUtils.getIp(req)); |
|
91 |
- |
|
92 |
- // 작성자 조회 및 등록 |
|
93 |
- if(jwtUtil.getWriter() != null && !jwtUtil.getWriter().equals("")) { |
|
94 |
- joinDTO.setRgtr(jwtUtil.getWriter()); |
|
95 |
- } |
|
96 |
- |
|
97 |
- // 회원정보 등록 |
|
98 |
- HashMap<String, Object> result = new HashMap<>(); |
|
99 |
- int saveResult = mberDAO.save(joinDTO); |
|
100 |
- result.put("mbrId", mbrId); |
|
101 |
- |
|
102 |
- // 권한 등록 |
|
103 |
- int authorResult = 0; |
|
104 |
- if(joinDTO.getAuthorList().size() > 0) { |
|
105 |
- for(MberAuthorVO vo : joinDTO.getAuthorList()) { |
|
106 |
- vo.setMbrId(joinDTO.getMbrId()); |
|
107 |
- // 작성자 조회 및 등록 |
|
108 |
- if(jwtUtil.getWriter() != null && !jwtUtil.getWriter().equals("")) { |
|
109 |
- vo.setRgtr(jwtUtil.getWriter()); |
|
110 |
- } |
|
111 |
- authorResult += mberDAO.authorSave(vo); |
|
101 |
+ // 연락처 암호화 |
|
102 |
+ if(joinDTO.getMblTelno() != null && !joinDTO.getMblTelno().equals("")) { |
|
103 |
+ joinDTO.setMblTelno(Secret.encrypt(joinDTO.getMblTelno())); |
|
112 | 104 |
} |
113 |
- } |
|
114 |
- result.put("result", saveResult + authorResult); |
|
105 |
+ if(joinDTO.getTelno() != null && !joinDTO.getTelno().equals("")) { |
|
106 |
+ joinDTO.setTelno(Secret.encrypt(joinDTO.getTelno())); |
|
107 |
+ } |
|
115 | 108 |
|
116 |
- return result; |
|
109 |
+ // 아이피 조회 및 등록 |
|
110 |
+ joinDTO.setFrstRegIp(httpRequestUtil.getIp(req)); |
|
111 |
+ |
|
112 |
+ // 작성자 조회 및 등록 |
|
113 |
+ if(jwtUtil.getWriter() != null && !jwtUtil.getWriter().equals("")) { |
|
114 |
+ joinDTO.setRgtr(jwtUtil.getWriter()); |
|
115 |
+ } |
|
116 |
+ |
|
117 |
+ // 회원정보 등록 |
|
118 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
119 |
+ int saveResult = mberDAO.save(joinDTO); |
|
120 |
+ result.put("mbrId", mbrId); |
|
121 |
+ |
|
122 |
+ // 권한 등록 |
|
123 |
+ int authorResult = 0; |
|
124 |
+ if(joinDTO.getAuthorList().size() > 0) { |
|
125 |
+ for(MberAuthorVO vo : joinDTO.getAuthorList()) { |
|
126 |
+ vo.setMbrId(joinDTO.getMbrId()); |
|
127 |
+ // 작성자 조회 및 등록 |
|
128 |
+ if(jwtUtil.getWriter() != null && !jwtUtil.getWriter().equals("")) { |
|
129 |
+ vo.setRgtr(jwtUtil.getWriter()); |
|
130 |
+ } |
|
131 |
+ authorResult += mberDAO.authorSave(vo); |
|
132 |
+ } |
|
133 |
+ } |
|
134 |
+ result.put("result", saveResult + authorResult); |
|
135 |
+ |
|
136 |
+ return result; |
|
137 |
+ } catch (DataAccessException dae) { |
|
138 |
+ throw dae; |
|
139 |
+ } catch (Exception e) { |
|
140 |
+ throw e; |
|
141 |
+ } |
|
117 | 142 |
} |
118 | 143 |
|
119 | 144 |
/** |
120 |
- * @author takensoft |
|
121 |
- * @since 2024.04.15 |
|
145 |
+ * @param passwordDTO - 비밀번호 |
|
146 |
+ * @return boolean - 비밀번호 사용 가능 여부 |
|
147 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
148 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
149 |
+ * |
|
122 | 150 |
* 비밀번호 비교 |
123 | 151 |
*/ |
124 | 152 |
@Override |
125 |
- public boolean passwordCheck(PasswordDTO passwordDTO) throws Exception { |
|
126 |
- // 회원 정보 호출 |
|
127 |
- MberVO mbr = mberDAO.findByMber(jwtUtil.getWriter()); |
|
128 |
- // 비밀번호 비교 후 성공 시 비밀번호 수정 후 true 반환 |
|
129 |
- if(bCryptPasswordEncoder.matches(passwordDTO.getPswd(), mbr.getPassword())) { |
|
130 |
- passwordDTO.setNewPswd(bCryptPasswordEncoder.encode(passwordDTO.getNewPswd())); |
|
131 |
- passwordDTO.setMbrId(mbr.getMbrId()); |
|
132 |
- mberDAO.updatePassword(passwordDTO); |
|
133 |
- return true; |
|
134 |
- // 기존 비밀번호와 입력한 비밀번호가 서로 다를 경우 false 반환 |
|
135 |
- } else { |
|
136 |
- return false; |
|
153 |
+ public boolean passwordCheck(PasswordDTO passwordDTO){ |
|
154 |
+ try { |
|
155 |
+ // 회원 정보 호출 |
|
156 |
+ MberVO mbr = mberDAO.findByMber(jwtUtil.getWriter()); |
|
157 |
+ // 비밀번호 비교 후 성공 시 비밀번호 수정 후 true 반환 |
|
158 |
+ if(bCryptPasswordEncoder.matches(passwordDTO.getPswd(), mbr.getPassword())) { |
|
159 |
+ passwordDTO.setNewPswd(bCryptPasswordEncoder.encode(passwordDTO.getNewPswd())); |
|
160 |
+ passwordDTO.setMbrId(mbr.getMbrId()); |
|
161 |
+ mberDAO.updatePassword(passwordDTO); |
|
162 |
+ return true; |
|
163 |
+ // 기존 비밀번호와 입력한 비밀번호가 서로 다를 경우 false 반환 |
|
164 |
+ } else { |
|
165 |
+ return false; |
|
166 |
+ } |
|
167 |
+ } catch (DataAccessException dae) { |
|
168 |
+ throw dae; |
|
169 |
+ } catch (Exception e) { |
|
170 |
+ throw e; |
|
137 | 171 |
} |
138 | 172 |
} |
139 |
- |
|
140 | 173 |
/** |
141 |
- * @author 박정하 |
|
142 |
- * @since 2024.04.23 |
|
174 |
+ * @param params |
|
175 |
+ * - 회원 아이디 |
|
176 |
+ * @return MberVO - 회원 정보 |
|
177 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
178 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
179 |
+ * |
|
143 | 180 |
* 회원정보 상세 조회 |
144 | 181 |
*/ |
145 | 182 |
@Override |
146 |
- public MberVO findByMbr(HashMap<String, Object> params) throws Exception { |
|
183 |
+ public MberVO findByMbr(HashMap<String, Object> params){ |
|
184 |
+ try { |
|
147 | 185 |
String mbrId = params.get("mbrId").toString(); |
148 | 186 |
MberVO mberVO = mberDAO.findByMber(mbrId); |
149 | 187 |
// 휴대폰번호 복호화 |
... | ... | @@ -155,15 +193,21 @@ |
155 | 193 |
mberVO.setTelno(Secret.decrypt(mberVO.getTelno().toString())); |
156 | 194 |
} |
157 | 195 |
return mberVO; |
196 |
+ } catch (DataAccessException dae) { |
|
197 |
+ throw dae; |
|
198 |
+ } catch (Exception e) { |
|
199 |
+ throw e; |
|
200 |
+ } |
|
158 | 201 |
} |
159 | 202 |
|
160 | 203 |
/** |
161 |
- * @author takensoft |
|
162 |
- * @since 2024.04.24 |
|
204 |
+ * @param passwordDTO - 비밀번호 |
|
205 |
+ * @return int - 비밀번호 수정 결과 |
|
206 |
+ * |
|
163 | 207 |
* 비밀번호 수정 |
164 | 208 |
*/ |
165 | 209 |
@Override |
166 |
- public int updatePassword(PasswordDTO passwordDTO) throws Exception { |
|
210 |
+ public int updatePassword(PasswordDTO passwordDTO) { |
|
167 | 211 |
passwordDTO.setNewPswd(bCryptPasswordEncoder.encode(passwordDTO.getNewPswd())); |
168 | 212 |
return mberDAO.updatePassword(passwordDTO); |
169 | 213 |
} |
--- src/main/java/com/takensoft/cms/mber/service/Impl/RefreshTokenServiceImpl.java
+++ src/main/java/com/takensoft/cms/mber/service/Impl/RefreshTokenServiceImpl.java
... | ... | @@ -1,12 +1,12 @@ |
1 | 1 |
package com.takensoft.cms.mber.service.Impl; |
2 | 2 |
|
3 |
-import com.fasterxml.jackson.datatype.jsr310.ser.YearSerializer; |
|
4 | 3 |
import com.takensoft.cms.mber.dao.RefreshTokenDAO; |
5 | 4 |
import com.takensoft.cms.mber.service.RefreshTokenService; |
6 | 5 |
import com.takensoft.cms.mber.vo.MberAuthorVO; |
7 | 6 |
import com.takensoft.cms.mber.vo.MberVO; |
8 | 7 |
import com.takensoft.cms.mber.vo.RefreshVO; |
9 |
-import com.takensoft.common.util.CommonUtils; |
|
8 |
+import com.takensoft.common.config.RedisConfig; |
|
9 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
10 | 10 |
import com.takensoft.common.util.JWTUtil; |
11 | 11 |
import io.jsonwebtoken.ExpiredJwtException; |
12 | 12 |
import lombok.RequiredArgsConstructor; |
... | ... | @@ -14,20 +14,26 @@ |
14 | 14 |
import org.slf4j.Logger; |
15 | 15 |
import org.slf4j.LoggerFactory; |
16 | 16 |
import org.springframework.beans.factory.annotation.Value; |
17 |
+import org.springframework.dao.DataAccessException; |
|
18 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
17 | 19 |
import org.springframework.stereotype.Service; |
18 | 20 |
import org.springframework.transaction.annotation.Transactional; |
19 | 21 |
|
20 | 22 |
import jakarta.servlet.http.Cookie; |
21 | 23 |
import jakarta.servlet.http.HttpServletRequest; |
22 | 24 |
import jakarta.servlet.http.HttpServletResponse; |
25 |
+ |
|
23 | 26 |
import java.util.Date; |
24 | 27 |
import java.util.HashMap; |
25 | 28 |
import java.util.List; |
26 | 29 |
import java.util.Map; |
27 | 30 |
|
28 | 31 |
/** |
29 |
- * @author : takensoft |
|
30 |
- * @since : 2024.04.01 |
|
32 |
+ * @author takensoft |
|
33 |
+ * @since 2024.04.01 |
|
34 |
+ * @modification |
|
35 |
+ * since | author | description |
|
36 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
31 | 37 |
* |
32 | 38 |
* RefreshToken 정보 관련 구현체 |
33 | 39 |
* EgovAbstractServiceImpl : 전자정부 상속 |
... | ... | @@ -40,7 +46,9 @@ |
40 | 46 |
private static final Logger LOGGER = LoggerFactory.getLogger(RefreshTokenServiceImpl.class); |
41 | 47 |
private final RefreshTokenDAO refreshTokenDAO; |
42 | 48 |
private final JWTUtil jwtUtil; |
43 |
- private final CommonUtils commonUtils; |
|
49 |
+ private final HttpRequestUtil httpRequestUtil; |
|
50 |
+ private final RedisConfig redisConfig; |
|
51 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
44 | 52 |
|
45 | 53 |
@Value("${jwt.accessTime}") |
46 | 54 |
private long JWT_ACCESSTIME; // access 토큰 유지 시간 |
... | ... | @@ -50,8 +58,11 @@ |
50 | 58 |
private int COOKIE_TIME; // 쿠키 유지 시간 |
51 | 59 |
|
52 | 60 |
/** |
53 |
- * @author takensoft |
|
54 |
- * @since 2024.04.04 |
|
61 |
+ * @param req - HTTP 요청 객체 |
|
62 |
+ * @return Map<String, Object> |
|
63 |
+ * - result : refresh token 검증 결과 |
|
64 |
+ * - refreshToken : refresh token |
|
65 |
+ * |
|
55 | 66 |
* refresh token 검증 |
56 | 67 |
*/ |
57 | 68 |
private Map<String, Object> refreshTokenCheck(HttpServletRequest req) { |
... | ... | @@ -86,112 +97,185 @@ |
86 | 97 |
} |
87 | 98 |
|
88 | 99 |
/** |
89 |
- * @author takensoft |
|
90 |
- * @since 2024.04.04 |
|
100 |
+ * @param req - HTTP 요청 객체 |
|
101 |
+ * @param res - HTTP 응답 객체 |
|
102 |
+ * @param refresh - RefreshToken 정보 |
|
103 |
+ * @param expiredMs - 토큰 만료 시간 (밀리초) |
|
104 |
+ * @return int - refresh token 등록결과 |
|
105 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
106 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
107 |
+ * |
|
91 | 108 |
* refresh token 등록 |
92 | 109 |
*/ |
93 | 110 |
@Override |
94 |
- public int saveRefreshToken(HttpServletRequest req, HttpServletResponse res, RefreshVO refresh, long expiredMs) throws Exception { |
|
95 |
- // 만료 시간 |
|
96 |
- refresh.setExpryDt(new Date(System.currentTimeMillis() + expiredMs)); |
|
97 |
- // 사용중인 아이피 |
|
98 |
- refresh.setUseIp(commonUtils.getIp(req)); |
|
99 |
- return refreshTokenDAO.save(refresh); |
|
111 |
+ public int saveRefreshToken(HttpServletRequest req, HttpServletResponse res, RefreshVO refresh, long expiredMs){ |
|
112 |
+ try { |
|
113 |
+ // 만료 시간 |
|
114 |
+ refresh.setExpryDt(new Date(System.currentTimeMillis() + expiredMs)); |
|
115 |
+ // 사용중인 아이피 |
|
116 |
+ refresh.setUseIp(httpRequestUtil.getIp(req)); |
|
117 |
+ |
|
118 |
+ int result = refreshTokenDAO.save(refresh); |
|
119 |
+ |
|
120 |
+ return result; |
|
121 |
+ } catch (DataAccessException dae) { |
|
122 |
+ throw dae; |
|
123 |
+ } catch (Exception e) { |
|
124 |
+ throw e; |
|
125 |
+ } |
|
100 | 126 |
} |
101 | 127 |
|
102 | 128 |
/** |
103 |
- * @author takensoft |
|
104 |
- * @since 2024.04.04 |
|
129 |
+ * @param req - HTTP 요청 객체 |
|
130 |
+ * @param res - HTTP 응답 객체 |
|
131 |
+ * @return int - refresh token 삭제 결과 |
|
132 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
133 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
134 |
+ * |
|
105 | 135 |
* refresh token 삭제 프로세스 (로그아웃) |
106 | 136 |
*/ |
107 | 137 |
@Override |
108 |
- public int deleteByRefresh(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
109 |
- // refresh token 검증 |
|
110 |
- int result = (int) refreshTokenCheck(req).get("result"); |
|
111 |
- if(result == 0) return result; |
|
138 |
+ public int deleteByRefresh(HttpServletRequest req, HttpServletResponse res) { |
|
139 |
+ try { |
|
140 |
+ // refresh token 검증 |
|
141 |
+ int result = (int) refreshTokenCheck(req).get("result"); |
|
142 |
+ if(result == 0) return result; |
|
112 | 143 |
|
113 |
- //Refresh 토큰 Cookie 값 0 |
|
114 |
-// res.addCookie(jwtUtil.createCookie("refresh",null, 0)); |
|
144 |
+ //Refresh 토큰 Cookie 값 0 |
|
145 |
+ //res.addCookie(jwtUtil.createCookie("refresh",null, 0)); |
|
115 | 146 |
|
116 |
- RefreshVO refreshVO = new RefreshVO(); |
|
117 |
- refreshVO.setMbrId(jwtUtil.getMbrId(refreshTokenCheck(req).get("refreshToken").toString())); |
|
147 |
+ RefreshVO refreshVO = new RefreshVO(); |
|
148 |
+ refreshVO.setMbrId(jwtUtil.getMbrId(refreshTokenCheck(req).get("refreshToken").toString())); |
|
118 | 149 |
|
119 |
- return delete(req, refreshVO); |
|
150 |
+ //중복로그인 비허용시 삭제 |
|
151 |
+ if (!redisConfig.isAllowMultipleLogin()) { |
|
152 |
+ redisTemplate.delete("jwt:" + refreshVO.getMbrId()); // 기존 JWT 삭제 |
|
153 |
+ } |
|
154 |
+ return delete(req, refreshVO); |
|
155 |
+ } catch (DataAccessException dae) { |
|
156 |
+ throw dae; |
|
157 |
+ } catch (Exception e) { |
|
158 |
+ throw e; |
|
159 |
+ } |
|
120 | 160 |
} |
121 |
- |
|
122 | 161 |
/** |
123 |
- * @author takensoft |
|
124 |
- * @since 2024.04.04 |
|
162 |
+ * @param req - HTTP 요청 객체 |
|
163 |
+ * @param res - HTTP 응답 객체 |
|
164 |
+ * @return int - 토큰 재발급 결과 |
|
165 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
166 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
167 |
+ * |
|
125 | 168 |
* 토큰 재발급 |
126 | 169 |
*/ |
127 | 170 |
@Override |
128 | 171 |
@Transactional(rollbackFor = Exception.class) |
129 |
- public int tokenReissueProc(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
130 |
- // refresh token 검증 |
|
131 |
- int result = (int) refreshTokenCheck(req).get("result"); |
|
132 |
- if(result == 0) return result; |
|
172 |
+ public int tokenReissueProc(HttpServletRequest req, HttpServletResponse res){ |
|
173 |
+ try { |
|
174 |
+ // refresh token 검증 |
|
175 |
+ int result = (int) refreshTokenCheck(req).get("result"); |
|
176 |
+ if(result == 0) return result; |
|
133 | 177 |
|
134 |
- String refreshToken = refreshTokenCheck(req).get("refreshToken").toString(); |
|
178 |
+ String refreshToken = refreshTokenCheck(req).get("refreshToken").toString(); |
|
135 | 179 |
|
136 |
- Date expired = jwtUtil.getExpired(refreshToken); |
|
180 |
+ String userId = jwtUtil.getMbrId(refreshToken); |
|
137 | 181 |
|
138 |
- // 만료시간과 현재 시간의 차이 계산 |
|
139 |
- long timeDffrnc = (expired.getTime() - new Date().getTime()) / (1000 * 60 * 60); |
|
182 |
+ // 중복 로그인 비허용 체크 (DB에 저장된 리프레시 토큰과 비교) |
|
183 |
+ if (!redisConfig.isAllowMultipleLogin()) { |
|
184 |
+ String storedRefreshToken = redisTemplate.opsForValue().get("jwt:" + userId); |
|
140 | 185 |
|
141 |
- MberVO mber = new MberVO(); |
|
142 |
- List<MberAuthorVO> roles = jwtUtil.getRoles(refreshToken); |
|
143 |
- mber.setLgnId(jwtUtil.getLgnId(refreshToken)); |
|
144 |
- mber.setMbrId(jwtUtil.getMbrId(refreshToken)); |
|
145 |
- mber.setMbrNm(jwtUtil.getMbrNm(refreshToken)); |
|
146 |
- mber.setAuthorList(roles); |
|
147 |
- // 신규 AccessToken 발행 |
|
148 |
- String newAccessToken = jwtUtil.createJwt("Authorization", mber.getMbrId(), mber.getLgnId(), mber.getMbrNm(), (List) mber.getAuthorities(), JWT_ACCESSTIME); |
|
186 |
+ if (storedRefreshToken == null || !storedRefreshToken.equals(refreshToken)) { |
|
187 |
+ // 다른 기기에서 로그인되었으므로 자동 로그인 차단 |
|
188 |
+ return HttpServletResponse.SC_UNAUTHORIZED; |
|
189 |
+ } |
|
190 |
+ } |
|
149 | 191 |
|
150 |
- // 남은 시간이 3시간 미만으로 남았을 경우 RefreshToken 재발급 |
|
151 |
- if(timeDffrnc < 3) { |
|
152 |
- RefreshVO refresh = new RefreshVO(); |
|
153 |
- refresh.setMbrId(mber.getMbrId()); |
|
192 |
+ Date expired = jwtUtil.getExpired(refreshToken); |
|
154 | 193 |
|
155 |
- // 기존 RefreshToken 삭제 |
|
156 |
- result += delete(req, refresh); |
|
194 |
+ // 만료시간과 현재 시간의 차이 계산 |
|
195 |
+ long timeDffrnc = (expired.getTime() - new Date().getTime()) / (1000 * 60 * 60); |
|
157 | 196 |
|
158 |
- // 신규 RefreshToken 발행 |
|
159 |
- String newRefreshToken = jwtUtil.createJwt("refresh", mber.getMbrId(), mber.getLgnId(), mber.getMbrNm(), (List) mber.getAuthorities(), JWT_REFRESHTIME); |
|
160 |
- refresh.setToken(newRefreshToken); |
|
161 |
- result += saveRefreshToken(req, res,refresh, JWT_REFRESHTIME); |
|
197 |
+ MberVO mber = new MberVO(); |
|
198 |
+ List<MberAuthorVO> roles = jwtUtil.getRoles(refreshToken); |
|
199 |
+ mber.setLgnId(jwtUtil.getLgnId(refreshToken)); |
|
200 |
+ mber.setMbrId(jwtUtil.getMbrId(refreshToken)); |
|
201 |
+ mber.setMbrNm(jwtUtil.getMbrNm(refreshToken)); |
|
202 |
+ mber.setAuthorList(roles); |
|
203 |
+ // 신규 AccessToken 발행 |
|
204 |
+ String newAccessToken = jwtUtil.createJwt("Authorization", mber.getMbrId(), mber.getLgnId(), mber.getMbrNm(), (List) mber.getAuthorities(), JWT_ACCESSTIME); |
|
162 | 205 |
|
163 |
- // 응답설정 RefreshToken |
|
164 |
-// res.setHeader("refresh", newRefreshToken); |
|
165 |
- // 쿠키 방식 |
|
166 |
- res.addCookie(jwtUtil.createCookie("refresh",newRefreshToken, COOKIE_TIME)); |
|
206 |
+ // 남은 시간이 3시간 미만으로 남았을 경우 RefreshToken 재발급 |
|
207 |
+ if(timeDffrnc < 3) { |
|
208 |
+ RefreshVO refresh = new RefreshVO(); |
|
209 |
+ refresh.setMbrId(mber.getMbrId()); |
|
210 |
+ |
|
211 |
+ // 기존 RefreshToken 삭제 |
|
212 |
+ result += delete(req, refresh); |
|
213 |
+ |
|
214 |
+ // 신규 RefreshToken 발행 |
|
215 |
+ String newRefreshToken = jwtUtil.createJwt("refresh", mber.getMbrId(), mber.getLgnId(), mber.getMbrNm(), (List) mber.getAuthorities(), JWT_REFRESHTIME); |
|
216 |
+ refresh.setToken(newRefreshToken); |
|
217 |
+ result += saveRefreshToken(req, res,refresh, JWT_REFRESHTIME); |
|
218 |
+ |
|
219 |
+ // 응답설정 RefreshToken |
|
220 |
+ // res.setHeader("refresh", newRefreshToken); |
|
221 |
+ // 쿠키 방식 |
|
222 |
+ res.addCookie(jwtUtil.createCookie("refresh",newRefreshToken, COOKIE_TIME)); |
|
223 |
+ } |
|
224 |
+ // 응답설정 AccessToken |
|
225 |
+ res.setHeader("Authorization", newAccessToken); |
|
226 |
+ |
|
227 |
+ return result; |
|
228 |
+ } catch (DataAccessException dae) { |
|
229 |
+ throw dae; |
|
230 |
+ } catch (Exception e) { |
|
231 |
+ throw e; |
|
167 | 232 |
} |
168 |
- // 응답설정 AccessToken |
|
169 |
- res.setHeader("Authorization", newAccessToken); |
|
170 |
- |
|
171 |
- return result; |
|
172 | 233 |
} |
173 |
- |
|
174 | 234 |
/** |
175 |
- * @author takensoft |
|
176 |
- * @since 2024.04.04 |
|
235 |
+ * @param req - HTTP 요청 객체 |
|
236 |
+ * @param refreshVO - RefreshToken 정보 |
|
237 |
+ * @return int - 토큰 삭제 결과 |
|
238 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
239 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
240 |
+ * |
|
177 | 241 |
* 토큰 삭제 |
178 | 242 |
*/ |
179 | 243 |
@Override |
180 |
- public int delete(HttpServletRequest req, RefreshVO refreshVO) throws Exception { |
|
181 |
- refreshVO.setUseIp(commonUtils.getIp(req)); |
|
182 |
- return refreshTokenDAO.deleteByRefresh(refreshVO); |
|
183 |
- } |
|
244 |
+ public int delete(HttpServletRequest req, RefreshVO refreshVO) { |
|
245 |
+ try { |
|
246 |
+ refreshVO.setUseIp(httpRequestUtil.getIp(req)); |
|
247 |
+ //중복로그인 비허용시 삭제 |
|
248 |
+ if (!redisConfig.isAllowMultipleLogin()) { |
|
249 |
+ redisTemplate.delete("jwt:" + refreshVO.getMbrId()); // 기존 JWT 삭제 |
|
250 |
+ } |
|
251 |
+ return refreshTokenDAO.deleteByRefresh(refreshVO); |
|
184 | 252 |
|
253 |
+ } catch (DataAccessException dae) { |
|
254 |
+ throw dae; |
|
255 |
+ } catch (Exception e) { |
|
256 |
+ throw e; |
|
257 |
+ } |
|
258 |
+ } |
|
185 | 259 |
/** |
186 |
- * @author takensoft |
|
187 |
- * @since 2024.04.17 |
|
188 |
- * refresh token 등록 유무 확인 |
|
260 |
+ * @param req - HTTP 요청 객체 |
|
261 |
+ * @param refreshVO - RefreshToken 정보 |
|
262 |
+ * @return boolean - refresh token 등록 여부 |
|
263 |
+ * @throws DataAccessException - db 관련 예외 발생 시 |
|
264 |
+ * @throws Exception - 그 외 예외 발생 시 |
|
265 |
+ * |
|
266 |
+ * refresh token 등록 여부 확인 |
|
189 | 267 |
*/ |
190 | 268 |
@Override |
191 |
- public boolean findByCheckRefresh(HttpServletRequest req, RefreshVO refreshVO) throws Exception { |
|
192 |
- // 사용중인 아이피 |
|
193 |
- refreshVO.setUseIp(commonUtils.getIp(req)); |
|
194 |
- return refreshTokenDAO.findByCheckRefresh(refreshVO); |
|
269 |
+ public boolean findByCheckRefresh(HttpServletRequest req, RefreshVO refreshVO) { |
|
270 |
+ try { |
|
271 |
+ // 사용중인 아이피 |
|
272 |
+ refreshVO.setUseIp(httpRequestUtil.getIp(req)); |
|
273 |
+ return refreshTokenDAO.findByCheckRefresh(refreshVO); |
|
274 |
+ } catch (DataAccessException dae) { |
|
275 |
+ throw dae; |
|
276 |
+ } catch (Exception e) { |
|
277 |
+ throw e; |
|
278 |
+ } |
|
195 | 279 |
} |
196 | 280 |
|
197 | 281 |
} |
--- src/main/java/com/takensoft/cms/mber/service/LgnHstryService.java
+++ src/main/java/com/takensoft/cms/mber/service/LgnHstryService.java
... | ... | @@ -1,28 +1,36 @@ |
1 | 1 |
package com.takensoft.cms.mber.service; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.mber.vo.LgnHstryVO; |
4 |
+import org.springframework.dao.DataAccessException; |
|
4 | 5 |
|
5 | 6 |
import java.util.HashMap; |
6 |
- |
|
7 | 7 |
/** |
8 |
- * @author : takensoft |
|
9 |
- * @since : 2024.04.09 |
|
8 |
+ * @author 박정하 |
|
9 |
+ * @since 2024.04.09 |
|
10 |
+ * @modification |
|
11 |
+ * since | author | description |
|
12 |
+ * 2024.04.09 | 박정하 | 최초 등록 |
|
10 | 13 |
* |
11 |
- * 로그인 이력 정보 관련 인터페이스 |
|
14 |
+ * 로그인 이력 관련 인터페이스 |
|
12 | 15 |
*/ |
13 | 16 |
public interface LgnHstryService { |
14 |
- /** |
|
15 |
- * @author takensoft |
|
16 |
- * @since 2024.04.09 |
|
17 |
- * 로그인 이력 등록 |
|
18 |
- */ |
|
19 |
- public int LgnHstrySave(LgnHstryVO lgnHstryVO) throws Exception; |
|
20 | 17 |
|
21 | 18 |
/** |
22 |
- * @author : 박정하 |
|
23 |
- * @since : 2024.05.13 |
|
19 |
+ * @param lgnHstryVO - 로그인 이력 정보 |
|
20 |
+ * @return int - 로그인 이력 결과 |
|
21 |
+ * |
|
22 |
+ * 로그인 이력 등록 |
|
23 |
+ */ |
|
24 |
+ public int LgnHstrySave(LgnHstryVO lgnHstryVO); |
|
25 |
+ |
|
26 |
+ /** |
|
27 |
+ * @param params -회원정보 |
|
28 |
+ * @return HashMap<String, Object> |
|
29 |
+ * - list : 로그인 이력 목록 |
|
30 |
+ * - pagination : 페이징 정보 |
|
31 |
+ * - codeList : 공통 코드 조회(로그인이력) |
|
24 | 32 |
* |
25 | 33 |
* 로그인 이력 목록 조회 |
26 | 34 |
*/ |
27 |
- public HashMap<String, Object> lgnHstryList(HashMap<String, String> params) throws Exception; |
|
35 |
+ public HashMap<String, Object> lgnHstryList(HashMap<String, String> params); |
|
28 | 36 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/service/MberService.java
+++ src/main/java/com/takensoft/cms/mber/service/MberService.java
... | ... | @@ -5,48 +5,61 @@ |
5 | 5 |
import com.takensoft.cms.mber.vo.MberVO; |
6 | 6 |
|
7 | 7 |
import jakarta.servlet.http.HttpServletRequest; |
8 |
-import java.util.*; |
|
8 |
+import org.springframework.dao.DataAccessException; |
|
9 | 9 |
|
10 |
+import java.util.*; |
|
10 | 11 |
/** |
11 |
- * @author : takensoft |
|
12 |
- * @since : 2024.04.01 |
|
12 |
+ * @author takensoft |
|
13 |
+ * @since 2024.04.01 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
13 | 17 |
* |
14 | 18 |
* 회원 정보 관련 인터페이스 |
15 | 19 |
*/ |
16 | 20 |
public interface MberService { |
21 |
+ |
|
17 | 22 |
/** |
18 |
- * @author takensoft |
|
19 |
- * @since 2024.04.03 |
|
23 |
+ * @param lgnId - 로그인 아이디 |
|
24 |
+ * @return boolean - 아이디 아이디 중복 여부 |
|
20 | 25 |
* |
21 | 26 |
* 아이디 중복 검사 |
22 | 27 |
*/ |
23 |
- public boolean findByCheckLoginId(String lgnId) throws Exception; |
|
28 |
+ public boolean findByCheckLoginId(String lgnId); |
|
24 | 29 |
|
25 | 30 |
/** |
26 |
- * @author takensoft |
|
27 |
- * @since 2024.04.03 |
|
31 |
+ * @param req - HTTP 요청 객체 |
|
32 |
+ * @param joinDTO -회원정보 |
|
33 |
+ * @return HashMap<String, Object> - 회원정보 등록 결과 |
|
34 |
+ * - mbrId : 회원 아이디 |
|
35 |
+ * - result : 회원등록정보 결과 |
|
36 |
+ * |
|
28 | 37 |
* 회원가입 |
29 | 38 |
*/ |
30 |
- public HashMap<String, Object> userJoin(HttpServletRequest req, JoinDTO joinDTO) throws Exception; |
|
39 |
+ public HashMap<String, Object> userJoin(HttpServletRequest req, JoinDTO joinDTO); |
|
31 | 40 |
|
32 | 41 |
/** |
33 |
- * @author takensoft |
|
34 |
- * @since 2024.04.15 |
|
42 |
+ * @param passwordDTO - 비밀번호 |
|
43 |
+ * @return boolean - 비밀번호 사용 가능 여부 |
|
44 |
+ * |
|
35 | 45 |
* 비밀번호 비교 |
36 | 46 |
*/ |
37 |
- public boolean passwordCheck(PasswordDTO passwordDTO) throws Exception; |
|
47 |
+ public boolean passwordCheck(PasswordDTO passwordDTO); |
|
38 | 48 |
|
39 | 49 |
/** |
40 |
- * @author 박정하 |
|
41 |
- * @since 2024.04.23 |
|
50 |
+ * @param params |
|
51 |
+ * - 회원 아이디 |
|
52 |
+ * @return MberVO - 회원 정보 |
|
53 |
+ * |
|
42 | 54 |
* 회원정보 상세 조회 |
43 | 55 |
*/ |
44 |
- public MberVO findByMbr(HashMap<String, Object> params) throws Exception; |
|
56 |
+ public MberVO findByMbr(HashMap<String, Object> params); |
|
45 | 57 |
|
46 | 58 |
/** |
47 |
- * @author takensoft |
|
48 |
- * @since 2024.04.24 |
|
59 |
+ * @param passwordDTO - 비밀번호 |
|
60 |
+ * @return int - 비밀번호 수정 결과 |
|
61 |
+ * |
|
49 | 62 |
* 비밀번호 수정 |
50 | 63 |
*/ |
51 |
- public int updatePassword(PasswordDTO passwordDTO) throws Exception; |
|
64 |
+ public int updatePassword(PasswordDTO passwordDTO); |
|
52 | 65 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/service/RefreshTokenService.java
+++ src/main/java/com/takensoft/cms/mber/service/RefreshTokenService.java
... | ... | @@ -4,47 +4,63 @@ |
4 | 4 |
|
5 | 5 |
import jakarta.servlet.http.HttpServletRequest; |
6 | 6 |
import jakarta.servlet.http.HttpServletResponse; |
7 |
+import org.springframework.dao.DataAccessException; |
|
7 | 8 |
|
8 | 9 |
/** |
9 |
- * @author : takensoft |
|
10 |
- * @since : 2024.04.01 |
|
10 |
+ * @author takensoft |
|
11 |
+ * @since 2024.04.01 |
|
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
11 | 15 |
* |
12 | 16 |
* RefreshToken 정보 관련 인터페이스 |
13 | 17 |
*/ |
14 | 18 |
public interface RefreshTokenService { |
15 | 19 |
|
16 | 20 |
/** |
17 |
- * @author takensoft |
|
18 |
- * @since 2024.04.04 |
|
21 |
+ * @param req - HTTP 요청 객체 |
|
22 |
+ * @param res - HTTP 응답 객체 |
|
23 |
+ * @param refresh - RefreshToken 정보 |
|
24 |
+ * @param expiredMs - 토큰 만료 시간 (밀리초) |
|
25 |
+ * @return int - refresh token 등록결과 |
|
26 |
+ * |
|
19 | 27 |
* refresh token 등록 |
20 | 28 |
*/ |
21 |
- public int saveRefreshToken(HttpServletRequest req, HttpServletResponse res, RefreshVO refresh, long expiredMs) throws Exception; |
|
29 |
+ public int saveRefreshToken(HttpServletRequest req, HttpServletResponse res, RefreshVO refresh, long expiredMs); |
|
22 | 30 |
|
23 | 31 |
/** |
24 |
- * @author takensoft |
|
25 |
- * @since 2024.04.04 |
|
26 |
- * refresh token 삭제 프로세스 |
|
32 |
+ * @param req - HTTP 요청 객체 |
|
33 |
+ * @param res - HTTP 응답 객체 |
|
34 |
+ * @return int - refresh token 삭제 결과 |
|
35 |
+ * |
|
36 |
+ * refresh token 삭제 프로세스 (로그아웃) |
|
27 | 37 |
*/ |
28 |
- public int deleteByRefresh(HttpServletRequest req, HttpServletResponse res) throws Exception; |
|
38 |
+ public int deleteByRefresh(HttpServletRequest req, HttpServletResponse res); |
|
29 | 39 |
|
30 | 40 |
/** |
31 |
- * @author takensoft |
|
32 |
- * @since 2024.04.04 |
|
41 |
+ * @param req - HTTP 요청 객체 |
|
42 |
+ * @param res - HTTP 응답 객체 |
|
43 |
+ * @return int - 토큰 재발급 결과 |
|
44 |
+ * |
|
33 | 45 |
* 토큰 재발급 |
34 | 46 |
*/ |
35 |
- public int tokenReissueProc(HttpServletRequest req, HttpServletResponse res) throws Exception; |
|
47 |
+ public int tokenReissueProc(HttpServletRequest req, HttpServletResponse res); |
|
36 | 48 |
|
37 | 49 |
/** |
38 |
- * @author takensoft |
|
39 |
- * @since 2024.04.04 |
|
50 |
+ * @param req - HTTP 요청 객체 |
|
51 |
+ * @param refreshVO - RefreshToken 정보 |
|
52 |
+ * @return int - 토큰 삭제 결과 |
|
53 |
+ * |
|
40 | 54 |
* 토큰 삭제 |
41 | 55 |
*/ |
42 |
- public int delete(HttpServletRequest req, RefreshVO refreshVO) throws Exception; |
|
56 |
+ public int delete(HttpServletRequest req, RefreshVO refreshVO); |
|
43 | 57 |
|
44 | 58 |
/** |
45 |
- * @author takensoft |
|
46 |
- * @since 2024.04.17 |
|
47 |
- * refresh token 등록 유무 확인 |
|
59 |
+ * @param req - HTTP 요청 객체 |
|
60 |
+ * @param refreshVO - RefreshToken 정보 |
|
61 |
+ * @return boolean - refresh token 등록 여부 |
|
62 |
+ * |
|
63 |
+ * refresh token 등록 여부 확인 |
|
48 | 64 |
*/ |
49 |
- public boolean findByCheckRefresh(HttpServletRequest req, RefreshVO refreshVO) throws Exception; |
|
65 |
+ public boolean findByCheckRefresh(HttpServletRequest req, RefreshVO refreshVO); |
|
50 | 66 |
} |
--- src/main/java/com/takensoft/cms/mber/vo/LgnHstryVO.java
+++ src/main/java/com/takensoft/cms/mber/vo/LgnHstryVO.java
... | ... | @@ -1,10 +1,12 @@ |
1 | 1 |
package com.takensoft.cms.mber.vo; |
2 | 2 |
|
3 | 3 |
import lombok.*; |
4 |
- |
|
5 | 4 |
/** |
6 | 5 |
* @author : takensoft |
7 | 6 |
* @since : 2024.04.01 |
7 |
+ * @modification |
|
8 |
+ * since | author | description |
|
9 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
8 | 10 |
* |
9 | 11 |
* 로그인 이력 정보 관련 VO |
10 | 12 |
*/ |
... | ... | @@ -16,32 +18,11 @@ |
16 | 18 |
@NoArgsConstructor |
17 | 19 |
public class LgnHstryVO { |
18 | 20 |
|
19 |
- /** |
|
20 |
- * 로그인 아이디 |
|
21 |
- */ |
|
22 |
- private String lgnId; |
|
23 |
- /** |
|
24 |
- * 로그인 유형 |
|
25 |
- */ |
|
26 |
- private String lgnType; |
|
27 |
- /** |
|
28 |
- * 접속일 |
|
29 |
- */ |
|
30 |
- private String cntnDt; |
|
31 |
- /** |
|
32 |
- * 접속 아이피 |
|
33 |
- */ |
|
34 |
- private String cntnIp; |
|
35 |
- /** |
|
36 |
- * 접속 운영체제 |
|
37 |
- */ |
|
38 |
- private String cntnOperSys; |
|
39 |
- /** |
|
40 |
- * 디바이스명 |
|
41 |
- */ |
|
42 |
- private String deviceNm; |
|
43 |
- /** |
|
44 |
- * 브라우저명 |
|
45 |
- */ |
|
46 |
- private String brwsrNm; |
|
21 |
+ private String lgnId; // 로그인 아이디 |
|
22 |
+ private String lgnType; // 로그인 유형 |
|
23 |
+ private String cntnDt; // 접속일 |
|
24 |
+ private String cntnIp; // 접속 아이피 |
|
25 |
+ private String cntnOperSys; // 접속 운영체제 |
|
26 |
+ private String deviceNm; // 디바이스명 |
|
27 |
+ private String brwsrNm; // 브라우저명 |
|
47 | 28 |
} |
--- src/main/java/com/takensoft/cms/mber/vo/MberAuthorVO.java
+++ src/main/java/com/takensoft/cms/mber/vo/MberAuthorVO.java
... | ... | @@ -3,10 +3,13 @@ |
3 | 3 |
import lombok.*; |
4 | 4 |
|
5 | 5 |
/** |
6 |
- * @author : takensoft |
|
7 |
- * @since : 2024.04.01 |
|
6 |
+ * @author takensoft |
|
7 |
+ * @since 2025.01.22 |
|
8 |
+ * @modification |
|
9 |
+ * since | author | description |
|
10 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
8 | 11 |
* |
9 |
- * 회원 권한 정보 관련 VO |
|
12 |
+ * 사용자 권한 관련 VO |
|
10 | 13 |
*/ |
11 | 14 |
@Getter |
12 | 15 |
@Setter |
... | ... | @@ -15,24 +18,19 @@ |
15 | 18 |
@AllArgsConstructor |
16 | 19 |
@NoArgsConstructor |
17 | 20 |
public class MberAuthorVO { |
18 |
- /** |
|
19 |
- * 회원 아이디 |
|
20 |
- */ |
|
21 |
- private String mbrId; |
|
22 |
- /** |
|
23 |
- * 권한명 |
|
24 |
- */ |
|
25 |
- private String authrtNm; |
|
26 |
- /** |
|
27 |
- * 권한 코드 |
|
28 |
- */ |
|
29 |
- private String authrtCd; |
|
30 |
- /** |
|
31 |
- * 등록자 |
|
32 |
- */ |
|
33 |
- private String rgtr; |
|
34 |
- /** |
|
35 |
- * 등록일 |
|
36 |
- */ |
|
37 |
- private String regDt; |
|
21 |
+ |
|
22 |
+ private String mbrId; // 회원 아이디 |
|
23 |
+ private String authrtNm; // 권한명 |
|
24 |
+ private String authrtCd; // 권한 코드 |
|
25 |
+ private String rgtr; // 등록자 |
|
26 |
+ private String regDt; // 등록일 |
|
27 |
+ public MberAuthorVO(String authrtCd) { |
|
28 |
+ this.authrtCd = authrtCd; |
|
29 |
+ } // 생성자 |
|
30 |
+ |
|
31 |
+ public MberAuthorVO(String mbrId, String authrtCd, String rgtr) { |
|
32 |
+ this.mbrId = mbrId; |
|
33 |
+ this.authrtCd = authrtCd; |
|
34 |
+ this.rgtr = rgtr; |
|
35 |
+ } |
|
38 | 36 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/cms/mber/vo/MberVO.java
+++ src/main/java/com/takensoft/cms/mber/vo/MberVO.java
... | ... | @@ -14,15 +14,18 @@ |
14 | 14 |
import java.util.Collection; |
15 | 15 |
import java.util.List; |
16 | 16 |
import java.util.stream.Collectors; |
17 |
- |
|
18 | 17 |
/** |
19 | 18 |
* @author : takensoft |
20 | 19 |
* @since : 2024.04.01 |
20 |
+ * @modification |
|
21 |
+ * since | author | description |
|
22 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
21 | 23 |
* |
22 | 24 |
* 회원 정보 관련 VO |
23 | 25 |
* UserDetails : security 사용을 위해 상속 |
24 | 26 |
* Serializable : 직렬화를 위해 상속 |
25 | 27 |
*/ |
28 |
+ |
|
26 | 29 |
@Setter |
27 | 30 |
@Getter |
28 | 31 |
@NoArgsConstructor |
... | ... | @@ -31,121 +34,34 @@ |
31 | 34 |
|
32 | 35 |
private static final long serialVersionUID = 1L; |
33 | 36 |
|
34 |
- /** |
|
35 |
- * 회원 아이디 |
|
36 |
- */ |
|
37 |
- private String mbrId; |
|
38 |
- /** |
|
39 |
- * 로그인 아이디 |
|
40 |
- */ |
|
41 |
- private String lgnId; |
|
42 |
- /** |
|
43 |
- * 회원 이름 |
|
44 |
- */ |
|
45 |
- private String mbrNm; |
|
46 |
- /** |
|
47 |
- * 닉네임 |
|
48 |
- */ |
|
49 |
- private String ncnm; |
|
50 |
- /** |
|
51 |
- * 비밀번호 |
|
52 |
- */ |
|
53 |
- private String pswd; |
|
54 |
- /** |
|
55 |
- * 휴대폰번호 |
|
56 |
- */ |
|
57 |
- private String mblTelno; |
|
58 |
- /** |
|
59 |
- * 전화번호 |
|
60 |
- */ |
|
61 |
- private String telno; |
|
62 |
- /** |
|
63 |
- * 이메일 |
|
64 |
- */ |
|
65 |
- private String eml; |
|
66 |
- /** |
|
67 |
- * 우편번호 |
|
68 |
- */ |
|
69 |
- private String zip; |
|
70 |
- /** |
|
71 |
- * 주소 |
|
72 |
- */ |
|
73 |
- private String addr; |
|
74 |
- /** |
|
75 |
- * 상세주소 |
|
76 |
- */ |
|
77 |
- private String daddr; |
|
78 |
- /** |
|
79 |
- * 회원상태 |
|
80 |
- * 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
81 |
- */ |
|
82 |
- private String mbrStts; |
|
83 |
- /** |
|
84 |
- * 사용여부 |
|
85 |
- */ |
|
86 |
- private boolean useYn; |
|
87 |
- /** |
|
88 |
- * 차단일 |
|
89 |
- */ |
|
90 |
- private String cntrlDt; |
|
91 |
- /** |
|
92 |
- * 차단사유 |
|
93 |
- */ |
|
94 |
- private String cntrlRsn; |
|
95 |
- /** |
|
96 |
- * 문자수신여부 |
|
97 |
- * 0: 거부, 1: 허용 |
|
98 |
- */ |
|
99 |
- private String smsRcptnAgreYn; |
|
100 |
- /** |
|
101 |
- * 이메일수신여부 |
|
102 |
- * 0: 거부, 1: 허용 |
|
103 |
- */ |
|
104 |
- private String emlRcptnAgreYn; |
|
105 |
- /** |
|
106 |
- * 개인정보공개여부 |
|
107 |
- * 0: 거부, 1: 허용 |
|
108 |
- */ |
|
109 |
- private String prvcRlsYn; |
|
110 |
- /** |
|
111 |
- * 회원형태 |
|
112 |
- * S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
113 |
- */ |
|
114 |
- private String mbrType; |
|
115 |
- /** |
|
116 |
- * 비밀번호 변경일 |
|
117 |
- */ |
|
118 |
- private String pswdChgDt; |
|
119 |
- /** |
|
120 |
- * 최초등록 아이디 |
|
121 |
- */ |
|
122 |
- private String frstRegIp; |
|
123 |
- /** |
|
124 |
- * 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 |
|
125 |
- * 0: 시스템, 1: 사용자 |
|
126 |
- */ |
|
127 |
- private String sysPvsnYn; |
|
128 |
- /** |
|
129 |
- * 등록자 |
|
130 |
- */ |
|
131 |
- private String rgtr; |
|
132 |
- /** |
|
133 |
- * 등록일 |
|
134 |
- */ |
|
135 |
- private String regDt; |
|
136 |
- /** |
|
137 |
- * 수정자 |
|
138 |
- */ |
|
139 |
- private String mdfr; |
|
140 |
- /** |
|
141 |
- * 수정일 |
|
142 |
- */ |
|
143 |
- private String mdfcnDt; |
|
144 |
- /** |
|
145 |
- * 권한 정보 |
|
146 |
- */ |
|
37 |
+ private String mbrId; // 회원 아이디 |
|
38 |
+ private String lgnId; // 로그인 아이디 |
|
39 |
+ private String mbrNm; // 회원 이름 |
|
40 |
+ private String ncnm; // 닉네임 |
|
41 |
+ private String pswd; // 비밀번호 |
|
42 |
+ private String mblTelno; // 휴대폰번호 |
|
43 |
+ private String telno; // 전화번호 |
|
44 |
+ private String eml; // 이메일 |
|
45 |
+ private String zip; // 우편번호 |
|
46 |
+ private String addr; // 주소 |
|
47 |
+ private String daddr; // 상세주소 |
|
48 |
+ private String mbrStts; // 회원상태 0: 탈퇴, 1: 승인, 2: 승인대기, 3: 차단 |
|
49 |
+ private boolean useYn; // 사용여부 |
|
50 |
+ private String cntrlDt; // 차단일 |
|
51 |
+ private String cntrlRsn; // 차단사유 |
|
52 |
+ private String smsRcptnAgreYn; // 문자수신여부 0: 거부, 1: 허용 |
|
53 |
+ private String emlRcptnAgreYn; // 이메일수신여부 0: 거부, 1: 허용 |
|
54 |
+ private String prvcRlsYn; // 개인정보공개여부 0: 거부, 1: 허용 |
|
55 |
+ private String mbrType; // 회원형태 S: 시스템, K: 카카오, N: 네이버, G: 구글, F: 페이스북 |
|
56 |
+ private String pswdChgDt; // 비밀번호 변경일 |
|
57 |
+ private String frstRegIp; // 최초등록 아이디 |
|
58 |
+ private String sysPvsnYn; // 시스템 제공 여부 -> 시스템에서 제공되는 데이터는 사용자가 제거하지 못하도록 하기 위한 설정값 0: 시스템, 1: 사용자 |
|
59 |
+ private String rgtr; // 등록자 |
|
60 |
+ private String regDt; // 등록일 |
|
61 |
+ private String mdfr; // 수정자 |
|
62 |
+ private String mdfcnDt; // 수정일 |
|
147 | 63 |
@JsonIgnore |
148 |
- private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); |
|
64 |
+ private List<MberAuthorVO> authorList = new ArrayList<MberAuthorVO>(); // 권한 정보 |
|
149 | 65 |
|
150 | 66 |
@Override |
151 | 67 |
public Collection<? extends GrantedAuthority> getAuthorities() { |
... | ... | @@ -187,4 +103,22 @@ |
187 | 103 |
public boolean isEnabled() { |
188 | 104 |
return this.useYn; |
189 | 105 |
} |
106 |
+ |
|
107 |
+ // JWT 필터용 생성자 |
|
108 |
+ public MberVO(String mbrId, String lgnId, List<MberAuthorVO> authorList) { |
|
109 |
+ this.mbrId = mbrId; |
|
110 |
+ this.lgnId = lgnId; |
|
111 |
+ this.authorList = authorList; |
|
112 |
+ } |
|
113 |
+ // 토큰 재발행용 |
|
114 |
+ public MberVO(String mbrId, String lgnId, String mbrNm, List<MberAuthorVO> authorList) { |
|
115 |
+ this.mbrId = mbrId; |
|
116 |
+ this.lgnId = lgnId; |
|
117 |
+ this.mbrNm = mbrNm; |
|
118 |
+ this.authorList = authorList; |
|
119 |
+ } |
|
120 |
+ |
|
121 |
+ |
|
122 |
+ |
|
123 |
+ |
|
190 | 124 |
} |
--- src/main/java/com/takensoft/cms/mber/vo/RefreshVO.java
+++ src/main/java/com/takensoft/cms/mber/vo/RefreshVO.java
... | ... | @@ -6,10 +6,12 @@ |
6 | 6 |
import lombok.Setter; |
7 | 7 |
|
8 | 8 |
import java.util.Date; |
9 |
- |
|
10 | 9 |
/** |
11 | 10 |
* @author : takensoft |
12 | 11 |
* @since : 2024.04.01 |
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
13 | 15 |
* |
14 | 16 |
* RefreshToken 정보 관련 VO |
15 | 17 |
*/ |
... | ... | @@ -18,20 +20,9 @@ |
18 | 20 |
@NoArgsConstructor |
19 | 21 |
@AllArgsConstructor |
20 | 22 |
public class RefreshVO { |
21 |
- /** |
|
22 |
- * 회원 아이디 |
|
23 |
- */ |
|
24 |
- private String mbrId; |
|
25 |
- /** |
|
26 |
- * 토큰 |
|
27 |
- */ |
|
28 |
- private String token; |
|
29 |
- /** |
|
30 |
- * 만료기간 expry_dt expryYmd |
|
31 |
- */ |
|
32 |
- private Date expryDt; |
|
33 |
- /** |
|
34 |
- * 사용중인 아이피 |
|
35 |
- */ |
|
36 |
- private String useIp; |
|
23 |
+ |
|
24 |
+ private String mbrId; // 회원 아이디 |
|
25 |
+ private String token; // 토큰 |
|
26 |
+ private Date expryDt; // 만료기간 |
|
27 |
+ private String useIp; // 사용중인 아이피 |
|
37 | 28 |
} |
--- src/main/java/com/takensoft/cms/mber/web/AdmMbrController.java
+++ src/main/java/com/takensoft/cms/mber/web/AdmMbrController.java
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 |
import com.takensoft.common.util.ResponseData; |
12 | 12 |
import com.takensoft.common.util.ResponseUtil; |
13 | 13 |
import lombok.RequiredArgsConstructor; |
14 |
+import org.springframework.dao.DataAccessException; |
|
14 | 15 |
import org.springframework.http.HttpHeaders; |
15 | 16 |
import org.springframework.http.HttpStatus; |
16 | 17 |
import org.springframework.http.MediaType; |
... | ... | @@ -41,17 +42,15 @@ |
41 | 42 |
private final AdmMbrService admMbrService; |
42 | 43 |
private final MberService mbrService; |
43 | 44 |
private final ResponseUtil resUtil; |
45 |
+ |
|
44 | 46 |
/** |
45 |
- * @author 박정하 |
|
46 |
- * @since 2024.06.21 |
|
47 |
- * @param params |
|
48 |
- * @return |
|
49 |
- * @throws Exception |
|
47 |
+ * @param params - 회원정보 |
|
48 |
+ * @return ResponseEntity - 회원정보 목록 조회 응답 결과 |
|
50 | 49 |
* |
51 | 50 |
* 회원정보 목록 조회 |
52 | 51 |
*/ |
53 | 52 |
@PostMapping(value = "/listProc.json") |
54 |
- public ResponseEntity<?> listProc(@RequestBody HashMap<String, String> params) throws Exception { |
|
53 |
+ public ResponseEntity<?> listProc(@RequestBody HashMap<String, String> params){ |
|
55 | 54 |
HashMap<String, Object> result = admMbrService.mbrList(params); |
56 | 55 |
|
57 | 56 |
// 응답 처리 |
... | ... | @@ -59,16 +58,14 @@ |
59 | 58 |
} |
60 | 59 |
|
61 | 60 |
/** |
62 |
- * @author 박정하 |
|
63 |
- * @since 2024.06.21 |
|
64 |
- * @param resetPswd, admMbrDTO |
|
65 |
- * @return |
|
66 |
- * @throws Exception |
|
61 |
+ * @param resetPswd - 초기화비밀번호 |
|
62 |
+ * @param admMbrDTO - 회원정보 |
|
63 |
+ * @return ResponseEntity - 회원정보 비밀번호 초기화 응답 결과 |
|
67 | 64 |
* |
68 | 65 |
* 회원정보 비밀번호 초기화 |
69 |
- */ |
|
66 |
+ */ |
|
70 | 67 |
@PostMapping(value = "/pswdResetProc.json") |
71 |
- public ResponseEntity<?> pswdResetProc(@Value("${password.reset}") String resetPswd, @RequestBody AdmMbrDTO admMbrDTO) throws Exception { |
|
68 |
+ public ResponseEntity<?> pswdResetProc(@Value("${password.reset}") String resetPswd, @RequestBody AdmMbrDTO admMbrDTO){ |
|
72 | 69 |
PasswordDTO passwordDTO = new PasswordDTO(); |
73 | 70 |
passwordDTO.setMbrId(admMbrDTO.getMbrId()); |
74 | 71 |
passwordDTO.setPswd(admMbrDTO.getPswd()); |
... | ... | @@ -86,16 +83,13 @@ |
86 | 83 |
} |
87 | 84 |
|
88 | 85 |
/** |
89 |
- * @author 박정하 |
|
90 |
- * @since 2024.06.21 |
|
91 |
- * @param admMbrDTO |
|
92 |
- * @return |
|
93 |
- * @throws Exception |
|
86 |
+ * @param admMbrDTO - 회원정보 |
|
87 |
+ * @return ResponseEntity - 회회원정보 상세 조회 응답 결과 |
|
94 | 88 |
* |
95 | 89 |
* 회원정보 상세 조회 |
96 | 90 |
*/ |
97 | 91 |
@PostMapping(value = "/detailProc.json") |
98 |
- public ResponseEntity<?> detailProc(@RequestBody AdmMbrDTO admMbrDTO) throws Exception { |
|
92 |
+ public ResponseEntity<?> detailProc(@RequestBody AdmMbrDTO admMbrDTO){ |
|
99 | 93 |
// 상세 조회 |
100 | 94 |
AdmMbrDTO result = admMbrService.mbrDetail(admMbrDTO.getMbrId()); |
101 | 95 |
|
... | ... | @@ -104,16 +98,13 @@ |
104 | 98 |
} |
105 | 99 |
|
106 | 100 |
/** |
107 |
- * @author 박정하 |
|
108 |
- * @since 2024.06.21 |
|
109 |
- * @param admMbrDTO |
|
110 |
- * @return |
|
111 |
- * @throws Exception |
|
101 |
+ * @param admMbrDTO - 회원정보 |
|
102 |
+ * @return ResponseEntity - 회원정보 수정 응답 결과 |
|
112 | 103 |
* |
113 | 104 |
* 회원정보 수정 |
114 | 105 |
*/ |
115 | 106 |
@PostMapping(value = "/updateProc.json") |
116 |
- public ResponseEntity<?> updateProc(@RequestBody AdmMbrDTO admMbrDTO) throws Exception { |
|
107 |
+ public ResponseEntity<?> updateProc(@RequestBody AdmMbrDTO admMbrDTO) { |
|
117 | 108 |
int result = admMbrService.updateMbr(admMbrDTO); |
118 | 109 |
|
119 | 110 |
// 응답 처리 |
... | ... | @@ -125,16 +116,13 @@ |
125 | 116 |
} |
126 | 117 |
|
127 | 118 |
/** |
128 |
- * @author 박정하 |
|
129 |
- * @since 2024.06.21 |
|
130 |
- * @param admMbrDTO |
|
131 |
- * @return |
|
132 |
- * @throws Exception |
|
119 |
+ * @param admMbrDTO - 회원정보 |
|
120 |
+ * @return ResponseEntity - 회원정보 삭제 응답 결과 |
|
133 | 121 |
* |
134 | 122 |
* 회원정보 삭제 |
135 | 123 |
*/ |
136 | 124 |
@PostMapping(value = "/deleteProc.json") |
137 |
- public ResponseEntity<?> deleteProc(@RequestBody AdmMbrDTO admMbrDTO) throws Exception { |
|
125 |
+ public ResponseEntity<?> deleteProc(@RequestBody AdmMbrDTO admMbrDTO){ |
|
138 | 126 |
admMbrDTO.setUseYn("N"); // 회원정보 삭제 |
139 | 127 |
int result = admMbrService.updateMbr(admMbrDTO); |
140 | 128 |
|
... | ... | @@ -145,22 +133,16 @@ |
145 | 133 |
return resUtil.errorRes(MessageCode.COMMON_DELETE_FAIL); |
146 | 134 |
} |
147 | 135 |
} |
148 |
- |
|
136 |
+ |
|
149 | 137 |
/** |
150 |
- * @author 박정하 |
|
151 |
- * @since 2024.06.21 |
|
152 |
- * @param req, joinDTO |
|
153 |
- * @return |
|
154 |
- * @throws Exception |
|
138 |
+ * @param req - HTTP 요청 객체 |
|
139 |
+ * @param joinDTO - 회원정보 |
|
140 |
+ * @return ResponseEntity - 회원정보 등록 응답 결과 |
|
155 | 141 |
* |
156 | 142 |
* 회원정보 등록 |
157 | 143 |
*/ |
158 | 144 |
@PostMapping(value = "/joinProc.json") |
159 |
- public ResponseEntity<?> joinProc(HttpServletRequest req, @RequestBody @Valid JoinDTO joinDTO) throws Exception { |
|
160 |
- // 응답 처리 |
|
161 |
- HttpHeaders headers = new HttpHeaders(); |
|
162 |
- headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
163 |
- ResponseData responseData = new ResponseData(); |
|
145 |
+ public ResponseEntity<?> joinProc(HttpServletRequest req, @RequestBody @Valid JoinDTO joinDTO){ |
|
164 | 146 |
|
165 | 147 |
// 아이디 중복 검사 |
166 | 148 |
boolean isExistence = mbrService.findByCheckLoginId(joinDTO.getLgnId()); |
... | ... | @@ -178,18 +160,14 @@ |
178 | 160 |
return resUtil.errorRes(MessageCode.COMMON_UNKNOWN_ERROR); |
179 | 161 |
} |
180 | 162 |
} |
181 |
- |
|
182 | 163 |
/** |
183 |
- * @author 박정하 |
|
184 |
- * @since 2024.07.03 |
|
185 |
- * @param mbrVO |
|
186 |
- * @return |
|
187 |
- * @throws Exception |
|
164 |
+ * @param mbrVO - 회원정보 |
|
165 |
+ * @return ResponseEntity - 아이디 찾기 응답 결과 |
|
188 | 166 |
* |
189 | 167 |
* 아이디 찾기 |
190 | 168 |
*/ |
191 | 169 |
@PostMapping(value = "/searchIdProc.json") |
192 |
- public ResponseEntity<?> searchIdProc(@RequestBody MberVO mbrVO) throws Exception { |
|
170 |
+ public ResponseEntity<?> searchIdProc(@RequestBody MberVO mbrVO) { |
|
193 | 171 |
String result = admMbrService.lgnIdSearch(mbrVO); |
194 | 172 |
|
195 | 173 |
// 응답 처리 |
... | ... | @@ -202,19 +180,15 @@ |
202 | 180 |
return resUtil.errorRes(MessageCode.LOGIN_USER_NOT_FOUND); |
203 | 181 |
} |
204 | 182 |
} |
205 |
- |
|
206 |
- |
|
207 | 183 |
/** |
208 |
- * @author 박정하 |
|
209 |
- * @since 2024.07.03 |
|
210 |
- * @param admMbrDTO |
|
211 |
- * @return |
|
212 |
- * @throws Exception |
|
184 |
+ * @param resetPswd -초기화비밀번호 |
|
185 |
+ * @param admMbrDTO -회원정보 |
|
186 |
+ * @return ResponseEntity - 비밀번호 초기화 응답 결과 |
|
213 | 187 |
* |
214 | 188 |
* 비밀번호 초기화 |
215 | 189 |
*/ |
216 | 190 |
@PostMapping(value = "/resetPswdProc.json") |
217 |
- public ResponseEntity<?> resetPswdProc(@Value("${password.reset}") String resetPswd, @RequestBody AdmMbrDTO admMbrDTO) throws Exception { |
|
191 |
+ public ResponseEntity<?> resetPswdProc(@Value("${password.reset}") String resetPswd, @RequestBody AdmMbrDTO admMbrDTO){ |
|
218 | 192 |
int result = admMbrService.mbrIdSearch(resetPswd, admMbrDTO); |
219 | 193 |
|
220 | 194 |
// 응답 처리 |
--- src/main/java/com/takensoft/cms/mber/web/LgnHstryController.java
+++ src/main/java/com/takensoft/cms/mber/web/LgnHstryController.java
... | ... | @@ -33,16 +33,13 @@ |
33 | 33 |
private final ResponseUtil resUtil; |
34 | 34 |
|
35 | 35 |
/** |
36 |
- * @author 박정하 |
|
37 |
- * @since 2024.05.13 |
|
38 |
- * @param params |
|
39 |
- * @return |
|
40 |
- * @throws Exception |
|
36 |
+ * @param params - 회원정보 |
|
37 |
+ * @return ResponseEntity - 로그인 이력 목록 조회 응답 결과 |
|
41 | 38 |
* |
42 | 39 |
* 로그인 이력 목록 조회 |
43 | 40 |
*/ |
44 | 41 |
@PostMapping("/listProc.json") |
45 |
- public ResponseEntity<?> listProc(@RequestBody HashMap<String, String> params) throws Exception { |
|
42 |
+ public ResponseEntity<?> listProc(@RequestBody HashMap<String, String> params){ |
|
46 | 43 |
HashMap<String, Object> result = lgnHstryService.lgnHstryList(params); |
47 | 44 |
|
48 | 45 |
// 응답 처리 |
--- src/main/java/com/takensoft/cms/mber/web/MberController.java
+++ src/main/java/com/takensoft/cms/mber/web/MberController.java
... | ... | @@ -38,34 +38,27 @@ |
38 | 38 |
private final ResponseUtil resUtil; |
39 | 39 |
|
40 | 40 |
/** |
41 |
- * @author takensoft |
|
42 |
- * @since 2024.04.16 |
|
43 |
- * @param |
|
44 |
- * @return |
|
45 |
- * @throws Exception |
|
41 |
+ * @param params - 부서 아이디 |
|
42 |
+ * @return ResponseEntity - 회원정보 상세 조회 응답 결과 |
|
46 | 43 |
* |
47 | 44 |
* 회원정보 상세 조회 |
48 | 45 |
*/ |
49 | 46 |
@PostMapping(value = "/findByMbr.json") |
50 |
- public ResponseEntity<?> findByMbr(@RequestBody HashMap<String, Object> params) throws Exception { |
|
47 |
+ public ResponseEntity<?> findByMbr(@RequestBody HashMap<String, Object> params){ |
|
51 | 48 |
// 상세 조회 |
52 | 49 |
MberVO result = mberService.findByMbr(params); |
53 | 50 |
|
54 | 51 |
// 응답 처리 |
55 | 52 |
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); |
56 | 53 |
} |
57 |
- |
|
58 | 54 |
/** |
59 |
- * @author takensoft |
|
60 |
- * @since 2024.04.15 |
|
61 |
- * @param passwordDTO |
|
62 |
- * @return |
|
63 |
- * @throws Exception |
|
55 |
+ * @param passwordDTO - 비밀번호 |
|
56 |
+ * @return ResponseEntity - 비밀번호 변경 결과 |
|
64 | 57 |
* |
65 | 58 |
* 비밀번호 변경 |
66 | 59 |
*/ |
67 | 60 |
@PostMapping(value = "/updatePassword.json") |
68 |
- public ResponseEntity<?> joinProc(@RequestBody @Valid PasswordDTO passwordDTO) throws Exception { |
|
61 |
+ public ResponseEntity<?> joinProc(@RequestBody @Valid PasswordDTO passwordDTO){ |
|
69 | 62 |
// 비밀 번호 비교 |
70 | 63 |
boolean isExistence = mberService.passwordCheck(passwordDTO); |
71 | 64 |
|
--- src/main/java/com/takensoft/cms/mber/web/RefreshTokenController.java
+++ src/main/java/com/takensoft/cms/mber/web/RefreshTokenController.java
... | ... | @@ -36,19 +36,15 @@ |
36 | 36 |
private final RefreshTokenService refreshTokenService; |
37 | 37 |
|
38 | 38 |
/** |
39 |
- * @author takensoft |
|
40 |
- * @since 2024.04.04 |
|
41 |
- * @return |
|
42 |
- * @throws Exception |
|
39 |
+ * @param req - HTTP 요청 객체 |
|
40 |
+ * @param res - HTTP 응답 객체 |
|
41 |
+ * @return ResponseEntity - 로그아웃 응답 결과 |
|
42 |
+ * |
|
43 | 43 |
* 로그아웃 |
44 | 44 |
*/ |
45 | 45 |
@PostMapping(value = "/mbr/logout.json") |
46 |
- public ResponseEntity<?> logout(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
46 |
+ public ResponseEntity<?> logout(HttpServletRequest req, HttpServletResponse res){ |
|
47 | 47 |
int result = refreshTokenService.deleteByRefresh(req, res); |
48 |
- // 응답 처리 |
|
49 |
- HttpHeaders headers = new HttpHeaders(); |
|
50 |
- headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8"))); |
|
51 |
- ResponseData responseData = new ResponseData(); |
|
52 | 48 |
if(result > 0) { |
53 | 49 |
Cookie cookie = new Cookie("refresh", null); |
54 | 50 |
cookie.setMaxAge(0); // 생명주기 |
... | ... | @@ -63,14 +59,14 @@ |
63 | 59 |
} |
64 | 60 |
|
65 | 61 |
/** |
66 |
- * @author takensoft |
|
67 |
- * @since 2024.04.04 |
|
68 |
- * @return |
|
69 |
- * @throws Exception |
|
62 |
+ * @param req - HTTP 요청 객체 |
|
63 |
+ * @param res - HTTP 응답 객체 |
|
64 |
+ * @return ResponseEntity - 토큰 재발급 응답 결과 |
|
65 |
+ * |
|
70 | 66 |
* 토큰 재발급 |
71 | 67 |
*/ |
72 | 68 |
@PostMapping("/refresh/tokenReissue.json") |
73 |
- public ResponseEntity<?> tokenReissue(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
69 |
+ public ResponseEntity<?> tokenReissue(HttpServletRequest req, HttpServletResponse res) { |
|
74 | 70 |
int result = refreshTokenService.tokenReissueProc(req, res); |
75 | 71 |
|
76 | 72 |
// 응답 처리 |
--- src/main/java/com/takensoft/cms/popup/service/Impl/PopupServiceImpl.java
+++ src/main/java/com/takensoft/cms/popup/service/Impl/PopupServiceImpl.java
... | ... | @@ -21,8 +21,6 @@ |
21 | 21 |
import org.springframework.transaction.annotation.Transactional; |
22 | 22 |
import org.springframework.web.multipart.MultipartFile; |
23 | 23 |
|
24 |
-import java.io.IOException; |
|
25 |
-import java.net.UnknownHostException; |
|
26 | 24 |
import java.util.*; |
27 | 25 |
|
28 | 26 |
/** |
--- src/main/java/com/takensoft/cms/popup/web/PopupController.java
+++ src/main/java/com/takensoft/cms/popup/web/PopupController.java
... | ... | @@ -16,8 +16,6 @@ |
16 | 16 |
import org.springframework.web.bind.annotation.*; |
17 | 17 |
import org.springframework.web.multipart.MultipartFile; |
18 | 18 |
|
19 |
-import java.net.UnknownHostException; |
|
20 |
-import java.nio.charset.Charset; |
|
21 | 19 |
import java.util.*; |
22 | 20 |
|
23 | 21 |
/** |
--- src/main/java/com/takensoft/cms/prvcInqHstry/service/Impl/PrvcInqHstryServiceImpl.java
+++ src/main/java/com/takensoft/cms/prvcInqHstry/service/Impl/PrvcInqHstryServiceImpl.java
... | ... | @@ -2,14 +2,12 @@ |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.codeManage.service.CodeManageService; |
4 | 4 |
import com.takensoft.cms.codeManage.vo.CodeManageVO; |
5 |
-import com.takensoft.cms.popup.vo.PopupVO; |
|
6 | 5 |
import com.takensoft.cms.prvcInqHstry.dao.PrvcInqHstryDAO; |
7 | 6 |
import com.takensoft.cms.prvcInqHstry.service.PrvcInqHstryService; |
8 | 7 |
import com.takensoft.cms.prvcInqHstry.vo.PrvcInqHstryVO; |
9 | 8 |
import com.takensoft.common.Pagination; |
10 | 9 |
import com.takensoft.common.exception.CustomInsertFailException; |
11 |
-import com.takensoft.common.exception.CustomNotFoundException; |
|
12 |
-import com.takensoft.common.util.CommonUtils; |
|
10 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
13 | 11 |
import com.takensoft.common.util.JWTUtil; |
14 | 12 |
import lombok.RequiredArgsConstructor; |
15 | 13 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
... | ... | @@ -40,7 +38,7 @@ |
40 | 38 |
public class PrvcInqHstryServiceImpl extends EgovAbstractServiceImpl implements PrvcInqHstryService { |
41 | 39 |
|
42 | 40 |
private final JWTUtil jwtUtil; |
43 |
- private final CommonUtils commonUtils; |
|
41 |
+ private final HttpRequestUtil httpRequestUtil; |
|
44 | 42 |
private final PrvcInqHstryDAO prvcInqHstryDAO; |
45 | 43 |
private final CodeManageService codeManageService; |
46 | 44 |
|
... | ... | @@ -51,7 +49,6 @@ |
51 | 49 |
* @throws CustomInsertFailException - 등록 실패 예외 발생 시 |
52 | 50 |
* @throws DataAccessException - 데이터베이스 접근 예외 발생 시 |
53 | 51 |
* @throws NullPointerException - Null 값이 발생할 경우 |
54 |
- * @throws UnknownHostException - 호스트의 IP정보를 알 수 없는 경우 |
|
55 | 52 |
* @throws Exception - 그 외 예외 발생 시 |
56 | 53 |
* |
57 | 54 |
* 개인정보 조회 이력 등록 |
... | ... | @@ -59,7 +56,7 @@ |
59 | 56 |
public int prvcInqHstryInsert(HttpServletRequest request, PrvcInqHstryVO prvcInqHstryVO) { |
60 | 57 |
try { |
61 | 58 |
// 조회 아이피 삽입 |
62 |
- String ipAdd = commonUtils.getIp(request); |
|
59 |
+ String ipAdd = httpRequestUtil.getIp(request); |
|
63 | 60 |
prvcInqHstryVO.setInqIp(ipAdd); |
64 | 61 |
|
65 | 62 |
// 조회자 삽입 |
... | ... | @@ -74,8 +71,6 @@ |
74 | 71 |
throw dae; |
75 | 72 |
} catch (NullPointerException ne) { |
76 | 73 |
throw ne; |
77 |
- } catch (UnknownHostException ukhe) { |
|
78 |
- throw new RuntimeException("호스트의 IP정보를 알 수가 없습니다.", ukhe); |
|
79 | 74 |
} catch (Exception e) { |
80 | 75 |
throw e; |
81 | 76 |
} |
--- src/main/java/com/takensoft/common/config/CommonConfig.java
+++ src/main/java/com/takensoft/common/config/CommonConfig.java
... | ... | @@ -12,10 +12,23 @@ |
12 | 12 |
import org.springframework.context.annotation.Configuration; |
13 | 13 |
import org.springframework.util.AntPathMatcher; |
14 | 14 |
import org.springframework.web.servlet.view.json.MappingJackson2JsonView; |
15 |
- |
|
15 |
+/** |
|
16 |
+ * @author takensoft |
|
17 |
+ * @since 2025.01.22 |
|
18 |
+ * @modification |
|
19 |
+ * since | author | description |
|
20 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
21 |
+ * |
|
22 |
+ * 기본 설정을 위한 Config |
|
23 |
+ */ |
|
16 | 24 |
@Configuration |
17 | 25 |
public class CommonConfig { |
18 | 26 |
|
27 |
+ /** |
|
28 |
+ * @return MappingJackson2JsonView - JSON 응답을 위한 뷰 객체 |
|
29 |
+ * |
|
30 |
+ * JSON 응답을 반환할 때 사용하는 Jackson ObjectMapper를 설정하여, 모델에서 값을 추출하는 방식으로 JSON 응답을 생성 |
|
31 |
+ */ |
|
19 | 32 |
@Bean(name="jsonView") |
20 | 33 |
public MappingJackson2JsonView getJsonView () { |
21 | 34 |
ObjectMapper objectMapper = getObjectMapper(); |
... | ... | @@ -23,7 +36,12 @@ |
23 | 36 |
jsonView.setExtractValueFromSingleKeyModel(true); |
24 | 37 |
return jsonView; |
25 | 38 |
} |
26 |
- |
|
39 |
+ /** |
|
40 |
+ * @return ObjectMapper - JSON 직렬화 및 역직렬화를 위한 객체 |
|
41 |
+ * |
|
42 |
+ * Java Time API를 위한 모듈을 등록하고, 날짜 포맷을 설정하는 등 ObjectMapper를 커스터마이즈하여 JSON 변환 |
|
43 |
+ * |
|
44 |
+ */ |
|
27 | 45 |
@Bean(name = "objectMapper") |
28 | 46 |
public ObjectMapper getObjectMapper() { |
29 | 47 |
ObjectMapper mapper = new ObjectMapper(); |
... | ... | @@ -39,17 +57,29 @@ |
39 | 57 |
|
40 | 58 |
return mapper; |
41 | 59 |
} |
42 |
- |
|
60 |
+ /** |
|
61 |
+ * @return AntPathMatcher - 경로 패턴 매칭을 위한 객체 |
|
62 |
+ * |
|
63 |
+ * 경로 패턴을 매칭하여 URL 경로를 처리하는 데 사용되는 객체를 반환 |
|
64 |
+ */ |
|
43 | 65 |
@Bean |
44 | 66 |
public AntPathMatcher antPathMatcher() { |
45 | 67 |
return new AntPathMatcher(); |
46 | 68 |
} |
47 |
- |
|
69 |
+ /** |
|
70 |
+ * @return DefaultTraceHandler - 추적 처리를 위한 기본 핸들러 |
|
71 |
+ * |
|
72 |
+ * 추적 요청을 처리하는 기본 핸들러를 반환 |
|
73 |
+ */ |
|
48 | 74 |
@Bean |
49 | 75 |
public DefaultTraceHandler defaultTraceHandler() { |
50 | 76 |
return new DefaultTraceHandler(); |
51 | 77 |
} |
52 |
- |
|
78 |
+ /** |
|
79 |
+ * @return DefaultTraceHandleManager - 추적 핸들러 관리 서비스 객체 |
|
80 |
+ * |
|
81 |
+ * 여러 추적 핸들러와 경로 매칭 설정을 관리하는 서비스를 제공 |
|
82 |
+ */ |
|
53 | 83 |
@Bean |
54 | 84 |
public DefaultTraceHandleManager traceHandlerService() { |
55 | 85 |
DefaultTraceHandleManager defaultTraceHandleManager = new DefaultTraceHandleManager(); |
... | ... | @@ -58,7 +88,11 @@ |
58 | 88 |
defaultTraceHandleManager.setHandlers(new TraceHandler[]{defaultTraceHandler()}); |
59 | 89 |
return defaultTraceHandleManager; |
60 | 90 |
} |
61 |
- |
|
91 |
+ /** |
|
92 |
+ * @return LeaveaTrace - 추적 기능을 위한 LeaveaTrace 객체 |
|
93 |
+ * |
|
94 |
+ * 추적 핸들러 서비스를 설정하여 추적 기능을 활성화 |
|
95 |
+ */ |
|
62 | 96 |
@Bean |
63 | 97 |
public LeaveaTrace leaveaTrace() { |
64 | 98 |
LeaveaTrace leaveaTrace = new LeaveaTrace(); |
... | ... | @@ -66,4 +100,6 @@ |
66 | 100 |
return leaveaTrace; |
67 | 101 |
} |
68 | 102 |
|
103 |
+ |
|
104 |
+ |
|
69 | 105 |
} |
--- src/main/java/com/takensoft/common/config/CorsMvcConfig.java
+++ src/main/java/com/takensoft/common/config/CorsMvcConfig.java
... | ... | @@ -1,22 +1,58 @@ |
1 | 1 |
package com.takensoft.common.config; |
2 | 2 |
|
3 | 3 |
import org.springframework.beans.factory.annotation.Value; |
4 |
+import org.springframework.context.annotation.Bean; |
|
4 | 5 |
import org.springframework.context.annotation.Configuration; |
6 |
+import org.springframework.web.servlet.LocaleResolver; |
|
5 | 7 |
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
6 | 8 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
9 |
+import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; |
|
7 | 10 |
|
11 |
+import java.util.Locale; |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * @author : takensoft |
|
15 |
+ * @since : 2025.01.22 |
|
16 |
+ * @modification |
|
17 |
+ * since | author | description |
|
18 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
19 |
+ * |
|
20 |
+ * WebMvcConfigurer - pring MVC에서 제공하는 인터페이스 ( Spring의 기본 설정을 커스터마이징하는 데 사용 ) |
|
21 |
+ * |
|
22 |
+ * CORS(Cross-Origin Resource Sharing) 설정을 위한 Config |
|
23 |
+ */ |
|
8 | 24 |
@Configuration |
9 | 25 |
public class CorsMvcConfig implements WebMvcConfigurer { |
10 | 26 |
|
11 | 27 |
private static String FRONT_URL; // 프론트 경로 |
28 |
+ /** |
|
29 |
+ * @param value - 프론트 경로 (application.yml에서 값을 읽어 옴) |
|
30 |
+ * |
|
31 |
+ * 프론트엔드 URL을 설정 |
|
32 |
+ */ |
|
12 | 33 |
@Value("${front.url}") |
13 | 34 |
public void setFrontUrl(String value) { |
14 | 35 |
FRONT_URL = value; |
15 | 36 |
} |
16 |
- |
|
37 |
+ /** |
|
38 |
+ * @param corsRegistry - CORS 매핑을 관리하는 객체 |
|
39 |
+ * |
|
40 |
+ * CORS 매핑 설정을 추가 |
|
41 |
+ */ |
|
17 | 42 |
@Override |
18 | 43 |
public void addCorsMappings(CorsRegistry corsRegistry) { |
19 | 44 |
corsRegistry.addMapping("/**") |
20 | 45 |
.allowedOrigins(FRONT_URL); |
21 | 46 |
} |
47 |
+ /** |
|
48 |
+ * @return LocaleResolver 객체 (기본 로케일을 한국으로 설정) |
|
49 |
+ * |
|
50 |
+ * 다국어 지원을 위한 LocaleResolver |
|
51 |
+ */ |
|
52 |
+ @Bean |
|
53 |
+ public LocaleResolver localeResolver() { |
|
54 |
+ AcceptHeaderLocaleResolver resolver = new AcceptHeaderLocaleResolver(); |
|
55 |
+ resolver.setDefaultLocale(Locale.KOREA); |
|
56 |
+ return resolver; |
|
57 |
+ } |
|
22 | 58 |
}(파일 끝에 줄바꿈 문자 없음) |
+++ src/main/java/com/takensoft/common/config/RedisConfig.java
... | ... | @@ -0,0 +1,65 @@ |
1 | +package com.takensoft.common.config; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Value; | |
4 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
5 | +import org.springframework.context.annotation.Bean; | |
6 | +import org.springframework.context.annotation.Configuration; | |
7 | +import org.springframework.data.redis.connection.RedisConnectionFactory; | |
8 | +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | |
9 | +import org.springframework.data.redis.core.RedisTemplate; | |
10 | +import org.springframework.data.redis.serializer.StringRedisSerializer; | |
11 | + | |
12 | +/** | |
13 | + * @author takensoft | |
14 | + * @since 2025.03.12 | |
15 | + * @modification | |
16 | + * since | author | description | |
17 | + * 2025.03.12 | takensoft | 최초 등록 | |
18 | + * | |
19 | + * redis 설정을 위한 Config | |
20 | + */ | |
21 | + | |
22 | +@Configuration | |
23 | +public class RedisConfig { | |
24 | + | |
25 | + @Value("${redis.host}") | |
26 | + private String redisHost; | |
27 | + @Value("${redis.port}") | |
28 | + private int redisPort; | |
29 | + | |
30 | + @Value("${config.allow-multiple-logins}") // 기본값 false (중복 로그인 비허용) | |
31 | + private boolean allowMultipleLogin; | |
32 | + | |
33 | + @Bean | |
34 | + @ConditionalOnProperty(name = "config.allow-multiple-logins", havingValue = "false", matchIfMissing = true) //redis 사용 안 할 경우 빈 등록x | |
35 | + public RedisConnectionFactory redisConnectionFactory() { | |
36 | + return new LettuceConnectionFactory(redisHost, redisPort); | |
37 | + } | |
38 | + @Bean | |
39 | + @ConditionalOnProperty(name = "config.allow-multiple-logins", havingValue = "false", matchIfMissing = true) //redis 사용 안 할 경우 빈 등록x | |
40 | + public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | |
41 | + RedisTemplate<String, String> redisTemp = new RedisTemplate<>(); | |
42 | + redisTemp.setConnectionFactory(redisConnectionFactory); | |
43 | + redisTemp.setKeySerializer(new StringRedisSerializer()); | |
44 | + redisTemp.setValueSerializer(new StringRedisSerializer()); | |
45 | + return redisTemp; | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * @return allowMultipleLogin - 중복로그인 허용/비허용 반환 | |
50 | + * | |
51 | + * 중복 로그인 허용 여부를 반환하는 메서드 | |
52 | + */ | |
53 | + public boolean isAllowMultipleLogin() { | |
54 | + return allowMultipleLogin; | |
55 | + } | |
56 | + /** | |
57 | + * @return allowMultipleLogin - 중복로그인 허용/비허용 반환 | |
58 | + * | |
59 | + * 관리자가 설정을 변경할 수 있도록 Setter 추가 | |
60 | + */ | |
61 | + public void setAllowMultipleLogin(boolean allowMultipleLogin) { | |
62 | + this.allowMultipleLogin = allowMultipleLogin; | |
63 | + } | |
64 | + | |
65 | +} |
--- src/main/java/com/takensoft/common/config/SecurityConfig.java
+++ src/main/java/com/takensoft/common/config/SecurityConfig.java
... | ... | @@ -6,13 +6,14 @@ |
6 | 6 |
import com.takensoft.common.filter.AccesFilter; |
7 | 7 |
import com.takensoft.common.filter.JWTFilter; |
8 | 8 |
import com.takensoft.common.filter.LoginFilter; |
9 |
-import com.takensoft.common.util.CommonUtils; |
|
9 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
10 | 10 |
import com.takensoft.common.exception.CustomAccessDenieHandler; |
11 | 11 |
import com.takensoft.common.exception.CustomAuthenticationEntryPoint; |
12 | 12 |
import com.takensoft.common.util.JWTUtil; |
13 | 13 |
import org.springframework.beans.factory.annotation.Value; |
14 | 14 |
import org.springframework.context.annotation.Bean; |
15 | 15 |
import org.springframework.context.annotation.Configuration; |
16 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
16 | 17 |
import org.springframework.security.authentication.AuthenticationManager; |
17 | 18 |
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; |
18 | 19 |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
... | ... | @@ -29,9 +30,12 @@ |
29 | 30 |
|
30 | 31 |
/** |
31 | 32 |
* @author takensoft |
32 |
- * @since 2024.04.01 |
|
33 |
- * |
|
34 |
- * 스프링 시큐리티 설정 |
|
33 |
+ * @since 2025.01.22 |
|
34 |
+ * @modification |
|
35 |
+ * since | author | description |
|
36 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
37 |
+ * |
|
38 |
+ * Spring Security 설정을 위한 Config |
|
35 | 39 |
*/ |
36 | 40 |
@Configuration |
37 | 41 |
@EnableWebSecurity |
... | ... | @@ -45,17 +49,33 @@ |
45 | 49 |
private final AccesCtrlService accesCtrlService; |
46 | 50 |
private final CustomAuthenticationEntryPoint authenticationEntryPoint; |
47 | 51 |
private final CustomAccessDenieHandler accessDenieHandler; |
48 |
- private final CommonUtils commonUtils; |
|
52 |
+ private final HttpRequestUtil httpRequestUtil; |
|
49 | 53 |
private final CommonConfig commonConfig; |
54 |
+ private final RedisConfig redisConfig; |
|
50 | 55 |
|
51 | 56 |
private static String FRONT_URL; // 프론트 접근 허용 URL |
52 | 57 |
private static long JWT_ACCESSTIME; // access 토큰 유지 시간 |
53 | 58 |
private static long JWT_REFRESHTIME; // refresh 토큰 유지 시간 |
54 | 59 |
private static int COOKIE_TIME; // 쿠키 유지 시간 |
55 | 60 |
|
56 |
- public SecurityConfig(AuthenticationConfiguration authenticationConfiguration, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, AccesCtrlService accesCtrlService, CommonConfig commonConfig, |
|
57 |
- LgnHstryService lgnHstryService, CustomAuthenticationEntryPoint authenticationEntryPoint, CustomAccessDenieHandler accessDenieHandler, CommonUtils commonUtils, |
|
58 |
- @Value("${front.url}")String fUrl,@Value("${jwt.accessTime}")long aTime, @Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime) { |
|
61 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
62 |
+ |
|
63 |
+ /** |
|
64 |
+ * @param fUrl - 프론트엔드 URL (application.yml에서 값을 읽어 옴) |
|
65 |
+ * @param aTime - JWT 접근 토큰 유효 시간 (application.yml에서 값을 읽어 옴) |
|
66 |
+ * @param rTime - JWT 리프레시 토큰 유효 시간 (application.yml에서 값을 읽어 옴) |
|
67 |
+ * @param ctime - 쿠키 유효 시간 (application.yml에서 값을 읽어 옴) |
|
68 |
+ * @param authenticationConfiguration - 인증 구성 객체 |
|
69 |
+ * @param authenticationEntryPoint - 인증 실패 시 처리 엔트리 포인트 |
|
70 |
+ * @param accessDenieHandler - 접근 거부 처리 핸들러 |
|
71 |
+ * @param jwtUtil - JWT 유틸리티 객체 |
|
72 |
+ * @param redisTemplate |
|
73 |
+ * |
|
74 |
+ * SecurityConfig 생성자 |
|
75 |
+ */ |
|
76 |
+ public SecurityConfig(AuthenticationConfiguration authenticationConfiguration, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, AccesCtrlService accesCtrlService, CommonConfig commonConfig, RedisConfig redisConfig, |
|
77 |
+ LgnHstryService lgnHstryService, CustomAuthenticationEntryPoint authenticationEntryPoint, CustomAccessDenieHandler accessDenieHandler, HttpRequestUtil httpRequestUtil, |
|
78 |
+ @Value("${front.url}")String fUrl, @Value("${jwt.accessTime}")long aTime, @Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime, RedisTemplate<String, String> redisTemplate) { |
|
59 | 79 |
|
60 | 80 |
this.authenticationConfiguration = authenticationConfiguration; |
61 | 81 |
this.refreshTokenService = refreshTokenService; |
... | ... | @@ -64,27 +84,46 @@ |
64 | 84 |
this.authenticationEntryPoint = authenticationEntryPoint; |
65 | 85 |
this.accessDenieHandler = accessDenieHandler; |
66 | 86 |
this.jwtUtil = jwtUtil; |
67 |
- this.commonUtils = commonUtils; |
|
87 |
+ this.httpRequestUtil = httpRequestUtil; |
|
68 | 88 |
this.commonConfig = commonConfig; |
89 |
+ this.redisConfig = redisConfig; |
|
69 | 90 |
|
70 | 91 |
this.FRONT_URL = fUrl; |
71 | 92 |
this.JWT_ACCESSTIME = aTime; |
72 | 93 |
this.JWT_REFRESHTIME = rTime; |
73 | 94 |
this.COOKIE_TIME = ctime; |
95 |
+ this.redisTemplate = redisTemplate; |
|
74 | 96 |
} |
75 | 97 |
|
76 |
- // AuthenticationManager Bean 등록 |
|
98 |
+ /** |
|
99 |
+ * @param configuration - 인증 구성 객체 |
|
100 |
+ * @return AuthenticationManager 객체 |
|
101 |
+ * @throws Exception - 인증 관리자 초기화 실패 시 |
|
102 |
+ * |
|
103 |
+ * AuthenticationManager Bean 등록 |
|
104 |
+ */ |
|
77 | 105 |
@Bean |
78 | 106 |
public AuthenticationManager authenticationManager(AuthenticationConfiguration configuration) throws Exception { |
79 | 107 |
return configuration.getAuthenticationManager(); |
80 | 108 |
} |
81 | 109 |
|
82 |
- // 해시 암호화 |
|
110 |
+ /** |
|
111 |
+ * @return BCryptPasswordEncoder 객체 |
|
112 |
+ * |
|
113 |
+ * 비밀번호 해시 암호화를 위한 Bean 등록 |
|
114 |
+ */ |
|
83 | 115 |
@Bean |
84 | 116 |
public BCryptPasswordEncoder bCryptPasswordEncoder() { |
85 | 117 |
return new BCryptPasswordEncoder(); |
86 | 118 |
} |
87 | 119 |
|
120 |
+ /** |
|
121 |
+ * @param http - HTTP 보안 설정 객체 |
|
122 |
+ * @return SecurityFilterChain 객체 |
|
123 |
+ * @throws Exception - 보안 필터 체인 초기화 실패 시 |
|
124 |
+ * |
|
125 |
+ * Spring Security 필터 체인 설정 |
|
126 |
+ */ |
|
88 | 127 |
@Bean |
89 | 128 |
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { |
90 | 129 |
http.cors((cors) -> cors |
... | ... | @@ -124,11 +163,17 @@ |
124 | 163 |
// .anyRequest().permitAll() // 모든 사용자 접근 가능 |
125 | 164 |
); |
126 | 165 |
|
166 |
+ // 로그인 방식에 따라 필터 적용 (JWT vs 세션) |
|
167 |
+ /* if ("SESSION".equals(authConfig.getLoginType())) { |
|
168 |
+ http.addFilterBefore(sessionAuthFilter, LoginFilter.class); // 세션 인증 필터 추가 |
|
169 |
+ } else { |
|
170 |
+ http.addFilterBefore(new JWTFilter(jwtUtil, commonConfig, redisConfig, redisTemplate), LoginFilter.class); // JWT 인증 필터 추가 |
|
171 |
+ }*/ |
|
127 | 172 |
|
128 |
- http.addFilterBefore(new JWTFilter(jwtUtil, commonConfig), LoginFilter.class); // 토큰 검증 필터 |
|
129 |
- http.addFilterBefore(new AccesFilter(accesCtrlService, commonUtils, commonConfig), JWTFilter.class); // 아이피 검증 |
|
130 |
- http.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, refreshTokenService, lgnHstryService, commonUtils, |
|
131 |
- commonConfig, JWT_ACCESSTIME, JWT_REFRESHTIME, COOKIE_TIME), UsernamePasswordAuthenticationFilter.class); // 로그인 필터 |
|
173 |
+ http.addFilterBefore(new JWTFilter(jwtUtil, commonConfig, redisConfig, redisTemplate), LoginFilter.class); // 토큰 검증 필터 |
|
174 |
+ http.addFilterBefore(new AccesFilter(accesCtrlService, httpRequestUtil, commonConfig), JWTFilter.class); // 아이피 검증 |
|
175 |
+ http.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, refreshTokenService, lgnHstryService, httpRequestUtil, |
|
176 |
+ commonConfig,redisConfig, JWT_ACCESSTIME, JWT_REFRESHTIME, COOKIE_TIME, redisTemplate), UsernamePasswordAuthenticationFilter.class); // 로그인 필터 |
|
132 | 177 |
|
133 | 178 |
return http.build(); |
134 | 179 |
} |
--- src/main/java/com/takensoft/common/config/UmsDataSourceConfig.java
... | ... | @@ -1,56 +0,0 @@ |
1 | -package com.takensoft.common.config; | |
2 | - | |
3 | - | |
4 | -import org.apache.ibatis.session.SqlSessionFactory; | |
5 | -import org.mybatis.spring.SqlSessionFactoryBean; | |
6 | -import org.mybatis.spring.SqlSessionTemplate; | |
7 | -import org.mybatis.spring.annotation.MapperScan; | |
8 | -import org.springframework.beans.factory.annotation.Qualifier; | |
9 | -import org.springframework.boot.context.properties.ConfigurationProperties; | |
10 | -import org.springframework.boot.jdbc.DataSourceBuilder; | |
11 | -import org.springframework.context.ApplicationContext; | |
12 | -import org.springframework.context.annotation.Bean; | |
13 | -import org.springframework.context.annotation.Configuration; | |
14 | -import org.springframework.web.context.WebApplicationContext; | |
15 | - | |
16 | -import javax.sql.DataSource; | |
17 | - | |
18 | -@Configuration | |
19 | -@MapperScan(basePackages="com.takensoft.ums.dao", sqlSessionFactoryRef = "umsSqlSessionFactory") | |
20 | -public class UmsDataSourceConfig { | |
21 | - @Bean(name = "umsDataSource") | |
22 | - @ConfigurationProperties(prefix="spring.ums.datasource") | |
23 | - public DataSource umsDataSource() { | |
24 | - return DataSourceBuilder.create().build(); | |
25 | - } | |
26 | - | |
27 | - @Bean(name = "umsSqlSessionFactory") | |
28 | - public SqlSessionFactory umsSqlSessionFactory(@Qualifier("umsDataSource") DataSource umsDataSource, | |
29 | - ApplicationContext applicationContext) throws Exception { | |
30 | - SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); | |
31 | - sqlSessionFactoryBean.setDataSource(umsDataSource); | |
32 | - sqlSessionFactoryBean.setTypeAliasesPackage("com.takensoft.ums.vo"); | |
33 | - sqlSessionFactoryBean.setMapperLocations(applicationContext.getResources("classpath:mybatis/mapper-ora/**/*-SQL.xml")); | |
34 | - | |
35 | - // MyBatis Configuration 설정 추가 | |
36 | - org.apache.ibatis.session.Configuration myBatisConfig = new org.apache.ibatis.session.Configuration(); | |
37 | - myBatisConfig.setCacheEnabled(true); | |
38 | - myBatisConfig.setLazyLoadingEnabled(false); | |
39 | - myBatisConfig.setMultipleResultSetsEnabled(true); | |
40 | - myBatisConfig.setUseColumnLabel(true); | |
41 | - myBatisConfig.setUseGeneratedKeys(false); | |
42 | - myBatisConfig.setDefaultExecutorType(org.apache.ibatis.session.ExecutorType.SIMPLE); | |
43 | - myBatisConfig.setDefaultStatementTimeout(25000); | |
44 | - myBatisConfig.setCallSettersOnNulls(true); | |
45 | - myBatisConfig.setMapUnderscoreToCamelCase(true); | |
46 | - | |
47 | - sqlSessionFactoryBean.setConfiguration(myBatisConfig); | |
48 | - | |
49 | - return sqlSessionFactoryBean.getObject(); | |
50 | - } | |
51 | - | |
52 | - @Bean(name = "umsSessionTemplate") | |
53 | - public SqlSessionTemplate umsSqlSessionTemplate(@Qualifier("umsSqlSessionFactory") SqlSessionFactory umsSqlSessionFactory) { | |
54 | - return new SqlSessionTemplate(umsSqlSessionFactory); | |
55 | - } | |
56 | -} |
--- src/main/java/com/takensoft/common/config/WebConfig.java
+++ src/main/java/com/takensoft/common/config/WebConfig.java
... | ... | @@ -6,14 +6,31 @@ |
6 | 6 |
import org.springframework.web.filter.ForwardedHeaderFilter; |
7 | 7 |
|
8 | 8 |
import jakarta.servlet.Filter; |
9 |
- |
|
9 |
+/** |
|
10 |
+ * @author : takensoft |
|
11 |
+ * @since : 2025.01.22 |
|
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
15 |
+ * |
|
16 |
+ * Web 관련 설정을 위한 COnfig |
|
17 |
+ */ |
|
10 | 18 |
@Configuration |
11 | 19 |
public class WebConfig { |
20 |
+ /** |
|
21 |
+ * @return ForwardedHeaderFilter |
|
22 |
+ * |
|
23 |
+ * ForwardedHeaderFilter를 사용하여 HTTP 요청의 헤더 정보(특히 Forwarded 및 X-Forwarded-* 헤더)를 적절히 처리할 수 있도록 필터를 추가 |
|
24 |
+ */ |
|
12 | 25 |
@Bean |
13 | 26 |
public Filter forwardedHeaderFilter() { |
14 | 27 |
return new ForwardedHeaderFilter(); |
15 | 28 |
} |
16 |
- |
|
29 |
+ /** |
|
30 |
+ * @return @return CommonsRequestLoggingFilter |
|
31 |
+ * |
|
32 |
+ * CommonsRequestLoggingFilter를 사용하여 HTTP 요청 로깅을 설정 |
|
33 |
+ */ |
|
17 | 34 |
@Bean |
18 | 35 |
public CommonsRequestLoggingFilter requestLoggingFilter() { |
19 | 36 |
CommonsRequestLoggingFilter loggingFilter = new CommonsRequestLoggingFilter(); |
--- src/main/java/com/takensoft/common/exception/FilterExceptionHandler.java
+++ src/main/java/com/takensoft/common/exception/FilterExceptionHandler.java
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 |
private static void errorRes(HttpServletResponse res, MessageCode messageCode) throws IOException { |
76 | 76 |
/* |
77 | 77 |
* Accept-Language가 header에 있으면 해당 언어에 맞게 호출 [ ko: 한국어, en: 영어 ] |
78 |
- * header에 Accept-Language가 없다면 한국어를 기본으로함. |
|
78 |
+ * header에 Accept-Language가 없다면 한국어를 기본으로함 |
|
79 | 79 |
* 다국어 메시지 적용 |
80 | 80 |
*/ |
81 | 81 |
String message = messageSource.getMessage(messageCode.getMessageKey(), null, LocaleContextHolder.getLocale()); |
--- src/main/java/com/takensoft/common/file/web/FileController.java
+++ src/main/java/com/takensoft/common/file/web/FileController.java
... | ... | @@ -72,7 +72,7 @@ |
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
@PostMapping("/postImageUpload.file") |
75 |
- public Map<String, Object> handleFileUpload(@RequestPart("upload") MultipartFile file) throws Exception { |
|
75 |
+ public Map<String, Object> handleFileUpload(@RequestPart("upload") MultipartFile file){ |
|
76 | 76 |
Map<String, Object> response = new HashMap<>(); |
77 | 77 |
|
78 | 78 |
String uploadPath = fileService.editorUploadImg(file); |
--- src/main/java/com/takensoft/common/filter/AccesFilter.java
+++ src/main/java/com/takensoft/common/filter/AccesFilter.java
... | ... | @@ -1,10 +1,9 @@ |
1 | 1 |
package com.takensoft.common.filter; |
2 | 2 |
|
3 | 3 |
import com.takensoft.cms.accesCtrl.service.AccesCtrlService; |
4 |
-import com.takensoft.cms.accesCtrl.service.SystemAccesCtrlService; |
|
5 | 4 |
import com.takensoft.cms.accesCtrl.vo.AccesCtrlVO; |
6 | 5 |
import com.takensoft.common.config.CommonConfig; |
7 |
-import com.takensoft.common.util.CommonUtils; |
|
6 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
8 | 7 |
import com.takensoft.common.util.ErrorResponse; |
9 | 8 |
import org.springframework.http.HttpStatus; |
10 | 9 |
import org.springframework.http.MediaType; |
... | ... | @@ -25,15 +24,15 @@ |
25 | 24 |
* |
26 | 25 |
* Access(아이피) 검증 필터 |
27 | 26 |
*/ |
28 |
-public class AccesFilter extends OncePerRequestFilter { |
|
27 |
+public class AccesFilter extends OncePerRequestFilter { |
|
29 | 28 |
|
30 | 29 |
private final AccesCtrlService accesCtrlService; |
31 |
- private final CommonUtils commonUtils; |
|
30 |
+ private final HttpRequestUtil httpRequestUtil; |
|
32 | 31 |
private final CommonConfig commonConfig; |
33 | 32 |
|
34 |
- public AccesFilter(AccesCtrlService accesCtrlService, CommonUtils commonUtils, CommonConfig commonConfig) { |
|
33 |
+ public AccesFilter(AccesCtrlService accesCtrlService, HttpRequestUtil httpRequestUtil, CommonConfig commonConfig) { |
|
35 | 34 |
this.accesCtrlService = accesCtrlService; |
36 |
- this.commonUtils = commonUtils; |
|
35 |
+ this.httpRequestUtil = httpRequestUtil; |
|
37 | 36 |
this.commonConfig = commonConfig; |
38 | 37 |
} |
39 | 38 |
|
... | ... | @@ -41,7 +40,7 @@ |
41 | 40 |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
42 | 41 |
try { |
43 | 42 |
// 아이피 정보 |
44 |
- String ipAdrs = commonUtils.getIp(request); |
|
43 |
+ String ipAdrs = httpRequestUtil.getIp(request); |
|
45 | 44 |
// 접근 제어 정보 조회 |
46 | 45 |
List<AccesCtrlVO> accesCtrlList = accesCtrlService.findAllAccesCtrlSecurity(ipAdrs); |
47 | 46 |
|
--- src/main/java/com/takensoft/common/filter/JWTFilter.java
+++ src/main/java/com/takensoft/common/filter/JWTFilter.java
... | ... | @@ -1,13 +1,14 @@ |
1 | 1 |
package com.takensoft.common.filter; |
2 | 2 |
|
3 |
-import com.fasterxml.jackson.databind.ObjectMapper; |
|
4 | 3 |
import com.takensoft.cms.mber.vo.MberAuthorVO; |
5 | 4 |
import com.takensoft.cms.mber.vo.MberVO; |
6 | 5 |
import com.takensoft.common.config.CommonConfig; |
6 |
+import com.takensoft.common.config.RedisConfig; |
|
7 | 7 |
import com.takensoft.common.util.ErrorResponse; |
8 | 8 |
import com.takensoft.common.util.JWTUtil; |
9 | 9 |
import io.jsonwebtoken.ExpiredJwtException; |
10 | 10 |
import io.jsonwebtoken.JwtException; |
11 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
11 | 12 |
import org.springframework.http.HttpStatus; |
12 | 13 |
import org.springframework.http.MediaType; |
13 | 14 |
import org.springframework.security.authentication.InsufficientAuthenticationException; |
... | ... | @@ -23,48 +24,93 @@ |
23 | 24 |
import java.io.IOException; |
24 | 25 |
import java.time.LocalDateTime; |
25 | 26 |
import java.util.List; |
26 |
- |
|
27 | 27 |
/** |
28 | 28 |
* @author takensoft |
29 | 29 |
* @since 2024.04.01 |
30 |
+ * @modification |
|
31 |
+ * since | author | description |
|
32 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
30 | 33 |
* |
31 |
- * JWT - Access 토큰 검증 필터 |
|
34 |
+ * OncePerRequestFilter - 한 번의 요청마다 단 한 번만 필터링 작업을 수행하는 필터를 제공하는 클래스 |
|
35 |
+ * |
|
36 |
+ * JWT 토큰 검증 Filter |
|
32 | 37 |
*/ |
33 | 38 |
public class JWTFilter extends OncePerRequestFilter { |
34 | 39 |
|
35 | 40 |
private final JWTUtil jwtUtil; |
36 | 41 |
private final CommonConfig commonConfig; |
37 |
- public JWTFilter(JWTUtil jwtUtil, CommonConfig commonConfig) { |
|
42 |
+ private final RedisConfig redisConfig; |
|
43 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
44 |
+ /** |
|
45 |
+ * @param jwtUtil JWT 유틸리티 클래스의 인스턴스 |
|
46 |
+ * |
|
47 |
+ * JWTFilter 생성자 |
|
48 |
+ */ |
|
49 |
+ public JWTFilter(JWTUtil jwtUtil, CommonConfig commonConfig, RedisConfig redisConfig, RedisTemplate<String, String> redisTemplate) { |
|
38 | 50 |
this.jwtUtil = jwtUtil; |
39 | 51 |
this.commonConfig = commonConfig; |
52 |
+ this.redisConfig = redisConfig; |
|
53 |
+ this.redisTemplate = redisTemplate; |
|
40 | 54 |
} |
41 |
- |
|
55 |
+ /** |
|
56 |
+ * @param request HttpServletRequest 객체 |
|
57 |
+ * @param response HttpServletResponse 객체 |
|
58 |
+ * @param filterChain 필터 체인을 통해 다음 필터로 요청을 전달 |
|
59 |
+ * @throws ServletException 필터 처리 중 발생한 서블릿 예외 |
|
60 |
+ * @throws IOException 필터 처리 중 발생한 IO 예외 |
|
61 |
+ * |
|
62 |
+ * JWT 토큰 검증 |
|
63 |
+ */ |
|
42 | 64 |
@Override |
43 | 65 |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
44 |
- // 헤더에서 access에 대한 토큰을 꺼냄 |
|
45 |
- String accessToken = request.getHeader("Authorization"); |
|
46 |
- // 토큰이 없다면 다음 필터로 넘김 |
|
47 |
- if(accessToken == null) { |
|
48 |
- filterChain.doFilter(request, response); |
|
49 |
- return; |
|
50 |
- } |
|
51 | 66 |
try { |
67 |
+ // 헤더에서 access에 대한 토큰을 꺼냄 |
|
68 |
+ String accessToken = request.getHeader("Authorization"); |
|
69 |
+ // 토큰이 없다면 다음 필터로 넘김 |
|
70 |
+ if(accessToken == null) { |
|
71 |
+ filterChain.doFilter(request, response); |
|
72 |
+ return; |
|
73 |
+ } |
|
74 |
+ |
|
52 | 75 |
// 토큰 만료 여부 검증 |
53 | 76 |
if(jwtUtil.isExpired(accessToken)) { |
54 | 77 |
throw new JwtException("Token expired"); |
55 | 78 |
} |
56 | 79 |
// 토큰에서 페이로드 확인[ 발급시 명시 ] |
57 |
- String category = jwtUtil.getCategory(accessToken); |
|
58 |
- if(!category.equals("Authorization")) { |
|
59 |
- throw new JwtException("Wrong Token"); |
|
60 |
- } |
|
61 |
- // 토큰에서 사용자 정보 추출 |
|
62 |
- MberVO mber = new MberVO(); |
|
63 |
- List<MberAuthorVO> roles = jwtUtil.getRoles(accessToken); |
|
64 |
- mber.setLgnId(jwtUtil.getLgnId(accessToken)); |
|
65 |
- mber.setMbrId(jwtUtil.getMbrId(accessToken)); |
|
66 |
- mber.setAuthorList(roles); |
|
80 |
+ String category = (String) jwtUtil.getClaim(accessToken, "category"); |
|
67 | 81 |
|
82 |
+ |
|
83 |
+ MberVO mber = new MberVO( |
|
84 |
+ (String) jwtUtil.getClaim(accessToken, "mbrId") |
|
85 |
+ , (String) jwtUtil.getClaim(accessToken, "lgnId") |
|
86 |
+ , (List<MberAuthorVO>) jwtUtil.getClaim(accessToken, "roles") |
|
87 |
+ ); |
|
88 |
+ |
|
89 |
+ // 중복 로그인 비허용 설정이면 Redis에서 최신 JWT 가져와 비교 |
|
90 |
+ String userId = jwtUtil.getMbrId(accessToken); |
|
91 |
+ if (!redisConfig.isAllowMultipleLogin()) { |
|
92 |
+ String storedToken = redisTemplate.opsForValue().get("jwt:" + userId); |
|
93 |
+ if (storedToken == null) { |
|
94 |
+ System.out.println("Redis에 저장된 JWT 없음 (첫 로그인)"); |
|
95 |
+ } else if (!storedToken.equals(accessToken)) { |
|
96 |
+ System.out.println("JWT 불일치: Redis=" + storedToken + " / 클라이언트=" + accessToken); |
|
97 |
+ |
|
98 |
+ response.setContentType(MediaType.APPLICATION_JSON_VALUE); |
|
99 |
+ response.setStatus(HttpStatus.UNAUTHORIZED.value()); |
|
100 |
+ |
|
101 |
+ ErrorResponse errorResponse = new ErrorResponse(); |
|
102 |
+ errorResponse.setMessage("다른 기기에서 로그인되었습니다."); |
|
103 |
+ errorResponse.setPath(request.getRequestURI()); |
|
104 |
+ errorResponse.setError(HttpStatus.UNAUTHORIZED.getReasonPhrase()); |
|
105 |
+ errorResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); |
|
106 |
+ errorResponse.setTimestamp(LocalDateTime.now()); |
|
107 |
+ // 응답 헤더 설정 및 json 응답 전송 |
|
108 |
+ response.setContentType(MediaType.APPLICATION_JSON_VALUE); |
|
109 |
+ response.setStatus(HttpStatus.UNAUTHORIZED.value()); |
|
110 |
+ response.getOutputStream().write(commonConfig.getObjectMapper().writeValueAsBytes(errorResponse)); |
|
111 |
+ return; |
|
112 |
+ } |
|
113 |
+ } |
|
68 | 114 |
// 시큐리티 컨텍스트에 사용자 정보 설정 |
69 | 115 |
Authentication authToken = new UsernamePasswordAuthenticationToken(mber, null, mber.getAuthorities()); |
70 | 116 |
SecurityContextHolder.getContext().setAuthentication(authToken); |
--- src/main/java/com/takensoft/common/filter/LoginFilter.java
+++ src/main/java/com/takensoft/common/filter/LoginFilter.java
... | ... | @@ -8,13 +8,14 @@ |
8 | 8 |
import com.takensoft.cms.mber.vo.MberVO; |
9 | 9 |
import com.takensoft.cms.mber.vo.RefreshVO; |
10 | 10 |
import com.takensoft.common.config.CommonConfig; |
11 |
-import com.takensoft.common.util.CommonUtils; |
|
12 |
-import com.takensoft.common.util.ErrorResponse; |
|
11 |
+import com.takensoft.common.config.RedisConfig; |
|
12 |
+import com.takensoft.common.exception.FilterExceptionHandler; |
|
13 |
+import com.takensoft.common.util.HttpRequestUtil; |
|
13 | 14 |
import com.takensoft.common.util.JWTUtil; |
14 | 15 |
import lombok.SneakyThrows; |
15 | 16 |
import org.springframework.beans.factory.annotation.Value; |
17 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
16 | 18 |
import org.springframework.http.HttpStatus; |
17 |
-import org.springframework.http.MediaType; |
|
18 | 19 |
import org.springframework.security.authentication.AuthenticationManager; |
19 | 20 |
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
20 | 21 |
import org.springframework.security.core.Authentication; |
... | ... | @@ -27,14 +28,19 @@ |
27 | 28 |
import jakarta.servlet.http.HttpServletRequest; |
28 | 29 |
import jakarta.servlet.http.HttpServletResponse; |
29 | 30 |
import java.io.IOException; |
30 |
-import java.time.LocalDateTime; |
|
31 | 31 |
import java.util.List; |
32 |
+import java.util.concurrent.TimeUnit; |
|
32 | 33 |
|
33 | 34 |
/** |
34 | 35 |
* @author takensoft |
35 | 36 |
* @since 2024.04.01 |
37 |
+ * @modification |
|
38 |
+ * since | author | description |
|
39 |
+ * 2024.04.01 | takensoft | 최초 등록 |
|
36 | 40 |
* |
37 |
- * 로그인 필터 |
|
41 |
+ * UsernamePasswordAuthenticationFilter - Spring Security에서 사용자 로그인 요청을 처리하는 필터 클래스 |
|
42 |
+ * |
|
43 |
+ * 사용자 로그인 요청을 처리하는 Filter |
|
38 | 44 |
*/ |
39 | 45 |
public class LoginFilter extends UsernamePasswordAuthenticationFilter { |
40 | 46 |
|
... | ... | @@ -42,34 +48,50 @@ |
42 | 48 |
private final JWTUtil jwtUtil; |
43 | 49 |
private final RefreshTokenService refreshTokenService; |
44 | 50 |
private final LgnHstryService lgnHstryService; |
45 |
- private final CommonUtils commonUtils; |
|
51 |
+ private final HttpRequestUtil httpRequestUtil; |
|
46 | 52 |
private final CommonConfig commonConfig; |
53 |
+ private final RedisConfig redisConfig; |
|
47 | 54 |
|
48 | 55 |
private static long JWT_ACCESSTIME; // access 토큰 유지 시간 |
49 | 56 |
private static long JWT_REFRESHTIME; // refresh 토큰 유지 시간 |
50 | 57 |
private static int COOKIE_TIME; // 쿠키 유지 시간 |
51 | 58 |
|
52 |
- public LoginFilter(AuthenticationManager authenticationManager, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, LgnHstryService lgnHstryService, CommonUtils commonUtils, |
|
53 |
- CommonConfig commonConfig, @Value("${jwt.accessTime}")long aTime, @Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime) { |
|
59 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
60 |
+ /** |
|
61 |
+ * @param aTime - 액세스 토큰의 유효 시간 (application.yml에서 값을 읽어 옴) |
|
62 |
+ * @param rTime - 리프레시 토큰의 유효 시간 (application.yml에서 값을 읽어 옴) |
|
63 |
+ * @param ctime - 쿠키의 유효 시간 (application.yml에서 값을 읽어 옴) |
|
64 |
+ * @param authenticationManager - 인증 관리자 |
|
65 |
+ * @param jwtUtil - JWT 유틸리티 |
|
66 |
+ * |
|
67 |
+ * LoginFilter 생성자 |
|
68 |
+ */ |
|
69 |
+ public LoginFilter(AuthenticationManager authenticationManager, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, LgnHstryService lgnHstryService, HttpRequestUtil httpRequestUtil, |
|
70 |
+ CommonConfig commonConfig, RedisConfig redisConfig, @Value("${jwt.accessTime}")long aTime, @Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime, RedisTemplate<String, String> redisTemplate) { |
|
54 | 71 |
this.authenticationManager = authenticationManager; |
55 | 72 |
this.jwtUtil = jwtUtil; |
56 | 73 |
this.refreshTokenService = refreshTokenService; |
57 | 74 |
this.lgnHstryService = lgnHstryService; |
58 |
- this.commonUtils = commonUtils; |
|
75 |
+ this.httpRequestUtil = httpRequestUtil; |
|
59 | 76 |
this.commonConfig = commonConfig; |
60 |
- |
|
77 |
+ this.redisConfig = redisConfig; |
|
61 | 78 |
|
62 | 79 |
this.JWT_ACCESSTIME = aTime; |
63 | 80 |
this.JWT_REFRESHTIME = rTime; |
64 | 81 |
this.COOKIE_TIME = ctime; |
82 |
+ this.redisTemplate = redisTemplate; |
|
83 |
+ |
|
65 | 84 |
|
66 | 85 |
this.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/mbr/loginProc.json","POST")); |
67 | 86 |
} |
68 | 87 |
|
69 | 88 |
/** |
70 |
- * @author takensoft |
|
71 |
- * @since 2024.04.03 |
|
72 |
- * 로그인 검증 |
|
89 |
+ * @param req - HTTP 요청 객체 |
|
90 |
+ * @param res - HTTP 응답 객체 |
|
91 |
+ * @return 인증 정보 |
|
92 |
+ * @throws AuthenticationException - 인증 예외 |
|
93 |
+ * |
|
94 |
+ * 로그인 요청을 처리 ( 사용자가 입력한 로그인 정보로 인증 시도 ) |
|
73 | 95 |
*/ |
74 | 96 |
@SneakyThrows |
75 | 97 |
@Override |
... | ... | @@ -88,9 +110,14 @@ |
88 | 110 |
} |
89 | 111 |
|
90 | 112 |
/** |
91 |
- * @author takensoft |
|
92 |
- * @since 2024.04.03 |
|
93 |
- * 로그인 성공시 실행하는 메서드 -> JWT 발급 |
|
113 |
+ * @param req - HTTP 요청 객체 |
|
114 |
+ * @param res - HTTP 응답 객체 |
|
115 |
+ * @param chain - 필터 체인 |
|
116 |
+ * @param authentication - 인증된 사용자 정보 |
|
117 |
+ * @throws IOException - IO 예외 |
|
118 |
+ * @throws ServletException - 서블릿 예외 |
|
119 |
+ * |
|
120 |
+ * 로그인 인증 성공 시 |
|
94 | 121 |
*/ |
95 | 122 |
@SneakyThrows |
96 | 123 |
@Override |
... | ... | @@ -105,10 +132,10 @@ |
105 | 132 |
} else { |
106 | 133 |
lgnHstryVO.setLgnType("1"); |
107 | 134 |
} |
108 |
- lgnHstryVO.setCntnIp(commonUtils.getIp(req)); |
|
109 |
- lgnHstryVO.setCntnOperSys(commonUtils.getOS(commonUtils.getUserAgent(req))); |
|
110 |
- lgnHstryVO.setDeviceNm(commonUtils.getDevice(commonUtils.getUserAgent(req))); |
|
111 |
- lgnHstryVO.setBrwsrNm(commonUtils.getBrowser(commonUtils.getUserAgent(req))); |
|
135 |
+ lgnHstryVO.setCntnIp(httpRequestUtil.getIp(req)); |
|
136 |
+ lgnHstryVO.setCntnOperSys(httpRequestUtil.getOS(httpRequestUtil.getUserAgent(req))); |
|
137 |
+ lgnHstryVO.setDeviceNm(httpRequestUtil.getDevice(httpRequestUtil.getUserAgent(req))); |
|
138 |
+ lgnHstryVO.setBrwsrNm(httpRequestUtil.getBrowser(httpRequestUtil.getUserAgent(req))); |
|
112 | 139 |
lgnHstryService.LgnHstrySave(lgnHstryVO); |
113 | 140 |
|
114 | 141 |
// 토큰 생성(access, refresh) |
... | ... | @@ -127,6 +154,12 @@ |
127 | 154 |
refresh.setToken(refreshToken); |
128 | 155 |
refreshTokenService.saveRefreshToken(req, res, refresh, JWT_REFRESHTIME); |
129 | 156 |
|
157 |
+ // Redis에 AccessToken 저장 (중복 로그인 비허용 설정일 때) |
|
158 |
+ if (!redisConfig.isAllowMultipleLogin()) { |
|
159 |
+ redisTemplate.delete("jwt:" + mber.getMbrId()); // 기존 JWT 삭제 |
|
160 |
+ redisTemplate.opsForValue().set("jwt:" + mber.getMbrId(), accessToken, JWT_ACCESSTIME, TimeUnit.MILLISECONDS); |
|
161 |
+ } |
|
162 |
+ |
|
130 | 163 |
// 응답설정 |
131 | 164 |
res.setHeader("Authorization", accessToken); |
132 | 165 |
// res.setHeader("refresh", refreshToken); |
... | ... | @@ -136,28 +169,16 @@ |
136 | 169 |
} |
137 | 170 |
|
138 | 171 |
/** |
139 |
- * @author takensoft |
|
140 |
- * @since 2024.04.04 |
|
141 |
- * 로그인 실패시 실행하는 메소드 |
|
172 |
+ * @param req - HTTP 요청 객체 |
|
173 |
+ * @param res - HTTP 응답 객체 |
|
174 |
+ * @param failed - 인증 예외 |
|
175 |
+ * @throws IOException - IO 예외 |
|
176 |
+ * @throws ServletException - 서블릿 예외 |
|
177 |
+ * |
|
178 |
+ * 로그인 인증 실패 시 |
|
142 | 179 |
*/ |
143 | 180 |
@Override |
144 | 181 |
protected void unsuccessfulAuthentication(HttpServletRequest req, HttpServletResponse res, AuthenticationException failed) throws IOException, ServletException { |
145 |
- |
|
146 |
- ErrorResponse errorResponse = new ErrorResponse(); |
|
147 |
- // 에러 내용 |
|
148 |
- errorResponse.setMessage("아이디 혹은 비밀번호를 잘못 입력하셨습니다."); |
|
149 |
- errorResponse.setPath(req.getRequestURI()); |
|
150 |
- errorResponse.setError(HttpStatus.UNAUTHORIZED.getReasonPhrase()); |
|
151 |
- errorResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); |
|
152 |
- errorResponse.setTimestamp(LocalDateTime.now()); |
|
153 |
- |
|
154 |
- // 문자 인코딩 |
|
155 |
- req.setCharacterEncoding("UTF-8"); |
|
156 |
- res.setCharacterEncoding("UTF-8"); |
|
157 |
- |
|
158 |
- // 응답설정 |
|
159 |
- res.setContentType(MediaType.APPLICATION_JSON_VALUE); |
|
160 |
- res.setStatus(HttpStatus.UNAUTHORIZED.value()); |
|
161 |
- res.getOutputStream().write(commonConfig.getObjectMapper().writeValueAsBytes(errorResponse)); |
|
182 |
+ FilterExceptionHandler.loginError(res, failed); |
|
162 | 183 |
} |
163 | 184 |
} |
+++ src/main/java/com/takensoft/common/filter/SessionAuthFilter.java
... | ... | @@ -0,0 +1,67 @@ |
1 | +package com.takensoft.common.filter; | |
2 | + | |
3 | +import com.takensoft.common.util.JWTUtil; | |
4 | +import jakarta.servlet.FilterChain; | |
5 | +import jakarta.servlet.ServletException; | |
6 | +import jakarta.servlet.http.HttpServletRequest; | |
7 | +import jakarta.servlet.http.HttpServletResponse; | |
8 | +import org.springframework.web.filter.OncePerRequestFilter; | |
9 | + | |
10 | +import java.io.IOException; | |
11 | + | |
12 | +/** | |
13 | + * @author takensoft | |
14 | + * @since 2024.03.20 | |
15 | + * @modification | |
16 | + * since | author | description | |
17 | + * 2024.03.20 | takensoft | 최초 등록 | |
18 | + * | |
19 | + * OncePerRequestFilter - 한 번의 요청마다 단 한 번만 필터링 작업을 수행하는 필터를 제공하는 클래스 | |
20 | + * | |
21 | + * 세션 검증 Filter | |
22 | + */ | |
23 | +public class SessionAuthFilter extends OncePerRequestFilter { | |
24 | + | |
25 | + private final JWTUtil jwtUtil; | |
26 | + | |
27 | + public SessionAuthFilter(JWTUtil jwtUtil) { | |
28 | + this.jwtUtil = jwtUtil; | |
29 | + } | |
30 | + | |
31 | + @Override | |
32 | + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | |
33 | + throws ServletException, IOException { | |
34 | +/* | |
35 | + // 현재 로그인 방식 확인 | |
36 | + if (!"SESSION".equals(authConfig.getLoginType())) { | |
37 | + filterChain.doFilter(request, response); | |
38 | + return; | |
39 | + } | |
40 | + | |
41 | + HttpSession session = request.getSession(false); | |
42 | + if (session == null || session.getAttribute("JWT_TOKEN") == null) { | |
43 | + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); | |
44 | + return; | |
45 | + } | |
46 | + | |
47 | + String accessToken = (String) session.getAttribute("JWT_TOKEN"); | |
48 | + | |
49 | + // JWT 검증 | |
50 | + if (jwtUtil.isExpired(accessToken)) { | |
51 | + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Token expired"); | |
52 | + return; | |
53 | + } | |
54 | + MberVO mber = new MberVO(); | |
55 | + List<MberAuthorVO> roles = jwtUtil.getRoles(accessToken); | |
56 | + mber.setLgnId(jwtUtil.getLgnId(accessToken)); | |
57 | + mber.setMbrId(jwtUtil.getMbrId(accessToken)); | |
58 | + mber.setAuthorList(roles); | |
59 | + | |
60 | + // 사용자 정보 추출 후 SecurityContext에 저장 | |
61 | + UsernamePasswordAuthenticationToken authentication = | |
62 | + new UsernamePasswordAuthenticationToken(mber, null, mber.getAuthorities()); | |
63 | + SecurityContextHolder.getContext().setAuthentication(authentication); | |
64 | + | |
65 | + filterChain.doFilter(request, response);*/ | |
66 | + } | |
67 | +}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/common/idgen/dao/IdgenMapper.java
+++ src/main/java/com/takensoft/common/idgen/dao/IdgenMapper.java
... | ... | @@ -4,25 +4,30 @@ |
4 | 4 |
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
5 | 5 |
|
6 | 6 |
/** |
7 |
- * @author :takensoft |
|
8 |
- * @since : 2024.04.01 |
|
7 |
+ * @author takensoft |
|
8 |
+ * @since 2025.01.22 |
|
9 |
+ * @modification |
|
10 |
+ * since | author | description |
|
11 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
9 | 12 |
* |
10 |
- * Idgen 관련 Mapper |
|
13 |
+ * 고유 아이디 관련 DAO |
|
11 | 14 |
*/ |
12 | 15 |
@Mapper |
13 | 16 |
public interface IdgenMapper { |
14 | 17 |
|
15 | 18 |
/** |
16 |
- * 테이블명으로 시퀀스 조회 |
|
17 |
- * @author takensoft |
|
18 |
- * @since 2024.04.01 |
|
19 |
+ * @param tblNm - 테이블명 |
|
20 |
+ * @return IdgenVO - 테이블에 해당하는 마지막 아이디 정보 |
|
21 |
+ * |
|
22 |
+ * 특정 테이블에 대해 마지막으로 사용된 아이디 값을 조회 |
|
19 | 23 |
*/ |
20 | 24 |
IdgenVO selectNextId(String tblNm); |
21 | 25 |
|
22 | 26 |
/** |
23 |
- * 시퀀스 등록 및 수정 |
|
24 |
- * @author takensoft |
|
25 |
- * @since 2024.04.01 |
|
27 |
+ * @param idgenVO - 아이디 정보 객체 |
|
28 |
+ * @return int - 삽입 또는 업데이트된 행의 수 |
|
29 |
+ * |
|
30 |
+ * 새로운 아이디 값을 테이블에 삽입하거나 기존의 아이디 값을 업데이트 |
|
26 | 31 |
*/ |
27 | 32 |
void upsertSeqNmg(IdgenVO idgenVO); |
28 | 33 |
|
--- src/main/java/com/takensoft/common/idgen/service/IdgenService.java
+++ src/main/java/com/takensoft/common/idgen/service/IdgenService.java
... | ... | @@ -8,7 +8,15 @@ |
8 | 8 |
import org.apache.commons.logging.Log; |
9 | 9 |
import org.apache.commons.logging.LogFactory; |
10 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
11 |
- |
|
11 |
+/** |
|
12 |
+ * @author takensoft |
|
13 |
+ * @since 2025.01.22 |
|
14 |
+ * @modification |
|
15 |
+ * since | author | description |
|
16 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
17 |
+ * |
|
18 |
+ * 고유 아이디 관련 서비스 |
|
19 |
+ */ |
|
12 | 20 |
@Setter |
13 | 21 |
@Getter |
14 | 22 |
public class IdgenService { |
... | ... | @@ -21,7 +29,12 @@ |
21 | 29 |
|
22 | 30 |
@Autowired |
23 | 31 |
private IdgenMapper idgenMapper; |
24 |
- |
|
32 |
+ /** |
|
33 |
+ * @return 생성된 고유 아이디 값 |
|
34 |
+ * |
|
35 |
+ * 지정된 테이블에 대한 다음 고유 ID를 생성하여 반환 |
|
36 |
+ * 새로 생성되는 경우 아이디 값은 1부터 시작하며, 기존 값은 1씩 증가하여 업데이트 |
|
37 |
+ */ |
|
25 | 38 |
public String getNextStringId() { |
26 | 39 |
IdgenVO idgenVO = idgenMapper.selectNextId(tblNm); // 다음 아이디값 조회 |
27 | 40 |
boolean firstFlag = false; // 신규 생성인지 확인 |
--- src/main/java/com/takensoft/common/idgen/vo/IdgenVO.java
+++ src/main/java/com/takensoft/common/idgen/vo/IdgenVO.java
... | ... | @@ -6,13 +6,22 @@ |
6 | 6 |
|
7 | 7 |
import java.io.Serializable; |
8 | 8 |
|
9 |
-@SuppressWarnings("serial") |
|
9 |
+/** |
|
10 |
+ * @author takensoft |
|
11 |
+ * @since 2025.01.22 |
|
12 |
+ * @modification |
|
13 |
+ * since | author | description |
|
14 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
15 |
+ * |
|
16 |
+ * Serializable - 객체를 직렬화할 수 있게 해주는 인터페이스 |
|
17 |
+ * |
|
18 |
+ * 고유 아이디 관련 VO |
|
19 |
+ */ |
|
10 | 20 |
@NoArgsConstructor |
11 | 21 |
@Getter |
12 | 22 |
@Setter |
13 | 23 |
public class IdgenVO implements Serializable { |
14 |
- // 테이블 이름 |
|
15 |
- private String tblNm; |
|
16 |
- // 다음 아이디 |
|
17 |
- private int aftrId; |
|
24 |
+ |
|
25 |
+ private String tblNm; // 테이블명 |
|
26 |
+ private int aftrId; // ID값 |
|
18 | 27 |
} |
--- src/main/java/com/takensoft/common/util/CommonUtils.java
... | ... | @@ -1,107 +0,0 @@ |
1 | -package com.takensoft.common.util; | |
2 | - | |
3 | -import org.springframework.stereotype.Component; | |
4 | - | |
5 | -import jakarta.servlet.http.HttpServletRequest; | |
6 | -import java.net.InetAddress; | |
7 | -import java.net.UnknownHostException; | |
8 | - | |
9 | -@Component | |
10 | -public class CommonUtils { | |
11 | - | |
12 | - // 사용자 아이피 주소 | |
13 | - public String getIp(HttpServletRequest req) throws UnknownHostException { | |
14 | - String ip = req.getHeader("X-Forwarded-For"); | |
15 | - | |
16 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
17 | - ip = req.getHeader("Proxy-Client-IP"); | |
18 | - } | |
19 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
20 | - ip = req.getHeader("WL-Proxy-Client-IP"); | |
21 | - } | |
22 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
23 | - ip = req.getHeader("HTTP_CLIENT_IP"); | |
24 | - } | |
25 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
26 | - ip = req.getHeader("HTTP_X_FORWARDED_FOR"); | |
27 | - } | |
28 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
29 | - ip = req.getHeader("X-Real-IP"); | |
30 | - } | |
31 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
32 | - ip = req.getHeader("X-RealIP"); | |
33 | - } | |
34 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
35 | - ip = req.getHeader("REMOTE_ADDR"); | |
36 | - } | |
37 | - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
38 | - ip = req.getRemoteAddr(); | |
39 | - } | |
40 | - | |
41 | - if(ip.equals("0:0:0:0:0:0:0:1") || ip.equals("127.0.0.1") || ip.equals("::1")) { | |
42 | - InetAddress adr = InetAddress.getLocalHost(); | |
43 | - ip = adr.getHostAddress(); | |
44 | -// ip = adr.getHostName() + "/" + adr.getHostAddress(); | |
45 | - } else if (ip.startsWith("::ffff:")) { | |
46 | - ip = ip.substring(7); // ::ffff:를 제거하고 IPv4 주소만 추출 | |
47 | - } | |
48 | - | |
49 | - return ip; | |
50 | - } | |
51 | - | |
52 | - // HTTP 요청에서 User-Agent 해더 추출 | |
53 | - public static String getUserAgent(HttpServletRequest req) { | |
54 | - return req.getHeader("User-Agent"); | |
55 | - } | |
56 | - | |
57 | - // 운영체제 정보 추출 | |
58 | - public static String getOS(String userAgent) { | |
59 | - String os = "Unknown"; | |
60 | - | |
61 | - // userAgent 문자열에서 운영체제 정보 추출 | |
62 | - if(userAgent != null && !userAgent.isEmpty()) { | |
63 | - if(userAgent.toLowerCase().contains("windows")) { | |
64 | - os = "Windows"; | |
65 | - } else if(userAgent.toLowerCase().contains("mac")) { | |
66 | - os = "Mac"; | |
67 | - } else if(userAgent.toLowerCase().contains("linux")) { | |
68 | - os = "Linux"; | |
69 | - } | |
70 | - } | |
71 | - return os; | |
72 | - } | |
73 | - | |
74 | - // 디바이스 정보 추출 | |
75 | - public static String getDevice(String userAgent) { | |
76 | - String device = "Unknown"; | |
77 | - // userAgent 문자열에서 디바이스 정보 추출 | |
78 | - if(userAgent != null && !userAgent.isEmpty()) { | |
79 | - if(userAgent.toLowerCase().contains("mobile")) { | |
80 | - device = "Mobile"; | |
81 | - } else { | |
82 | - device = "Desktop"; | |
83 | - } | |
84 | - } | |
85 | - return device; | |
86 | - } | |
87 | - | |
88 | - // 브라우저 정보 추출 | |
89 | - public static String getBrowser(String userAgent) { | |
90 | - String browser = "Unknown"; | |
91 | - // userAgent 문자열에서 브라우저저 정보추출 | |
92 | - if(userAgent != null && !userAgent.isEmpty()) { | |
93 | - if(userAgent.toLowerCase().contains("msie")) { | |
94 | - browser = "Internet Explorer"; | |
95 | - } else if(userAgent.toLowerCase().contains("firefox")) { | |
96 | - browser = "Firefox"; | |
97 | - } else if(userAgent.toLowerCase().contains("chrome")) { | |
98 | - browser = "Chrome"; | |
99 | - } else if(userAgent.toLowerCase().contains("safari")) { | |
100 | - browser = "Safari"; | |
101 | - } else if(userAgent.toLowerCase().contains("edge")) { | |
102 | - browser = "Edge"; | |
103 | - } | |
104 | - } | |
105 | - return browser; | |
106 | - } | |
107 | -} |
--- src/main/java/com/takensoft/common/util/FileUtil.java
+++ src/main/java/com/takensoft/common/util/FileUtil.java
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 |
|
3 | 3 |
import org.springframework.stereotype.Component; |
4 | 4 |
|
5 |
-import java.net.InetAddress; |
|
6 |
-import java.net.UnknownHostException; |
|
7 | 5 |
|
8 | 6 |
/** |
9 | 7 |
* @author 하석형 |
+++ src/main/java/com/takensoft/common/util/HttpRequestUtil.java
... | ... | @@ -0,0 +1,148 @@ |
1 | +package com.takensoft.common.util; | |
2 | + | |
3 | +import org.springframework.dao.DataAccessException; | |
4 | +import org.springframework.stereotype.Component; | |
5 | + | |
6 | +import jakarta.servlet.http.HttpServletRequest; | |
7 | +import java.net.InetAddress; | |
8 | +import java.net.UnknownHostException; | |
9 | +/** | |
10 | + * @author : takensoft | |
11 | + * @since : 2025.01.22 | |
12 | + * @modification | |
13 | + * since | author | description | |
14 | + * 2025.01.22 | takensoft | 최초 등록 | |
15 | + * | |
16 | + * HTTP 요청 관련 유틸리티 | |
17 | + */ | |
18 | +@Component | |
19 | +public class HttpRequestUtil { | |
20 | + | |
21 | + /** | |
22 | + * @param req - HTTP 요청 객체 | |
23 | + * @return 클라이언트 IP 주소 (String) | |
24 | + * @throws UnknownHostException - 로컬 IP 주소를 확인할 수 없는 경우 | |
25 | + * | |
26 | + * HTTP 요청에서 클라이언트의 IP 주소를 반환 | |
27 | + */ | |
28 | + public String getIp(HttpServletRequest req){ | |
29 | + try { | |
30 | + String ip = req.getHeader("X-Forwarded-For"); | |
31 | + | |
32 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
33 | + ip = req.getHeader("Proxy-Client-IP"); | |
34 | + } | |
35 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
36 | + ip = req.getHeader("WL-Proxy-Client-IP"); | |
37 | + } | |
38 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
39 | + ip = req.getHeader("HTTP_CLIENT_IP"); | |
40 | + } | |
41 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
42 | + ip = req.getHeader("HTTP_X_FORWARDED_FOR"); | |
43 | + } | |
44 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
45 | + ip = req.getHeader("X-Real-IP"); | |
46 | + } | |
47 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
48 | + ip = req.getHeader("X-RealIP"); | |
49 | + } | |
50 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
51 | + ip = req.getHeader("REMOTE_ADDR"); | |
52 | + } | |
53 | + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | |
54 | + ip = req.getRemoteAddr(); | |
55 | + } | |
56 | + | |
57 | + if(ip.equals("0:0:0:0:0:0:0:1") || ip.equals("127.0.0.1") || ip.equals("::1")) { | |
58 | + InetAddress adr = InetAddress.getLocalHost(); | |
59 | + ip = adr.getHostAddress(); | |
60 | + // ip = adr.getHostName() + "/" + adr.getHostAddress(); | |
61 | + } else if (ip.startsWith("::ffff:")) { | |
62 | + ip = ip.substring(7); // ::ffff:를 제거하고 IPv4 주소만 추출 | |
63 | + } | |
64 | + return ip; | |
65 | + | |
66 | + } catch (UnknownHostException Uhe) { | |
67 | + throw new RuntimeException("호스트 IP의 정보를 알 수가 없습니다.", Uhe); | |
68 | + } catch (Exception e) { | |
69 | + throw e; | |
70 | + } | |
71 | + } | |
72 | + | |
73 | + /** | |
74 | + * @param req - HTTP 요청 객체 | |
75 | + * @return User-Agent (String) | |
76 | + * | |
77 | + * HTTP 요청에서 User-Agent 헤더 값을 추출 | |
78 | + */ | |
79 | + public static String getUserAgent(HttpServletRequest req) { | |
80 | + return req.getHeader("User-Agent"); | |
81 | + } | |
82 | + | |
83 | + /** | |
84 | + * @param userAgent - User-Agent | |
85 | + * @return 운영체제 이름 (String) | |
86 | + * | |
87 | + * User-Agent에서 운영체제 정보를 추출 | |
88 | + */ | |
89 | + public static String getOS(String userAgent) { | |
90 | + String os = "Unknown"; | |
91 | + | |
92 | + // userAgent 문자열에서 운영체제 정보 추출 | |
93 | + if(userAgent != null && !userAgent.isEmpty()) { | |
94 | + if(userAgent.toLowerCase().contains("windows")) { | |
95 | + os = "Windows"; | |
96 | + } else if(userAgent.toLowerCase().contains("mac")) { | |
97 | + os = "Mac"; | |
98 | + } else if(userAgent.toLowerCase().contains("linux")) { | |
99 | + os = "Linux"; | |
100 | + } | |
101 | + } | |
102 | + return os; | |
103 | + } | |
104 | + | |
105 | + /** | |
106 | + * @param userAgent - User-Agent | |
107 | + * @return 디바이스 이름 (String) | |
108 | + * | |
109 | + * User-Agent에서 디바이스 정보를 추출 | |
110 | + */ | |
111 | + public static String getDevice(String userAgent) { | |
112 | + String device = "Unknown"; | |
113 | + // userAgent 문자열에서 디바이스 정보 추출 | |
114 | + if(userAgent != null && !userAgent.isEmpty()) { | |
115 | + if(userAgent.toLowerCase().contains("mobile")) { | |
116 | + device = "Mobile"; | |
117 | + } else { | |
118 | + device = "Desktop"; | |
119 | + } | |
120 | + } | |
121 | + return device; | |
122 | + } | |
123 | + | |
124 | + /** | |
125 | + * @param userAgent - User-Agent | |
126 | + * @return 브라우저 이름 (String) | |
127 | + * | |
128 | + * User-Agent에서 브라우저 정보를 추출 | |
129 | + */ | |
130 | + public static String getBrowser(String userAgent) { | |
131 | + String browser = "Unknown"; | |
132 | + // userAgent 문자열에서 브라우저저 정보추출 | |
133 | + if(userAgent != null && !userAgent.isEmpty()) { | |
134 | + if(userAgent.toLowerCase().contains("msie")) { | |
135 | + browser = "Internet Explorer"; | |
136 | + } else if(userAgent.toLowerCase().contains("firefox")) { | |
137 | + browser = "Firefox"; | |
138 | + } else if(userAgent.toLowerCase().contains("chrome")) { | |
139 | + browser = "Chrome"; | |
140 | + } else if(userAgent.toLowerCase().contains("safari")) { | |
141 | + browser = "Safari"; | |
142 | + } else if(userAgent.toLowerCase().contains("edge")) { | |
143 | + browser = "Edge"; | |
144 | + } | |
145 | + } | |
146 | + return browser; | |
147 | + } | |
148 | +} |
--- src/main/java/com/takensoft/common/util/JWTUtil.java
+++ src/main/java/com/takensoft/common/util/JWTUtil.java
... | ... | @@ -16,18 +16,40 @@ |
16 | 16 |
import jakarta.servlet.http.Cookie; |
17 | 17 |
import java.nio.charset.StandardCharsets; |
18 | 18 |
import java.util.*; |
19 |
- |
|
19 |
+/** |
|
20 |
+ * @author : takensoft |
|
21 |
+ * @since : 2025.01.22 |
|
22 |
+ * @modification |
|
23 |
+ * since | author | description |
|
24 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
25 |
+ * |
|
26 |
+ * JWT 토큰 생성 및 검증, 쿠키 생성 등의 유틸리티 |
|
27 |
+ */ |
|
20 | 28 |
@Component |
21 | 29 |
public class JWTUtil { |
22 | 30 |
|
23 | 31 |
private static SecretKey JWT_SECRET_KEY; |
24 | 32 |
|
25 |
- |
|
33 |
+ /** |
|
34 |
+ * @param secret - JWT 서명을 위한 키 (application.yml에서 값을 읽어 옴) |
|
35 |
+ * |
|
36 |
+ * 기본 생성자 |
|
37 |
+ */ |
|
26 | 38 |
public JWTUtil(@Value("${jwt.secret}")String secret) { |
27 | 39 |
this.JWT_SECRET_KEY = new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), Jwts.SIG.HS256.key().build().getAlgorithm()); |
28 | 40 |
} |
29 | 41 |
|
30 |
- // 토큰 생성 |
|
42 |
+ /** |
|
43 |
+ * @param category 토큰의 카테고리 정보 (Authorization, refresh) |
|
44 |
+ * @param mbrId 사용자 ID |
|
45 |
+ * @param lgnId 로그인 ID |
|
46 |
+ * @param mbrNm 사용자 이름 |
|
47 |
+ * @param roles 사용자 권한 목록 |
|
48 |
+ * @param expiredMs 토큰 만료 시간 (밀리초) |
|
49 |
+ * @return 생성된 JWT 토큰 (String) |
|
50 |
+ * |
|
51 |
+ * JWT 토큰 생성 |
|
52 |
+ */ |
|
31 | 53 |
public String createJwt(String category, String mbrId, String lgnId, String mbrNm, List<String> roles, long expiredMs) { |
32 | 54 |
return Jwts.builder() |
33 | 55 |
.claim("category", category) |
... | ... | @@ -41,7 +63,14 @@ |
41 | 63 |
.compact(); |
42 | 64 |
} |
43 | 65 |
|
44 |
- // 쿠키 생성 |
|
66 |
+ /** |
|
67 |
+ * @param key 쿠키 키 값 |
|
68 |
+ * @param value 쿠키 값 |
|
69 |
+ * @param time 쿠키의 생명주기 (초 단위) |
|
70 |
+ * @return 생성된 Cookie 객체 |
|
71 |
+ * |
|
72 |
+ * 쿠키 생성 |
|
73 |
+ */ |
|
45 | 74 |
public Cookie createCookie(String key, String value, int time) { |
46 | 75 |
// 쿠키 생성 |
47 | 76 |
Cookie cookie = new Cookie(key, value); |
... | ... | @@ -108,4 +137,53 @@ |
108 | 137 |
return mbrId; |
109 | 138 |
} |
110 | 139 |
|
140 |
+ |
|
141 |
+ |
|
142 |
+ |
|
143 |
+ /** |
|
144 |
+ * @param tkn JWT 토큰 문자열 |
|
145 |
+ * @param knd 조회할 데이터의 종류 (예: ctgry, userId, loginId 등) |
|
146 |
+ * @return 조회된 클레임 데이터 (종류에 따라 String, Date, List 등으로 반환) |
|
147 |
+ * @throws IllegalArgumentException 유효하지 않은 knd 값일 경우 예외 발생 |
|
148 |
+ * |
|
149 |
+ * 클레임 조회 |
|
150 |
+ */ |
|
151 |
+ public Object getClaim(String tkn, String knd) { |
|
152 |
+ Claims claims = Jwts.parser() |
|
153 |
+ .verifyWith(JWT_SECRET_KEY) |
|
154 |
+ .build() |
|
155 |
+ .parseSignedClaims(tkn) |
|
156 |
+ .getPayload(); |
|
157 |
+ switch (knd) { |
|
158 |
+ case "category": |
|
159 |
+ return claims.get("category", String.class); |
|
160 |
+ case "mbrId": |
|
161 |
+ return claims.get("mbrId", String.class); |
|
162 |
+ case "lgnId": |
|
163 |
+ return claims.get("lgnId", String.class); |
|
164 |
+ case "mbrNm": |
|
165 |
+ return claims.get("mbrNm", String.class); |
|
166 |
+ case "roles": |
|
167 |
+ // roles 클레임에서 사용자 권한 정보를 파싱 |
|
168 |
+ List<Map<String, Object>> roles = claims.get("roles", List.class); |
|
169 |
+ List<MberAuthorVO> authorList = new ArrayList<>(); |
|
170 |
+ if(roles != null && !roles.isEmpty()) { |
|
171 |
+ for(Map<String, Object> role : roles) { |
|
172 |
+ MberAuthorVO userAuthor = new MberAuthorVO(role.get("authority").toString()); |
|
173 |
+ authorList.add(userAuthor); |
|
174 |
+ } |
|
175 |
+ } |
|
176 |
+ return authorList; |
|
177 |
+ case "isExpired": |
|
178 |
+ // 토큰 만료 여부 반환 |
|
179 |
+ return claims.getExpiration().before(new Date()); |
|
180 |
+ case "expired": |
|
181 |
+ // 토큰 만료 시간 반환 |
|
182 |
+ return claims.getExpiration(); |
|
183 |
+ default: |
|
184 |
+ // 유효하지 않는 knd 처리 |
|
185 |
+ throw new IllegalArgumentException("Invalid knd : " + knd); |
|
186 |
+ } |
|
187 |
+ } |
|
188 |
+ |
|
111 | 189 |
} |
--- src/main/java/com/takensoft/common/util/ResponseData.java
+++ src/main/java/com/takensoft/common/util/ResponseData.java
... | ... | @@ -8,16 +8,16 @@ |
8 | 8 |
import java.time.LocalDateTime; |
9 | 9 |
|
10 | 10 |
/** |
11 |
- * @author takensoft |
|
12 |
- * @since 2024.04.03 |
|
13 |
- * 응답 데이터 |
|
11 |
+ * @author : takensoft |
|
12 |
+ * @since : 2025.01.22 |
|
13 |
+ * @modification |
|
14 |
+ * since | author | description |
|
15 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
16 |
+ * |
|
17 |
+ * 응답 데이터 객체 |
|
14 | 18 |
*/ |
15 | 19 |
@Data |
16 | 20 |
public class ResponseData { |
17 |
- |
|
18 |
- /*private HttpStatus status; |
|
19 |
- private String message; |
|
20 |
- private Object data;*/ |
|
21 | 21 |
|
22 | 22 |
private int status; // 상태 코드 |
23 | 23 |
private HttpStatus statusText; // 상태 메시지 |
... | ... | @@ -28,9 +28,6 @@ |
28 | 28 |
private LocalDateTime resTime; // 응답 시간 |
29 | 29 |
|
30 | 30 |
public ResponseData() { |
31 |
- /*this.status = HttpStatus.BAD_REQUEST; |
|
32 |
- this.data = null; |
|
33 |
- this.message = null;*/ |
|
34 | 31 |
this.status = 0; |
35 | 32 |
this.statusText = null; |
36 | 33 |
this.message = null; |
--- src/main/java/com/takensoft/common/util/Secret.java
+++ src/main/java/com/takensoft/common/util/Secret.java
... | ... | @@ -10,27 +10,37 @@ |
10 | 10 |
import java.util.Base64.Decoder; |
11 | 11 |
|
12 | 12 |
/** |
13 |
- * @author takensoft |
|
14 |
- * @since 2024.04.03 |
|
15 |
- * 암복호화 |
|
13 |
+ * @author : takensoft |
|
14 |
+ * @since : 2025.01.22 |
|
15 |
+ * @modification |
|
16 |
+ * since | author | description |
|
17 |
+ * 2025.01.22 | takensoft | 최초 등록 |
|
18 |
+ * |
|
19 |
+ * 암호화 및 복호화 작업을 수행하는 유틸리티 |
|
16 | 20 |
*/ |
17 | 21 |
@Component |
18 | 22 |
public class Secret { |
19 | 23 |
|
20 |
- private static final Charset UTF_8 = StandardCharsets.UTF_8; |
|
24 |
+ private static final Charset UTF_8 = StandardCharsets.UTF_8; // UTF-8 문자셋 |
|
21 | 25 |
|
22 |
- private static String SECRET_KEY; |
|
26 |
+ private static String SECRET_KEY; // 암호화 키 |
|
23 | 27 |
|
24 |
- private static String VECTOR_KEY; |
|
25 |
- |
|
28 |
+ private static String VECTOR_KEY; // 복호화 키 |
|
29 |
+ /** |
|
30 |
+ * @param secret - 암호화 키 (application.yml에서 값을 읽어 옴) |
|
31 |
+ * @param vector - 복호화 키 (application.yml에서 값을 읽어 옴) |
|
32 |
+ * |
|
33 |
+ * 기본 생성자 |
|
34 |
+ */ |
|
26 | 35 |
public Secret(@Value("${crypto.secret}")String secret, @Value("${crypto.vector}")String vector) { |
27 | 36 |
this.SECRET_KEY = secret; |
28 | 37 |
this.VECTOR_KEY = vector; |
29 | 38 |
} |
30 | 39 |
|
31 | 40 |
/** |
32 |
- * @author takensoft |
|
33 |
- * @since 2024.04.03 |
|
41 |
+ * @param data - 암호화할 데이터 |
|
42 |
+ * @return 암호화된 데이터 (Base64로 인코딩된 문자열) |
|
43 |
+ * |
|
34 | 44 |
* 암호화 |
35 | 45 |
*/ |
36 | 46 |
public static String encrypt(String data) { |
... | ... | @@ -41,8 +51,9 @@ |
41 | 51 |
} |
42 | 52 |
|
43 | 53 |
/** |
44 |
- * @author takensoft |
|
45 |
- * @since 2024.04.03 |
|
54 |
+ * @param encryptedData - 복호화할 암호화된 데이터 (Base64로 인코딩된 문자열) |
|
55 |
+ * @return 복호화된 원본 데이터 |
|
56 |
+ * |
|
46 | 57 |
* 복호화 |
47 | 58 |
*/ |
48 | 59 |
public static String decrypt(String encryptedData) { |
--- src/main/java/com/takensoft/ums/dao/UmsDAO.java
... | ... | @@ -1,24 +0,0 @@ |
1 | -package com.takensoft.ums.dao; | |
2 | - | |
3 | -import com.takensoft.ums.vo.UmsVO; | |
4 | -import org.egovframe.rte.psl.dataaccess.mapper.Mapper; | |
5 | - | |
6 | -import java.util.HashMap; | |
7 | -import java.util.List; | |
8 | - | |
9 | -/** | |
10 | - * @author : 방선주 | |
11 | - * @since : 2024.06.25 | |
12 | - * | |
13 | - * 문자서비스 Mapper | |
14 | - */ | |
15 | -@Mapper | |
16 | -public interface UmsDAO { | |
17 | - /** | |
18 | - * 문자 메시지 목록 조회 | |
19 | - */ | |
20 | - public int save(UmsVO umsVO) throws Exception; | |
21 | - | |
22 | - public List<UmsVO> findAll() throws Exception; | |
23 | -} | |
24 | - |
--- src/main/java/com/takensoft/ums/service/Impl/UmsServiceImpl.java
... | ... | @@ -1,59 +0,0 @@ |
1 | -package com.takensoft.ums.service.Impl; | |
2 | - | |
3 | -import com.takensoft.cms.mber.dto.AdmMbrDTO; | |
4 | -import com.takensoft.cms.mber.service.AdmMbrService; | |
5 | -import com.takensoft.cms.mber.vo.MberVO; | |
6 | -import com.takensoft.ums.dao.UmsDAO; | |
7 | -import com.takensoft.ums.service.UmsService; | |
8 | -import com.takensoft.ums.vo.UmsVO; | |
9 | -import lombok.RequiredArgsConstructor; | |
10 | -import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; | |
11 | -import org.springframework.stereotype.Service; | |
12 | -import org.springframework.transaction.annotation.Transactional; | |
13 | - | |
14 | -import java.util.HashMap; | |
15 | -import java.util.List; | |
16 | -import java.util.Map; | |
17 | - | |
18 | -/** | |
19 | - * @author : 방선주 | |
20 | - * @since : 2024.06.25 | |
21 | - * | |
22 | - * UmsServiceImpl - 문자 메시지 전송을 위한 서비스 구현체 | |
23 | - */ | |
24 | - | |
25 | -@Service("umsService") | |
26 | -@RequiredArgsConstructor | |
27 | -public class UmsServiceImpl extends EgovAbstractServiceImpl implements UmsService { | |
28 | - | |
29 | - private final UmsDAO umsDAO; | |
30 | - private final AdmMbrService admMbrService; | |
31 | - | |
32 | - @Override | |
33 | - @Transactional | |
34 | - public Map<String, Object> save() throws Exception { | |
35 | - Map<String, Object> result = new HashMap<>(); | |
36 | - | |
37 | - // 슈퍼관리자 정보 찾아 가져오기 | |
38 | - String mbrId = "MBR_000000000000001"; | |
39 | - AdmMbrDTO admMbrDTO = admMbrService.mbrDetail(mbrId); | |
40 | - UmsVO umsVO = new UmsVO(); | |
41 | - umsVO.setUserId("mono_customer"); // 계정 전달 필요 | |
42 | - umsVO.setScheduleType("0"); // 즉시 전달 1: 예약 | |
43 | - umsVO.setTitle("온라인 상담 신규 접수"); // 제목 (null 가능) | |
44 | - umsVO.setMsgContent("신규 온라인 상담 신청 건이 등록 되었습니다. "); // 내용 | |
45 | - umsVO.setCallingNum("054-639-6161"); // 회신번호 | |
46 | - umsVO.setPhoneNum(admMbrDTO.getMblTelno()); // 슈퍼 관리자 전화번호 가져오기 | |
47 | - | |
48 | - result.put("status", umsDAO.save(umsVO)); | |
49 | - return result; | |
50 | - } | |
51 | - | |
52 | - @Override | |
53 | - public Map<String, Object> findAll() throws Exception { | |
54 | - Map<String, Object> result = new HashMap<>(); | |
55 | - List<UmsVO> list = umsDAO.findAll(); | |
56 | - result.put("list", list); | |
57 | - return result; | |
58 | - } | |
59 | -} |
--- src/main/java/com/takensoft/ums/service/UmsService.java
... | ... | @@ -1,16 +0,0 @@ |
1 | -package com.takensoft.ums.service; | |
2 | - | |
3 | -import java.util.Map; | |
4 | - | |
5 | -/** | |
6 | - * @author : 방선주 | |
7 | - * @since : 2024.06.25 | |
8 | - * | |
9 | - * UmsService - 문자 메시지 전송을 위한 서비스 | |
10 | - */ | |
11 | - | |
12 | -public interface UmsService { | |
13 | - public Map<String, Object> save() throws Exception; | |
14 | - | |
15 | - public Map<String, Object> findAll() throws Exception; | |
16 | -}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/ums/vo/UmsVO.java
... | ... | @@ -1,87 +0,0 @@ |
1 | -package com.takensoft.ums.vo; | |
2 | - | |
3 | -import lombok.AllArgsConstructor; | |
4 | -import lombok.Getter; | |
5 | -import lombok.Setter; | |
6 | - | |
7 | -/** | |
8 | - * @author : 방선주 | |
9 | - * @since : 2024.06.25 | |
10 | - * | |
11 | - * 게시판 관리 관련 VO | |
12 | - */ | |
13 | -@Setter | |
14 | -@Getter | |
15 | -@AllArgsConstructor | |
16 | -public class UmsVO { | |
17 | - /** | |
18 | - * 문자 메시지 아이디 | |
19 | - */ | |
20 | - private String id; | |
21 | - /** | |
22 | - * ums 로그인 아이디 | |
23 | - */ | |
24 | - private String userId; | |
25 | - /** | |
26 | - * 스케쥴 타입구분(0:즉시, 1:예약) | |
27 | - */ | |
28 | - private String scheduleType; | |
29 | - /** | |
30 | - * 제목 | |
31 | - */ | |
32 | - private String title; | |
33 | - /** | |
34 | - * 메시지 내용 | |
35 | - */ | |
36 | - private String msgContent; | |
37 | - /** | |
38 | - * 회신번호 | |
39 | - */ | |
40 | - private String callingNum; | |
41 | - /** | |
42 | - * 수신자 | |
43 | - */ | |
44 | - private String tgtNm; | |
45 | - /** | |
46 | - * 수신번호 | |
47 | - */ | |
48 | - private String phoneNum; | |
49 | - /** | |
50 | - * 상태코드 (0: 미전송, 1: 전송, 2:에러) | |
51 | - */ | |
52 | - private String stateCd; | |
53 | - /** | |
54 | - * STATE_CD 값이 ‘2’일 경우 상세 에러메시지 | |
55 | - */ | |
56 | - private String resultMsg; | |
57 | - /** | |
58 | - * 카카오 알림톡 전송 시 템플릿코드 입력(SMS일 | |
59 | - * 경우 NULL) | |
60 | - */ | |
61 | - private String templateCd; | |
62 | - /** | |
63 | - * 푸시전송여부 ‘Y’일경우 푸시로 전송 | |
64 | - */ | |
65 | - private String pushSendYn; | |
66 | - /** | |
67 | - * 푸시전송 시 식별자 아이디(앱아이디) | |
68 | - */ | |
69 | - private String pushId; | |
70 | - /** | |
71 | - * 카카오알림톡 재전송 후 실패 시 문자전송. | |
72 | - */ | |
73 | - private String pushResendTpCd; | |
74 | - /** | |
75 | - * 예약전송일시 | |
76 | - */ | |
77 | - private String reservDttm; | |
78 | - /** | |
79 | - * DB입력시간 | |
80 | - */ | |
81 | - private String regDttm; | |
82 | - | |
83 | - | |
84 | - public UmsVO() { | |
85 | - | |
86 | - } | |
87 | -} |
--- src/main/java/com/takensoft/ums/web/UmsController.java
... | ... | @@ -1,48 +0,0 @@ |
1 | -package com.takensoft.ums.web; | |
2 | - | |
3 | -import com.takensoft.common.message.MessageCode; | |
4 | -import com.takensoft.common.util.ResponseData; | |
5 | -import com.takensoft.common.util.ResponseUtil; | |
6 | -import com.takensoft.ums.service.UmsService; | |
7 | -import lombok.RequiredArgsConstructor; | |
8 | -import lombok.extern.slf4j.Slf4j; | |
9 | -import org.springframework.http.HttpHeaders; | |
10 | -import org.springframework.http.HttpStatus; | |
11 | -import org.springframework.http.MediaType; | |
12 | -import org.springframework.http.ResponseEntity; | |
13 | -import org.springframework.web.bind.annotation.PostMapping; | |
14 | -import org.springframework.web.bind.annotation.RequestMapping; | |
15 | -import org.springframework.web.bind.annotation.RestController; | |
16 | - | |
17 | -import java.nio.charset.Charset; | |
18 | -import java.util.HashMap; | |
19 | -import java.util.Map; | |
20 | -/** | |
21 | - * @author 방선주 | |
22 | - * @since 2024.06.25 | |
23 | - * @modification | |
24 | - * since | author | description | |
25 | - * 2024.06.25 | 방선주 | 최초 등록 | |
26 | - * | |
27 | - * UmsController - 문자 메시지 전송을 위한 컨트롤러 | |
28 | - */ | |
29 | -@RestController | |
30 | -@RequiredArgsConstructor | |
31 | -@Slf4j | |
32 | -@RequestMapping(value="/ums") | |
33 | -public class UmsController { | |
34 | - | |
35 | - private final ResponseUtil resUtil; | |
36 | - private final UmsService umsService; | |
37 | - | |
38 | - // 문자 메시지 테이블 확인 | |
39 | - @PostMapping(value="/saveUmsInfo.json") | |
40 | - public ResponseEntity<?> saveUmsInfo() throws Exception { | |
41 | - // 목록 조회 | |
42 | -// Map<String, Object> result = umsService.findAll(); | |
43 | - Map<String, Object> result = umsService.save(); | |
44 | - | |
45 | - // 응답처리 | |
46 | - return resUtil.successRes(result, MessageCode.COMMON_SUCCESS); | |
47 | - } | |
48 | -}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/application.yml
+++ src/main/resources/application.yml
... | ... | @@ -21,13 +21,12 @@ |
21 | 21 |
password: tts96314728!@ |
22 | 22 |
|
23 | 23 |
# 오라클 설정 |
24 |
-# ums: |
|
25 |
-# datasource: |
|
26 |
-# driver-class-name: oracle.jdbc.OracleDriver |
|
27 |
-# jdbc-url: jdbc:oracle:thin:@localhost:1521:xe |
|
28 |
-# username: c##test1 |
|
29 |
-# password: 1234 |
|
30 |
- |
|
24 |
+ # ums: |
|
25 |
+ # datasource: |
|
26 |
+ # driver-class-name: oracle.jdbc.OracleDriver |
|
27 |
+ # jdbc-url: jdbc:oracle:thin:@localhost:1521:xe |
|
28 |
+ # username: c##test1 |
|
29 |
+ # password: 1234 |
|
31 | 30 |
sql: |
32 | 31 |
init: |
33 | 32 |
platform: postgres |
... | ... | @@ -86,4 +85,14 @@ |
86 | 85 |
|
87 | 86 |
file: |
88 | 87 |
file-upload-path: /fileUpload/ |
89 |
- edit-file-upload-path: /editFileUpload/(파일 끝에 줄바꿈 문자 없음) |
|
88 |
+ edit-file-upload-path: /editFileUpload/ |
|
89 |
+ |
|
90 |
+redis: |
|
91 |
+ host: localhost |
|
92 |
+ port: 6379 |
|
93 |
+ |
|
94 |
+config: |
|
95 |
+ allow-multiple-logins: true |
|
96 |
+ |
|
97 |
+auth: |
|
98 |
+ login-type: JWT(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/mybatis/mapper-ora/ums/ums-SQL.xml
... | ... | @@ -1,29 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | -<mapper namespace="com.takensoft.ums.dao.UmsDAO"> | |
4 | - <insert id="save" parameterType="UmsVO"> | |
5 | - INSERT INTO CUSTOMER_SMS_SEND ( | |
6 | - USER_ID | |
7 | - , SCHEDULE_TYPE | |
8 | - , TITLE | |
9 | - ,MSG_CONTENT | |
10 | - , CALLING_NUM | |
11 | - ,PHONE_NUM | |
12 | - , RESERV_DTTM | |
13 | - , REG_DTTM | |
14 | - ) VALUES ( | |
15 | - #{userId}, | |
16 | - #{scheduleType}, | |
17 | - #{title}, | |
18 | - #{msgContent}, | |
19 | - #{callingNum}, | |
20 | - #{phoneNum}, | |
21 | - NULL, | |
22 | - TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') | |
23 | - ) | |
24 | - </insert> | |
25 | - | |
26 | - <select id="findAll" resultType="UmsVO"> | |
27 | - SELECT * FROM CUSTOMER_SMS_SEND | |
28 | - </select> | |
29 | -</mapper>(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?