Compare commits
No commits in common. "a51af7d97c5c6c0f264066030bef1309a1020c66" and "dfc40d0a11a2a141c5e9e7e2107b02dbf40d6595" have entirely different histories.
a51af7d97c
...
dfc40d0a11
|
|
@ -294,7 +294,7 @@ function EgovAdminDashboard(props) {
|
||||||
<Box sx={{ p: 3, pb: 0 }}>
|
<Box sx={{ p: 3, pb: 0 }}>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Typography variant="h3" color="textSecondary">
|
<Typography variant="h3" color="textSecondary">
|
||||||
이번주 현황
|
주간 현황
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h6">총 {totalDownloads}건</Typography>
|
<Typography variant="h6">총 {totalDownloads}건</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
|
||||||
|
|
@ -57,25 +57,6 @@ function UserInfoModal({savedInfo, reloadFunction}){
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function modalOpen(){
|
|
||||||
EgovNet.requestFetch(
|
|
||||||
'/admin/users/info?userId='+savedInfo?.userId,
|
|
||||||
{
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
'Content-type': 'application/json'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(resp) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
modalOpen();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
|
|
|
||||||
|
|
@ -89,25 +89,25 @@ public class AdminConfigService extends EgovAbstractServiceImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public String modifyCodeItem(TcCodeItem codeItem) {
|
public String modifyCodeItem(TcCodeItem codeItem) {
|
||||||
TcCodeItem savedItem = codeItemRepository.findById(
|
TcCodeItem savedItem = codeItemRepository.findById(
|
||||||
new TcCodeItem.TcCodeItemId(codeItem.getItemCd(), codeItem.getGrpCd())
|
new TcCodeItem.TcCodeItemId(codeItem.getItemCd(), codeItem.getGrpCd())
|
||||||
).orElse(null);
|
).orElse(null);
|
||||||
if (savedItem != null) {
|
if (savedItem != null) {
|
||||||
savedItem.setItemNm(codeItem.getItemNm());
|
savedItem.setItemNm(codeItem.getItemNm());
|
||||||
savedItem.setLastChgId(codeItem.getLastChgId());
|
savedItem.setLastChgId(codeItem.getLastChgId());
|
||||||
savedItem.setLastChgDt(codeItem.getLastChgDt());
|
savedItem.setLastChgDt(codeItem.getLastChgDt());
|
||||||
savedItem.setGrpOrder(codeItem.getGrpOrder());
|
savedItem.setGrpOrder(codeItem.getGrpOrder());
|
||||||
savedItem.setUseYn(codeItem.getUseYn());
|
savedItem.setUseYn(codeItem.getUseYn());
|
||||||
codeItemRepository.save(savedItem);
|
codeItemRepository.save(savedItem);
|
||||||
return "modified";
|
return "modified";
|
||||||
}else{
|
}else{
|
||||||
return "validGrpCd";
|
return "validGrpCd";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<TcMenu> selectMenuList() {
|
public List<TcMenu> selectMenuList() {
|
||||||
return menuMapper.selectMenuList();
|
return menuMapper.selectMenuList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -165,4 +165,4 @@ public class AdminConfigService extends EgovAbstractServiceImpl {
|
||||||
}
|
}
|
||||||
menuRoleRepository.saveAll(roleList);
|
menuRoleRepository.saveAll(roleList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard;
|
package com.dbnt.kcscbackend.admin.dashboard;
|
||||||
|
|
||||||
|
//import com.dbnt.kcscbackend.admin.dashboard.dto.MonthlyUserLogDTO;
|
||||||
import com.dbnt.kcscbackend.admin.dashboard.service.AdminDashboardService;
|
import com.dbnt.kcscbackend.admin.dashboard.service.AdminDashboardService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||||
|
|
@ -12,12 +13,17 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -65,7 +71,7 @@ public class AdminDashboardController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/file", consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, value = "/file", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResultVO getFile(@AuthenticationPrincipal LoginVO user)
|
public ResultVO getfile(@AuthenticationPrincipal LoginVO user)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
|
|
@ -84,4 +90,60 @@ public class AdminDashboardController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Operation(
|
||||||
|
// summary = "일별 사용자 현황 차트 조회",
|
||||||
|
// description = "일별 사용자 현황 차트 조회",
|
||||||
|
// tags = {"AdminDashboardController"}
|
||||||
|
// )
|
||||||
|
// @ApiResponses(value = {
|
||||||
|
// @ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
// @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
// })
|
||||||
|
// @RequestMapping(method = RequestMethod.GET, value = "/daily-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResultVO getDailyUserLogList() throws Exception {
|
||||||
|
// ResultVO resultVO = new ResultVO();
|
||||||
|
// Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// // 현재 날짜
|
||||||
|
// // todo endDate 뒤에 .minus 지워야함
|
||||||
|
// LocalDate endDate = LocalDate.now().minusMonths(6);
|
||||||
|
// // 3개월 전 날짜 계산
|
||||||
|
// LocalDate startDate = endDate.minusMonths(3);
|
||||||
|
//
|
||||||
|
// resultMap.put("dailyUserLogList", adminDashboardService.selectDailyUserLogList(startDate, endDate));
|
||||||
|
// resultVO.setResult(resultMap);
|
||||||
|
// return resultVO;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(
|
||||||
|
// summary = "월별 사용자 현황 차트 조회",
|
||||||
|
// description = "월별 사용자 현황 차트 조회",
|
||||||
|
// tags = {"AdminDashboardController"}
|
||||||
|
// )
|
||||||
|
// @ApiResponses(value = {
|
||||||
|
// @ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
// @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
// })
|
||||||
|
// @RequestMapping(method = RequestMethod.GET, value = "/monthly-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResultVO getMonthlyUserLogList() throws Exception {
|
||||||
|
// ResultVO resultVO = new ResultVO();
|
||||||
|
// Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// // 현재 날짜
|
||||||
|
// // todo endDate 뒤에 .minus 지워야함
|
||||||
|
// LocalDate endDate = LocalDate.now().minusMonths(6);
|
||||||
|
// // 3개월 전 날짜 계산
|
||||||
|
// LocalDate startDate = endDate.minusMonths(3);
|
||||||
|
//
|
||||||
|
// List<Object[]> result = adminDashboardService.selectMonthlyUserLogList(startDate, endDate);
|
||||||
|
// List<MonthlyUserLogDTO> monthlyUserLogDTOList = result.stream()
|
||||||
|
// .map(row -> new MonthlyUserLogDTO((String) row[0], (BigInteger) row[1]))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// resultMap.put("dailyUserLogList", monthlyUserLogDTOList);
|
||||||
|
// resultVO.setResult(resultMap);
|
||||||
|
// return resultVO;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.dashboard.dto;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class MonthlyUserLogDTO {
|
||||||
|
private String logDt;
|
||||||
|
private BigInteger logCnt;
|
||||||
|
|
||||||
|
public MonthlyUserLogDTO(Object[] row) {
|
||||||
|
this.logDt = (String) row[0];
|
||||||
|
this.logCnt = (BigInteger) row[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.dashboard.entity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tn_daily_user_log")
|
||||||
|
public class TnDailyUserLog {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "dul_seq")
|
||||||
|
private Long dulSeq;
|
||||||
|
|
||||||
|
@Column(name = "log_dt")
|
||||||
|
private LocalDate logDt;
|
||||||
|
|
||||||
|
@Column(name = "log_cnt")
|
||||||
|
private Integer logCnt;
|
||||||
|
|
||||||
|
@Column(name = "mobile_cnt")
|
||||||
|
private Integer mobileCnt;
|
||||||
|
|
||||||
|
@Column(name = "pc_cnt")
|
||||||
|
private Integer pcCnt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.dashboard.repository;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TnDailyUserLogRepository extends JpaRepository<TnDailyUserLog, Long> {
|
||||||
|
List<TnDailyUserLog> findByLogDtBetweenOrderByLogDt(LocalDate startDate, LocalDate endDate);
|
||||||
|
|
||||||
|
@Query(value = "SELECT TO_CHAR(log_dt, 'YYYYMM') as log_dt, "
|
||||||
|
+ "SUM(log_cnt) as log_cnt "
|
||||||
|
+ "FROM tn_daily_user_log "
|
||||||
|
+ "WHERE log_dt BETWEEN :startDate AND :endDate "
|
||||||
|
+ "GROUP BY TO_CHAR(log_dt, 'YYYYMM') "
|
||||||
|
+ "ORDER BY log_dt", nativeQuery = true)
|
||||||
|
List<Object[]> selectMonthlyUserLogStatistics(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.entity;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@Entity
|
|
||||||
@NoArgsConstructor
|
|
||||||
@DynamicInsert
|
|
||||||
@DynamicUpdate
|
|
||||||
@Table(name = "th_login_log")
|
|
||||||
public class ThLoginLog {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "ll_seq")
|
|
||||||
private Long llSeq;
|
|
||||||
|
|
||||||
@Column(name = "user_id")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
@Column(name = "access_dt")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime accessDt;
|
|
||||||
|
|
||||||
@Column(name = "ip_address")
|
|
||||||
private String ipAddress;
|
|
||||||
|
|
||||||
@Column(name = "session_id")
|
|
||||||
private String sessionId;
|
|
||||||
|
|
||||||
@Column(name = "access_type")
|
|
||||||
private String accessType;
|
|
||||||
}
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
||||||
private static final long serialVersionUID = -3779821913760046011L;
|
private static final long serialVersionUID = -3779821913760046011L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "upl_seq")
|
@Column(name = "upl_seq")
|
||||||
private Long uplSeq;
|
private Long uplSeq;
|
||||||
|
|
||||||
|
|
@ -47,7 +46,4 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
||||||
@Column(name = "access_dt")
|
@Column(name = "access_dt")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate accessDt;
|
private LocalDate accessDt;
|
||||||
|
|
||||||
@Column(name = "session_id")
|
|
||||||
private String sessionId;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
@ -19,22 +20,15 @@ import java.time.LocalDate;
|
||||||
@DynamicInsert
|
@DynamicInsert
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@Table(name = "tn_daily_user_log")
|
@Table(name = "tn_daily_user_log")
|
||||||
public class TnDailyUserLog {
|
public class TnDailyUserConnLog {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "dul_seq")
|
@Column(name = "dul_seq")
|
||||||
private Long dulSeq;
|
private Long dulSeq;
|
||||||
|
|
||||||
@Column(name = "log_dt")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate logDt;
|
|
||||||
|
|
||||||
@Column(name = "log_cnt")
|
@Column(name = "log_cnt")
|
||||||
private Long logCnt;
|
private Long logCnt;
|
||||||
|
|
||||||
@Column(name = "mobile_cnt")
|
@Column(name = "log_dt")
|
||||||
private Long mobileCnt;
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate logDt;
|
||||||
@Column(name = "pc_cnt")
|
|
||||||
private Long pcCnt;
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PrivacyLogsRepository extends JpaRepository<ThPrivacyLog, Long> {
|
public interface PrivacyLogsRepository extends JpaRepository<ThPrivacyLog, String> {
|
||||||
List<ThPrivacyLog> findAllByOrderByUplSeqDesc();
|
List<ThPrivacyLog> findAllByOrderByUplSeqDesc();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.repository;
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ThLoginLogRepository extends JpaRepository<ThLoginLog, Long> {
|
|
||||||
|
|
||||||
List<ThLoginLog> findByUserIdAndAccessDtAfter(String userId, LocalDateTime accessDt);
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.repository;
|
package com.dbnt.kcscbackend.admin.logs.repository;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserConnLog;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface UserLogsRepository extends JpaRepository<TnDailyUserLog, Long> {
|
public interface UserLogsRepository extends JpaRepository<TnDailyUserConnLog, Long> {
|
||||||
|
|
||||||
@Query(value = "SELECT COUNT(DISTINCT log_dt) "
|
@Query(value = "SELECT COUNT(DISTINCT log_dt) "
|
||||||
+ "FROM tn_daily_user_log "
|
+ "FROM tn_daily_user_log "
|
||||||
|
|
@ -23,5 +21,5 @@ public interface UserLogsRepository extends JpaRepository<TnDailyUserLog, Long>
|
||||||
+ "ORDER BY log_dt asc", nativeQuery = true)
|
+ "ORDER BY log_dt asc", nativeQuery = true)
|
||||||
List<Object[]> selectCountUser(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
List<Object[]> selectCountUser(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
Optional<TnDailyUserLog> findByLogDt(LocalDate logDt);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,11 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.service;
|
package com.dbnt.kcscbackend.admin.logs.service;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.ThLoginLogRepository;
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.UserLogsRepository;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -22,8 +15,6 @@ import java.util.Map;
|
||||||
public class AdminLogsService extends EgovAbstractServiceImpl {
|
public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
private final PrivacyLogsRepository privacyLogsRepository;
|
private final PrivacyLogsRepository privacyLogsRepository;
|
||||||
private final ThLoginLogRepository loginLogRepository;
|
|
||||||
private final UserLogsRepository userLogsRepository;
|
|
||||||
|
|
||||||
public Map<String, Object> selectPrivacyList() {
|
public Map<String, Object> selectPrivacyList() {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
@ -42,55 +33,4 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void insertPrivacyLog(String userId, String ipAddress, String accessType, String targetUserId){
|
|
||||||
ThPrivacyLog log = new ThPrivacyLog();
|
|
||||||
log.setUserId(userId);
|
|
||||||
log.setAccessDt(LocalDate.now());
|
|
||||||
log.setIpAddress(ipAddress);
|
|
||||||
log.setAccessType(accessType);
|
|
||||||
log.setTargetUserId(targetUserId);
|
|
||||||
privacyLogsRepository.save(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void insertLoginLog(String userId, String ipAddress, String accessToken, String accessType, String webType){
|
|
||||||
ThLoginLog loginLog = new ThLoginLog();
|
|
||||||
loginLog.setUserId(userId);
|
|
||||||
loginLog.setIpAddress(ipAddress);
|
|
||||||
loginLog.setSessionId(accessToken);
|
|
||||||
loginLog.setAccessType(accessType);
|
|
||||||
loginLog.setAccessDt(LocalDateTime.now());
|
|
||||||
loginLogRepository.save(loginLog);
|
|
||||||
|
|
||||||
// 로그인 기록이면 tn_daily_yser_log 카운트 조정
|
|
||||||
if(accessType.equals("Y")){
|
|
||||||
//오늘 일자 로그 조회
|
|
||||||
TnDailyUserLog userConnLog = userLogsRepository.findByLogDt(LocalDate.now()).orElse(null);
|
|
||||||
if(userConnLog==null){
|
|
||||||
userConnLog = new TnDailyUserLog();
|
|
||||||
userConnLog.setLogDt(LocalDate.now());
|
|
||||||
userConnLog.setLogCnt(0L);
|
|
||||||
userConnLog.setMobileCnt(0L);
|
|
||||||
userConnLog.setPcCnt(0L);
|
|
||||||
}
|
|
||||||
if(webType.equals("PC")){
|
|
||||||
userConnLog.setPcCnt(userConnLog.getPcCnt()+1);
|
|
||||||
}else{
|
|
||||||
userConnLog.setMobileCnt(userConnLog.getMobileCnt()+1);
|
|
||||||
}
|
|
||||||
//같은 일자 로그인 기록 확인
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
now = now.minusHours(now.getHour());
|
|
||||||
now = now.minusMinutes(now.getMinute());
|
|
||||||
now = now.minusSeconds(now.getSecond());
|
|
||||||
List<ThLoginLog> todayLoginLog = loginLogRepository.findByUserIdAndAccessDtAfter(userId, now);
|
|
||||||
if(todayLoginLog.size()==1){
|
|
||||||
userConnLog.setLogCnt(userConnLog.getLogCnt()+1);
|
|
||||||
}
|
|
||||||
userLogsRepository.save(userConnLog);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.users;
|
package com.dbnt.kcscbackend.admin.users;
|
||||||
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
|
||||||
import com.dbnt.kcscbackend.admin.users.service.AdminUsersService;
|
import com.dbnt.kcscbackend.admin.users.service.AdminUsersService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
|
|
@ -9,7 +8,6 @@ import com.dbnt.kcscbackend.commonCode.service.CommonCodeService;
|
||||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
|
@ -24,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -36,7 +33,6 @@ import java.util.Map;
|
||||||
public class AdminUsersController extends BaseController {
|
public class AdminUsersController extends BaseController {
|
||||||
|
|
||||||
private final AdminUsersService adminUsersService;
|
private final AdminUsersService adminUsersService;
|
||||||
private final AdminLogsService adminLogsService;
|
|
||||||
private final CommonCodeService commonCodeService;
|
private final CommonCodeService commonCodeService;
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
|
|
@ -49,8 +45,7 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/list")
|
@RequestMapping(method = RequestMethod.GET, value = "/list")
|
||||||
public ResultVO getUserList(UserInfo params, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
public ResultVO getUserList(UserInfo params) throws Exception{
|
||||||
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_LIST", null);
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
params.setQueryInfo();
|
params.setQueryInfo();
|
||||||
|
|
@ -73,12 +68,11 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/info")
|
@RequestMapping(method = RequestMethod.GET, value = "/info")
|
||||||
public ResultVO getUserInfo(UserInfo params, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
public ResultVO getUserInfo(UserInfo params) throws Exception{
|
||||||
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_VIEW", params.getUserId());
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
/*resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
||||||
resultVO.setResult(resultMap);*/
|
resultVO.setResult(resultMap);
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,8 +86,7 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/info")
|
@RequestMapping(method = RequestMethod.PUT, value = "/info")
|
||||||
public ResultVO modifyUserInfo(@RequestBody @Valid UserInfo info, Errors errors, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
public ResultVO modifyUserInfo(@RequestBody @Valid UserInfo info, Errors errors, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||||
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_UPDT", info.getUserId());
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
if(errors.hasErrors()){
|
if(errors.hasErrors()){
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
|
|
@ -137,8 +130,7 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/info", consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.DELETE, value = "/info", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResultVO deleteUserInfo(@RequestBody UserInfo info, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
public ResultVO deleteUserInfo(@RequestBody UserInfo info) throws Exception{
|
||||||
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_DLT", info.getUserId());
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
adminUsersService.deleteUserInfo(info.getUserSeq());
|
adminUsersService.deleteUserInfo(info.getUserSeq());
|
||||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.kcscbackend.admin.users.service;
|
package com.dbnt.kcscbackend.admin.users.service;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
|
||||||
import com.dbnt.kcscbackend.admin.users.mapper.AdminUsersMapper;
|
import com.dbnt.kcscbackend.admin.users.mapper.AdminUsersMapper;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.auth.repository.UserInfoRepository;
|
import com.dbnt.kcscbackend.auth.repository.UserInfoRepository;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
||||||
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
@ -13,7 +9,11 @@ import org.springframework.http.server.ServletServerHttpResponse;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
||||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||||
|
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||||
|
import org.springframework.security.web.savedrequest.RequestCache;
|
||||||
|
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
|
|
@ -23,10 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
private final EgovJwtTokenUtil jwtTokenUtil;
|
|
||||||
private final AdminLogsService adminLogsService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
||||||
|
|
@ -40,11 +37,6 @@ public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
|
|
||||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||||
resultMap.put("resultCode", "200");
|
resultMap.put("resultCode", "200");
|
||||||
|
|
||||||
//로그아웃 이력 생성
|
|
||||||
String accessToken = request.getHeader("Authorization");
|
|
||||||
adminLogsService.insertLoginLog(jwtTokenUtil.getUserIdFromToken(accessToken), ClientUtils.getRemoteIP(request), accessToken, "N", ClientUtils.getWebType(request));
|
|
||||||
|
|
||||||
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
||||||
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
||||||
|
|
@ -27,13 +26,11 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Configuration
|
||||||
public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
||||||
|
|
||||||
private final EgovJwtTokenUtil jwtTokenUtil;
|
private final EgovJwtTokenUtil jwtTokenUtil;
|
||||||
private final AdminLogsService adminLogsService;
|
|
||||||
private RequestCache requestCache = new HttpSessionRequestCache();
|
private RequestCache requestCache = new HttpSessionRequestCache();
|
||||||
|
|
||||||
private static final List<String> adminIpList = Arrays.asList(EgovProperties.getProperty("Globals.admin.allow-ip").split(","));
|
private static final List<String> adminIpList = Arrays.asList(EgovProperties.getProperty("Globals.admin.allow-ip").split(","));
|
||||||
|
|
@ -56,14 +53,12 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
||||||
securityUser = (UserInfo) principal;
|
securityUser = (UserInfo) principal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String accessIp = ClientUtils.getRemoteIP(request);
|
|
||||||
|
|
||||||
// application/json(ajax) 요청일 경우 아래의 처리!
|
// application/json(ajax) 요청일 경우 아래의 처리!
|
||||||
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
|
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
|
||||||
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
|
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
|
||||||
HashMap<String, Object> resultMap = new HashMap<>();
|
HashMap<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
/*if(securityUser.getUserId().equals("admin") && !adminIpList.contains(accessIp)){
|
/*if(securityUser.getUserId().equals("admin") && !adminIpList.contains(ClientUtils.getRemoteIP(request))){
|
||||||
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
|
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
|
||||||
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
|
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -83,9 +78,6 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
||||||
resultMap.put("accessToken", accessToken);
|
resultMap.put("accessToken", accessToken);
|
||||||
resultMap.put("refreshToken", refreshToken);
|
resultMap.put("refreshToken", refreshToken);
|
||||||
|
|
||||||
//로그인 로그 기록
|
|
||||||
adminLogsService.insertLoginLog(securityUser.getUserId(), accessIp, accessToken, "Y", ClientUtils.getWebType(request));
|
|
||||||
|
|
||||||
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
||||||
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
|
||||||
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
||||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationEntryPoint;
|
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationEntryPoint;
|
||||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationFilter;
|
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationFilter;
|
||||||
|
|
@ -50,7 +49,6 @@ public class SecurityConfig {
|
||||||
private UserDetailsService loginService;
|
private UserDetailsService loginService;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final EgovJwtTokenUtil egovJwtTokenUtil;
|
private final EgovJwtTokenUtil egovJwtTokenUtil;
|
||||||
private final AdminLogsService adminLogsService;
|
|
||||||
|
|
||||||
//Http Methpd : Get 인증예외 List
|
//Http Methpd : Get 인증예외 List
|
||||||
private String[] AUTH_GET_WHITELIST = {
|
private String[] AUTH_GET_WHITELIST = {
|
||||||
|
|
@ -133,7 +131,7 @@ public class SecurityConfig {
|
||||||
|
|
||||||
http.addFilterBefore(jsonUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
http.addFilterBefore(jsonUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||||
|
|
||||||
http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/auth/logout")).logoutSuccessHandler(new CustomLogoutSuccessHandler(egovJwtTokenUtil, adminLogsService));
|
http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/auth/logout")).logoutSuccessHandler(new CustomLogoutSuccessHandler());
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +145,7 @@ public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JsonAuthenticationFilter jsonUsernamePasswordAuthenticationFilter() {
|
public JsonAuthenticationFilter jsonUsernamePasswordAuthenticationFilter() {
|
||||||
JsonAuthenticationFilter jsonAuthenticationFilter = new JsonAuthenticationFilter(objectMapper, new CustomUrlAuthenticationSuccessHandler(egovJwtTokenUtil, adminLogsService), loginFailureHandler());
|
JsonAuthenticationFilter jsonAuthenticationFilter = new JsonAuthenticationFilter(objectMapper, new CustomUrlAuthenticationSuccessHandler(egovJwtTokenUtil), loginFailureHandler());
|
||||||
jsonAuthenticationFilter.setAuthenticationManager(authenticationManager());
|
jsonAuthenticationFilter.setAuthenticationManager(authenticationManager());
|
||||||
return jsonAuthenticationFilter;
|
return jsonAuthenticationFilter;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,20 +29,4 @@ public class ClientUtils {
|
||||||
|
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getWebType(HttpServletRequest request) {
|
|
||||||
String filter = "iphone|ipod|android|windows ce|blackberry|symbian|windows phone|webos|opera mini|opera mobi|polaris|iemobile|lgtelecom|nokia|sonyericsson|lg|samsung";
|
|
||||||
String filters[] = filter.split("\\|");
|
|
||||||
String webType = "";
|
|
||||||
|
|
||||||
for(String tmp : filters){
|
|
||||||
if (request.getHeader("User-Agent").toLowerCase().contains(tmp)) {
|
|
||||||
webType = "MOBILE";
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
webType = "PC";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return webType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue