parent
8d8ae287e3
commit
82408afd53
@ -0,0 +1,15 @@
|
|||||||
|
//package kr.xit.core.spring.config;
|
||||||
|
//
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||||
|
//
|
||||||
|
//@Configuration
|
||||||
|
//public class ApplicationNoSecurity {
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// public WebSecurityCustomizer webSecurityCustomizer() {
|
||||||
|
// return (web) -> web.ignoring()
|
||||||
|
// .antMatchers("/**");
|
||||||
|
// }
|
||||||
|
//}
|
@ -1,79 +0,0 @@
|
|||||||
package kr.xit.core.spring.util;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import kr.xit.core.exception.BizRuntimeException;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* description :
|
|
||||||
*
|
|
||||||
* packageName : kr.xit.core.spring.util
|
|
||||||
* fileName : BlobInsert
|
|
||||||
* author : limju
|
|
||||||
* date : 2023-10-25
|
|
||||||
* ======================================================================
|
|
||||||
* 변경일 변경자 변경 내용
|
|
||||||
* ----------------------------------------------------------------------
|
|
||||||
* 2023-10-25 limju 최초 생성
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
public class BlobInsert {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String url = "jdbc:mariadb://211.119.124.9:4407/mens?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true";
|
|
||||||
String user = "root";
|
|
||||||
String password = "xit1807";
|
|
||||||
|
|
||||||
String filePath = "C:\\Users\\xitdev\\Pictures\\dp.jpg";
|
|
||||||
|
|
||||||
try {
|
|
||||||
try (Connection conn = DriverManager.getConnection(url, user, password)) {
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
String sql = """
|
|
||||||
UPDATE tb_ens_tmplat_manage
|
|
||||||
SET mms_binary = ?
|
|
||||||
, file_fmat = ?
|
|
||||||
WHERE tmplat_id like 'DP%'
|
|
||||||
""";
|
|
||||||
int idx = 1;
|
|
||||||
PreparedStatement statement = conn.prepareStatement(sql);
|
|
||||||
|
|
||||||
File file = new File(filePath);
|
|
||||||
if(!file.exists()) {
|
|
||||||
throw BizRuntimeException.create(String.join(StringUtils.EMPTY, filePath, " 파일이 존재하지 않습니다."));
|
|
||||||
}
|
|
||||||
double size = Math.ceil(file.length()/1024.0 * 10)/10;
|
|
||||||
if(size > 300.0){
|
|
||||||
throw BizRuntimeException.create(String.format("파일 크기 %s[템플릿 파일 크기는 300kb를 넘을 수 없습니다]", size));
|
|
||||||
}
|
|
||||||
|
|
||||||
try (InputStream inputStream = new FileInputStream(file)) {
|
|
||||||
|
|
||||||
statement.setBlob(idx++, inputStream);
|
|
||||||
|
|
||||||
statement.setString(idx++, file.getName().split("\\.")[1]);
|
|
||||||
statement.setString(idx++, "ME111");
|
|
||||||
|
|
||||||
int row = statement.executeUpdate();
|
|
||||||
|
|
||||||
conn.commit();
|
|
||||||
|
|
||||||
}catch (IOException e) {
|
|
||||||
throw BizRuntimeException.create(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
throw BizRuntimeException.create(ex.getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,107 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>우편연계 예제</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<br><br>
|
|
||||||
<form>
|
|
||||||
<input type="file" name="attchFile">
|
|
||||||
<button type="button" onclick="PstMsr()">우편 연계</button>
|
|
||||||
</form>
|
|
||||||
<br><br>
|
|
||||||
<script type="text/javascript" src="http://code.jquery.com/jquery-3.4.1.min.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function PstMsr() {
|
|
||||||
|
|
||||||
// master
|
|
||||||
var master = new Object();
|
|
||||||
var masterCols = ['버전','테스트여부','서비스','연계식별키','봉투','봉투창','흑백칼라','단면양면','배달','템플릿코드','템플릿출력여부','수취인수','여백생성유무','주소페이지유무','맞춤자제유무','메일머지유무','동봉물유무','반송여부','스테이플러유무','로고파일','발송인명','발송인우편번호','발송인주소','발송인상세주소','발송인전화번호'];
|
|
||||||
master.cols = masterCols;
|
|
||||||
|
|
||||||
var masterRows = new Array();
|
|
||||||
masterRows.push("v1.10"); // 버전
|
|
||||||
masterRows.push("Y"); // 테스트여부
|
|
||||||
masterRows.push("PST"); // 서비스
|
|
||||||
masterRows.push("POST20230422_000001"); // 연계식별키
|
|
||||||
masterRows.push("소봉투"); // 봉투
|
|
||||||
masterRows.push("이중창"); // 봉투창
|
|
||||||
masterRows.push("흑백"); // 흑백칼라
|
|
||||||
masterRows.push("단면"); // 단면양면
|
|
||||||
masterRows.push("일반"); // 배달
|
|
||||||
masterRows.push(""); // 템플릿코드
|
|
||||||
masterRows.push("N"); // 템플릿출력여부
|
|
||||||
masterRows.push(2); // 수취인수
|
|
||||||
masterRows.push("N"); // 여백생성유무
|
|
||||||
masterRows.push("N"); // 주소페이지유무
|
|
||||||
masterRows.push("N"); // 맞춤자제유무
|
|
||||||
masterRows.push("N"); // 메일머지유무
|
|
||||||
masterRows.push("N"); // 동봉물유무
|
|
||||||
masterRows.push("N"); // 반송여부
|
|
||||||
masterRows.push("N"); // 스테이플러유무
|
|
||||||
masterRows.push("N"); // 로고파일
|
|
||||||
masterRows.push("포스토피아"); // 발송인명
|
|
||||||
masterRows.push("05048"); // 발송인우편번호
|
|
||||||
masterRows.push("서울특별시 광진구 강변역로2"); // 발송인주소
|
|
||||||
masterRows.push("서울광진우체국 B동 4층"); // 발송인상세주소
|
|
||||||
masterRows.push("1577-8114"); // 발송인전화번호
|
|
||||||
master.rows = masterRows;
|
|
||||||
|
|
||||||
|
|
||||||
// detail
|
|
||||||
var detail = new Object();
|
|
||||||
var detailCols = ['순번','이름','우편번호','주소','상세주소','전화번호','첨부파일','가변1','가변2','가변3','가변4'];
|
|
||||||
detail.cols = detailCols;
|
|
||||||
|
|
||||||
var detailRows = new Array();
|
|
||||||
var detailRowsArr1 = ['1',['홍길동1','lll'],'31010','서울특별시 광진구 강변역로2','서울광진우체국 B동 1층','01012341234','pstFile.pdf','24926737','2021-09-02','대출(고정)','31,000,000'];
|
|
||||||
detailRows.push(detailRowsArr1);
|
|
||||||
var detailRowsArr2 = ['2','홍길동2','08394','서울특별시 광진구 강변역로2','서울광진우체국 B동 2층','01012341234','pstFile.pdf','25685047','2021-09-02','대출B(변동)','421,000,000'];
|
|
||||||
detailRows.push(detailRowsArr2);
|
|
||||||
detail.rows = detailRows;
|
|
||||||
|
|
||||||
var pst = new Object();
|
|
||||||
pst.master = master;
|
|
||||||
pst.detail = detail;
|
|
||||||
|
|
||||||
var pstMsr = JSON.stringify(pst);
|
|
||||||
|
|
||||||
console.log(pstMsr);
|
|
||||||
//alert(pstMsr);
|
|
||||||
//document.write(pstMsr);
|
|
||||||
|
|
||||||
var formData = new FormData();
|
|
||||||
|
|
||||||
formData.append("signguCode", "88328");
|
|
||||||
formData.append("ffnlgCode", "11");
|
|
||||||
formData.append("apiKey", "PnvGWlH0X55ZyEqIEyJIJpKAf26xIcY11/UYgMehuhlR8+8yfV01S2Qjr7d/f0FMhVhdeJGg/KChN2sjb/Rg==");
|
|
||||||
|
|
||||||
formData.append('pstFile', new File([new Blob([pstMsr], {type : "application/json"})], "pstFile", {type : "application/json"}));
|
|
||||||
|
|
||||||
var files = $("input[name=attchFile]")[0].files;
|
|
||||||
formData.append("pstFile", files[0]);
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
//url: 'https://t.postplus.co.kr/po/api/postplusPstMsrApi.do',
|
|
||||||
url: '/api/ens/pplus/v1/accept',
|
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
enctype : 'multipart/form-data',
|
|
||||||
type: 'POST',
|
|
||||||
success: function(data) {
|
|
||||||
console.log(data);
|
|
||||||
alert(JSON.stringify(data));
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
console.log(e);
|
|
||||||
alert(JSON.stringify(e));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||||||
|
//package kr.xit.core.spring.config;
|
||||||
|
//
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||||
|
//
|
||||||
|
//@Configuration
|
||||||
|
//public class ApplicationNoSecurity {
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// public WebSecurityCustomizer webSecurityCustomizer() {
|
||||||
|
// return (web) -> web.ignoring()
|
||||||
|
// .antMatchers("/**");
|
||||||
|
// }
|
||||||
|
//}
|
@ -1,53 +0,0 @@
|
|||||||
package egovframework.com.jwt;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import kr.xit.core.model.ApiResponseDTO;
|
|
||||||
import kr.xit.core.support.utils.JsonUtils;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.security.core.AuthenticationException;
|
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fileName : JwtAuthenticationEntryPoint
|
|
||||||
* author : crlee
|
|
||||||
* date : 2023/06/11
|
|
||||||
* description :
|
|
||||||
* ===========================================================
|
|
||||||
* DATE AUTHOR NOTE
|
|
||||||
* -----------------------------------------------------------
|
|
||||||
* 2023/06/11 crlee 최초 생성
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@Component
|
|
||||||
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
|
|
||||||
|
|
||||||
// ResultVO resultVO = new ResultVO();
|
|
||||||
// resultVO.setResultCode(ResponseCode.AUTH_ERROR.getCode());
|
|
||||||
// resultVO.setResultMessage(ResponseCode.AUTH_ERROR.getMessage());
|
|
||||||
// ObjectMapper mapper = new ObjectMapper();
|
|
||||||
//
|
|
||||||
// //Convert object to JSON string
|
|
||||||
// String jsonInString = mapper.writeValueAsString(resultVO);
|
|
||||||
|
|
||||||
// 403 에러
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
ApiResponseDTO apiResponseDTO = ApiResponseDTO.builder()
|
|
||||||
.success(false)
|
|
||||||
.code(String.valueOf(HttpStatus.FORBIDDEN.value()))
|
|
||||||
.message("인가된 사용자가 아닙니다")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON.toString());
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
response.getWriter().println(JsonUtils.toJson(apiResponseDTO));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
package egovframework.com.jwt;
|
|
||||||
|
|
||||||
import egovframework.com.cmm.LoginVO;
|
|
||||||
import egovframework.com.cmm.util.EgovStringUtil;
|
|
||||||
import io.jsonwebtoken.ExpiredJwtException;
|
|
||||||
import io.jsonwebtoken.MalformedJwtException;
|
|
||||||
import io.jsonwebtoken.SignatureException;
|
|
||||||
import io.jsonwebtoken.UnsupportedJwtException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import javax.servlet.FilterChain;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import kr.xit.core.support.utils.Checks;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fileName : JwtAuthenticationFilter
|
|
||||||
* author : crlee
|
|
||||||
* date : 2023/06/11
|
|
||||||
* description :
|
|
||||||
* ===========================================================
|
|
||||||
* DATE AUTHOR NOTE
|
|
||||||
* -----------------------------------------------------------
|
|
||||||
* 2023/06/11 crlee 최초 생성
|
|
||||||
*/
|
|
||||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EgovJwtTokenUtil jwtTokenUtil;
|
|
||||||
public static final String HEADER_STRING = "Authorization";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain)
|
|
||||||
throws IOException, ServletException {
|
|
||||||
boolean verificationFlag = true;
|
|
||||||
|
|
||||||
// step 1. request header에서 토큰을 가져온다.
|
|
||||||
String jwtToken = EgovStringUtil.isNullToString(req.getHeader(HEADER_STRING));
|
|
||||||
if(Checks.isEmpty(jwtToken)){
|
|
||||||
chain.doFilter(req, res);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// step 2. 토큰에 내용이 있는지 확인해서 id값을 가져옴
|
|
||||||
// Exception 핸들링 추가처리 (토큰 유효성, 토큰 변조 여부, 토큰 만료여부)
|
|
||||||
// 내부적으로 parse하는 과정에서 해당 여부들이 검증됨
|
|
||||||
String id = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
id = jwtTokenUtil.getUserIdFromToken(jwtToken);
|
|
||||||
if (id == null) {
|
|
||||||
logger.debug("jwtToken not validate");
|
|
||||||
verificationFlag = false;
|
|
||||||
}
|
|
||||||
logger.debug("===>>> id = " + id);
|
|
||||||
} catch (IllegalArgumentException | ExpiredJwtException | MalformedJwtException | UnsupportedJwtException | SignatureException e) {
|
|
||||||
logger.debug("Unable to verify JWT Token: " + e.getMessage());
|
|
||||||
verificationFlag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginVO loginVO = new LoginVO();
|
|
||||||
if( verificationFlag ){
|
|
||||||
logger.debug("jwtToken validated");
|
|
||||||
loginVO.setId(id);
|
|
||||||
loginVO.setUserSe( jwtTokenUtil.getUserSeFromToken(jwtToken) );
|
|
||||||
loginVO.setUniqId( jwtTokenUtil.getInfoFromToken("uniqId",jwtToken) );
|
|
||||||
loginVO.setOrgnztId( jwtTokenUtil.getInfoFromToken("orgnztId",jwtToken) );
|
|
||||||
loginVO.setName( jwtTokenUtil.getInfoFromToken("name",jwtToken) );
|
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginVO, null,
|
|
||||||
Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"))
|
|
||||||
);
|
|
||||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(req));
|
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chain.doFilter(req, res);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package egovframework.com.security;
|
|
||||||
|
|
||||||
import egovframework.com.cmm.LoginVO;
|
|
||||||
import org.springframework.core.MethodParameter;
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
|
||||||
import org.springframework.web.context.request.NativeWebRequest;
|
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
||||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fileName : CustomAuthenticationPrincipalResolver
|
|
||||||
* author : crlee
|
|
||||||
* date : 2023/07/13
|
|
||||||
* description :
|
|
||||||
* ===========================================================
|
|
||||||
* DATE AUTHOR NOTE
|
|
||||||
* -----------------------------------------------------------
|
|
||||||
* 2023/07/13 crlee 최초 생성
|
|
||||||
*/
|
|
||||||
public class CustomAuthenticationPrincipalResolver implements HandlerMethodArgumentResolver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supportsParameter(MethodParameter parameter) {
|
|
||||||
return parameter.hasParameterAnnotation(AuthenticationPrincipal.class) &&
|
|
||||||
parameter.getParameterType().equals(LoginVO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
|
||||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
|
||||||
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
|
||||||
if (authentication == null ||
|
|
||||||
authentication.getPrincipal() == null ||
|
|
||||||
"anonymousUser".equals(authentication.getPrincipal())
|
|
||||||
) {
|
|
||||||
return new LoginVO();
|
|
||||||
}
|
|
||||||
|
|
||||||
return authentication.getPrincipal();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
package egovframework.com.security;
|
|
||||||
|
|
||||||
import egovframework.com.jwt.JwtAuthenticationEntryPoint;
|
|
||||||
import egovframework.com.jwt.JwtAuthenticationFilter;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
|
||||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
|
||||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fileName : SecurityConfig
|
|
||||||
* author : crlee
|
|
||||||
* date : 2023/06/10
|
|
||||||
* description :
|
|
||||||
* ===========================================================
|
|
||||||
* DATE AUTHOR NOTE
|
|
||||||
* -----------------------------------------------------------
|
|
||||||
* 2023/06/10 crlee 최초 생성
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableWebSecurity
|
|
||||||
public class SecurityConfig implements WebMvcConfigurer {
|
|
||||||
|
|
||||||
//Http Methpd : Get 인증예외 List
|
|
||||||
private String[] AUTH_GET_WHITELIST = {
|
|
||||||
"/schedule/daily", //일별 일정 조회
|
|
||||||
"/schedule/week", //주간 일정 조회
|
|
||||||
"/schedule/{schdulId}", //일정 상세조회
|
|
||||||
};
|
|
||||||
|
|
||||||
// 인증 예외 List
|
|
||||||
@Value("${app.spring.security.white-list}")
|
|
||||||
private String[] AUTH_WHITELIST;
|
|
||||||
|
|
||||||
private static final String[] ORIGINS_WHITELIST = {
|
|
||||||
"http://localhost:3000",
|
|
||||||
"http://localhost:8081",
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
||||||
argumentResolvers.add(new CustomAuthenticationPrincipalResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public JwtAuthenticationFilter authenticationTokenFilterBean() throws Exception {
|
|
||||||
return new JwtAuthenticationFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @Bean
|
|
||||||
// protected CorsConfigurationSource corsConfigurationSource() {
|
|
||||||
// CorsConfiguration configuration = new CorsConfiguration();
|
|
||||||
//
|
|
||||||
// configuration.setAllowedOriginPatterns(Arrays.asList("*"));
|
|
||||||
// configuration.setAllowedMethods(Arrays.asList("HEAD","POST","GET","DELETE","PUT"));
|
|
||||||
// configuration.setAllowedOrigins(Arrays.asList(ORIGINS_WHITELIST));
|
|
||||||
// configuration.setAllowedHeaders(Arrays.asList("*"));
|
|
||||||
// configuration.setAllowCredentials(true);
|
|
||||||
//
|
|
||||||
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
||||||
// source.registerCorsConfiguration("/**", configuration);
|
|
||||||
// return source;
|
|
||||||
// }
|
|
||||||
@Bean
|
|
||||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
||||||
|
|
||||||
return http
|
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
|
||||||
.authorizeHttpRequests(authorize -> authorize
|
|
||||||
.antMatchers(AUTH_WHITELIST).permitAll()
|
|
||||||
.antMatchers(HttpMethod.GET,AUTH_GET_WHITELIST).permitAll()
|
|
||||||
.anyRequest().authenticated()
|
|
||||||
).sessionManagement((sessionManagement) ->
|
|
||||||
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
|
||||||
)
|
|
||||||
.cors().and()
|
|
||||||
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class)
|
|
||||||
.exceptionHandling(exceptionHandlingConfigurer ->
|
|
||||||
exceptionHandlingConfigurer
|
|
||||||
.authenticationEntryPoint(new JwtAuthenticationEntryPoint())
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework constant package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.consts;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework Exception package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.exception;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework model package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.model;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* annotation
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.annotation;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* config - authentification
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.config.auth;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* encript / decript
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.config.custom.bouncy;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* config
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.config;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* properties
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.config.properties;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* 3rd-party config
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.config.support;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* converter
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.converter;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* filter
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.filter;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* resolver
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.resolver;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework spring customizing package classes
|
|
||||||
* <p>
|
|
||||||
* utility
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.spring.util;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework 3rd-party library package classes
|
|
||||||
* <p>
|
|
||||||
* logback 확장
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.support.logback;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework 3rd-party library package classes
|
|
||||||
* <p>
|
|
||||||
* mybatis
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.support.mybatis;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework 3rd-party library package classes
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.support;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework 3rd-party library package classes
|
|
||||||
* <p>
|
|
||||||
* slack
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.support.slack;
|
|
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* xit core java framework 3rd-party library package classes
|
|
||||||
* <p>
|
|
||||||
* utility
|
|
||||||
* </p>
|
|
||||||
* @since 1.0
|
|
||||||
* @author limju
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
package kr.xit.core.support.utils;
|
|
Loading…
Reference in New Issue