refactor: 미사용 클래스 정리

dev
gitea-관리자 1 year ago
parent 3ea0f718a1
commit 3108af40a5

@ -1,12 +0,0 @@
/**
* ENS business packages
* <p>
* : ens
* : pni
* sms
* </p>
* @since 1.0
* @author limju
* @version 1.0
*/
package kr.xit.biz;

@ -1,60 +0,0 @@
package kr.xit.core.biz.web;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.biz.model.LoggingDTO;
import kr.xit.core.biz.service.ILoggingService;
import lombok.RequiredArgsConstructor;
/**
* <pre>
* description : API Logging cotroller
*
* packageName : kr.xit.core.biz.web
* fileName : LoggingController
* author : limju
* date : 2023-05-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-05-11 limju
*
* </pre>
*/
@Tag(name = "LoggingController", description = "API logging 관리")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/api/core/log")
public class LoggingController {
private final ILoggingService loggingService;
@Operation(summary = "로깅 정보 저장" , description = "로깅 정보 저장")
@io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = {
@Content(
mediaType = "application/json",
examples = {
@ExampleObject(
value = "{\"requestId\":\"7f1f5978fc1941c4a6d37351a6d692e6\"}")
}
)
}
)
@PostMapping(value = "/save", consumes = {MediaType.APPLICATION_JSON_VALUE , MediaType.TEXT_HTML_VALUE})
public ApiResponseDTO saveLogging(@RequestBody final LoggingDTO reqDTO){
loggingService.saveLogging(reqDTO);
return ApiResponseDTO.empty();
}
}

@ -1,28 +0,0 @@
package kr.xit.core.biz.mapper;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import egovframework.com.cmm.LoginVO;
/**
* <pre>
* description :
*
* packageName : kr.xit.core.biz.mapper
* fileName : IAuthApiMapper
* author : limju
* date : 2023-05-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-05-11 limju
*
* </pre>
*/
@Mapper
public interface IAuthApiMapper {
LoginVO actionLogin(LoginVO vo);
// LoginVO searchId(LoginVO vo);
// LoginVO searchPassword(LoginVO vo);
// void updatePassword(LoginVO vo);
}

@ -1,42 +0,0 @@
package kr.xit.core.biz.service;
import javax.annotation.Resource;
import egovframework.com.cmm.util.EgovFileScrty;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import egovframework.com.cmm.LoginVO;
import kr.xit.core.biz.mapper.IAuthApiMapper;
@Service
public class AuthApiService extends EgovAbstractServiceImpl implements IAuthApiService {
@Resource
private IAuthApiMapper mapper;
/**
*
* @param vo LoginVO
* @return LoginVO
*/
@Override
public LoginVO actionLogin(LoginVO vo) {
// 1. 입력한 비밀번호를 암호화한다.
String enpassword = EgovFileScrty.encryptPassword(vo.getPassword(), vo.getId());
vo.setPassword(enpassword);
// 2. 아이디와 암호화된 비밀번호가 DB와 일치하는지 확인한다.
LoginVO loginVO = mapper.actionLogin(vo); //loginDAO.actionLogin(vo);
// 3. 결과를 리턴한다.
if (loginVO != null && !loginVO.getId().equals("") && !loginVO.getPassword().equals("")) {
return loginVO;
} else {
loginVO = new LoginVO();
}
return loginVO;
}
}

@ -1,32 +0,0 @@
package kr.xit.core.biz.service;
import egovframework.com.cmm.LoginVO;
/**
*
* @author
* @since 2009.03.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.06
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface IAuthApiService {
/**
*
*
* @param vo LoginVO
* @return LoginVO
*/
LoginVO actionLogin(LoginVO vo);
}

@ -1,184 +0,0 @@
package kr.xit.core.biz.web;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import egovframework.com.cmm.EgovMessageSource;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.jwt.config.EgovJwtTokenUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.biz.service.IAuthApiService;
import kr.xit.core.consts.Constants;
import lombok.RequiredArgsConstructor;
/**
* <pre>
* description :
*
* packageName : kr.xit.biz.auth
* fileName : AuthApiController
* author : limju
* date : 2023-04-26
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-04-26 limju
*
* </pre>
* @see
*/
//FIXME::세션에서 인증 관리 할지 여부 결정 필요
@Tag(name = "AuthApiController", description = "인증 관리")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/batch/core/auth")
public class AuthApiController {
@Value("${app.token.saveType:header}")
private String authSaveType;
/** EgovLoginService */
private final IAuthApiService loginService;
/** EgovMessageSource */
private final EgovMessageSource egovMessageSource;
private final EgovJwtTokenUtil egovJwtTokenUtil;
/**
*
* @param loginVO , LoginVO
* @param request HttpServletRequest
* @return ()
*/
@Operation(summary = "로그인" , description = "로그인")
@io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = {
@Content(
mediaType = "application/json",
examples = {
@ExampleObject(
value = "{\"id\":\"admin\",\"password\":\"1\",\"userSe\":\"USR\"}")
}
)
}
)
@PostMapping(value = "/login", consumes = {MediaType.APPLICATION_JSON_VALUE , MediaType.TEXT_HTML_VALUE})
public ApiResponseDTO<?> login(@RequestBody final LoginVO loginVO, HttpServletRequest request) {
// 1. 일반 로그인 처리
LoginVO loginResultVO = loginService.actionLogin(loginVO);
if (loginResultVO != null && loginResultVO.getId() != null && !loginResultVO.getId().equals("")) {
request.getSession().setAttribute(Constants.AuthSaveSession.LOGIN_VO.getCode(), loginResultVO);
return ApiResponseDTO.success(loginResultVO);
}
return ApiResponseDTO.success(egovMessageSource.getMessage("fail.common.login"));
}
@Operation(summary = "로그인(JWT)" , description = "로그인(JWT)")
@io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = {
@Content(
mediaType = "application/json",
examples = {
@ExampleObject(
name = "admin",
description = "admin",
value = "{\"id\":\"admin\",\"password\":\"1\",\"userSe\":\"USR\"}"),
@ExampleObject(
name = "admin1",
description = "admin1",
value = "{\"id\":\"admin1\",\"password\":\"1\",\"userSe\":\"USR\"}"),
@ExampleObject(
name = "admin2",
description = "admin2",
value = "{\"id\":\"admin2\",\"password\":\"1\",\"userSe\":\"USR\"}")
}
)
}
)
@PostMapping(value = "/loginJwt")
public ApiResponseDTO<?> loginJWT(@RequestBody final LoginVO loginVO, HttpServletRequest request) {
HashMap<String, Object> resultMap = new HashMap<String, Object>();
// 1. 일반 로그인 처리
LoginVO loginResultVO = loginService.actionLogin(loginVO);
if (loginResultVO != null && loginResultVO.getId() != null && !loginResultVO.getId().equals("")) {
Map<String, Object> claimsMap = new HashMap<>();
// claimsMap.put("dkkdk", "kdkkdkdkd");
String jwtToken = egovJwtTokenUtil.generateToken(loginVO, claimsMap);
// String jwtToken = egovJwtTokenUtil.generateToken(loginVO.getId());
String username = egovJwtTokenUtil.getUsernameFromToken(jwtToken);
// System.out.println("Dec jwtToken username = "+username);
//서버사이드 권한 체크 통과를 위해 삽입
//EgovUserDetailsHelper.isAuthenticated() 가 그 역할 수행. DB에 정보가 없으면 403을 돌려 줌. 로그인으로 튕기는 건 프론트 쪽에서 처리
request.getSession().setAttribute(Constants.AuthSaveSession.LOGIN_VO.getCode(), loginResultVO);
// UsernamePasswordAuthenticationToken authenticationToken = jwtTokenProvider.toAuthentication(loginVO.getId(), loginVO.getPassword());
// Authentication authentication = authenticationManager.authenticate(authenticationToken);
//
//
// // Authentication 저장
// if(Objects.equals(authSaveType, Constants.AuthSaveType.SECURITY.getCode())){
// // TODO :: SessionCreationPolicy.STATELESS 인 경우 사용 불가
// SecurityContextHolder.getContext().setAuthentication(authentication);
//
// }else if(Objects.equals(authSaveType, Constants.AuthSaveType.SESSION.getCode())){
// session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
// }
//Map<String, Object> infoMap = new HashMap<>();
//infoMap.put(Constants.JwtToken.TOKEN_USER_ID.getCode(), loginVO.getId());
//infoMap.put(Constants.JwtToken.TOKEN_USER_MAIL.getCode(), loginVO.getEmail());
//String jwtToken = jwtTokenProvider.generateJwtAccessToken(authentication, infoMap);
//String jwtToken = jwtTokenProvider.generateJwtAccessToken(loginVO.getId(), "ROLE_USER");
resultMap.put("resultVO", loginResultVO);
resultMap.put("token", jwtToken);
return ApiResponseDTO.success(resultMap);
}
return ApiResponseDTO.error(egovMessageSource.getMessage("fail.common.login") );
}
/**
* .
* @return resultVO
* @exception Exception
*/
@Operation(summary = "logout" , description = "로그아웃")
@GetMapping(value = "/logout")
public ApiResponseDTO<?> actionLogoutJSON(HttpServletRequest request) {
RequestContextHolder.currentRequestAttributes().removeAttribute(Constants.AuthSaveSession.LOGIN_VO.getCode(), RequestAttributes.SCOPE_SESSION);
return ApiResponseDTO.empty();
}
}

@ -1,60 +0,0 @@
package kr.xit.core.biz.web;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.biz.model.LoggingDTO;
import kr.xit.core.biz.service.ILoggingService;
import lombok.RequiredArgsConstructor;
/**
* <pre>
* description : API Logging cotroller
*
* packageName : kr.xit.core.biz.web
* fileName : LoggingController
* author : limju
* date : 2023-05-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-05-11 limju
*
* </pre>
*/
@Tag(name = "LoggingController", description = "API logging 관리")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/batch/core/log")
public class LoggingController {
private final ILoggingService loggingService;
@Operation(summary = "로깅 정보 저장" , description = "로깅 정보 저장")
@io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = {
@Content(
mediaType = "application/json",
examples = {
@ExampleObject(
value = "{\"requestId\":\"7f1f5978fc1941c4a6d37351a6d692e6\"}")
}
)
}
)
@PostMapping(value = "/save", consumes = {MediaType.APPLICATION_JSON_VALUE , MediaType.TEXT_HTML_VALUE})
public ApiResponseDTO saveLogging(@RequestBody final LoggingDTO reqDTO){
loggingService.saveLogging(reqDTO);
return ApiResponseDTO.empty();
}
}

@ -23,20 +23,11 @@ import org.springframework.context.annotation.Configuration;
@ConditionalOnProperty(value = "springdoc.swagger-ui.enabled", havingValue = "true", matchIfMissing = false)
@Configuration
public class SpringDocsApiConfig {
@Bean
public GroupedOpenApi authentification() {
return GroupedOpenApi.builder()
.group("1. Core API")
.pathsToMatch(
"/batch/core/**"
)
.build();
}
@Bean
public GroupedOpenApi kakaopayEltrcDocBatch() {
return GroupedOpenApi.builder()
.group("2. 전자고지 통합발송 연계 Batch WEB")
.group("1. 전자고지 통합발송 연계 Batch WEB")
.pathsToMatch(
"/batch/v1/**"
)
@ -46,7 +37,7 @@ public class SpringDocsApiConfig {
@Bean
public GroupedOpenApi bizDoc() {
return GroupedOpenApi.builder()
.group("3. 전자고지 통합발송 연계 API")
.group("2. 전자고지 발송 연계 Batch API")
.pathsToMatch(
"/batch/ens/**"
)
@ -56,7 +47,7 @@ public class SpringDocsApiConfig {
@Bean
public GroupedOpenApi pniDoc() {
return GroupedOpenApi.builder()
.group("6. 사전고지 API")
.group("3. 사전고지 Batch API")
.pathsToMatch(
"/batch/pni/v1/**"
)

Loading…
Cancel
Save