필터 적용 및 pom.xml 라이브러리 추가
This commit is contained in:
parent
e4632bc333
commit
15325890e8
13
pom.xml
13
pom.xml
@ -427,6 +427,19 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oroinc</groupId>
|
||||
<artifactId>NetComponents</artifactId>
|
||||
<version>1.3.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tmax.tibero</groupId>
|
||||
<artifactId>tibero-jdbc</artifactId>
|
||||
<version>5.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package kcc.let.uat.uia.web;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SSOValid implements Filter {
|
||||
// 초기화 함수
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
// 필터 함수, 브라우저에서 요청이 오면 필터 매핑에 의해 호출된다.
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package kcc.let.uat.uia.web;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import kcc.com.cmm.LoginVO;
|
||||
|
||||
@Component
|
||||
public class SessionCheckCustomFilter extends OncePerRequestFilter{
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
|
||||
|
||||
/*==================================================================================================================================================
|
||||
*================================================================== 구현부 prehandle =================================================================
|
||||
*/
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
|
||||
HttpSession session = req.getSession();
|
||||
|
||||
LoginVO loginVO = (LoginVO) session.getAttribute("LoginVO");
|
||||
// session.setAttribute(null, session);
|
||||
|
||||
if(loginVO == null) {
|
||||
/*Spring Security 로그아웃*/
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (auth != null) {
|
||||
new SecurityContextLogoutHandler().logout(req, resp, auth);
|
||||
}
|
||||
}
|
||||
|
||||
/*==================================================================================================================================================
|
||||
*================================================================== 구현부 prehandle 끝 ===============================================================
|
||||
*/
|
||||
|
||||
|
||||
//주의 !! 다음 필터 체인 실행 코드로 꼭 포함되어야함
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,17 +44,16 @@
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- 전자조정시스템 SSO Valid 필터 -->
|
||||
<!-- 세션 LoginVO 검증 필터 -->
|
||||
<!-- 필터 순서에 유의 -->
|
||||
<!-- <filter>
|
||||
<filter-name>kccadrLoginValidFilter</filter-name>
|
||||
<filter-class>kcc.let.uat.uia.web.SSOValid</filter-class>
|
||||
<filter>
|
||||
<filter-name>SessionCheckCustomFilter</filter-name>
|
||||
<filter-class>kcc.let.uat.uia.web.SessionCheckCustomFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>kccadrLoginValidFilter</filter-name>
|
||||
<url-pattern>/web/*</url-pattern>
|
||||
</filter-mapping> -->
|
||||
|
||||
<filter-name>SessionCheckCustomFilter</filter-name>
|
||||
<url-pattern>*.do</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- site mesh -->
|
||||
<filter>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user