package kcg.imis.sec;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kcg.imis.cmmn.mapper.LogMapper;
import kcg.imis.sec.mapper.SecurityMapper;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;

/**
 * 
  * @FileName : LogoutSuccessHandler.java
  * @Project : 국제해양프로젝트
  * @Date : 2018. 3. 29. 
  * @작성자 : Moon
  * @변경이력 : 
  * @프로그램 설명 :
 */
public class LogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {
	
	private String successUrl = "/loginView.do";
	
	public void setSuccessUrl(String successUrl){
		this.successUrl = successUrl;
	}
	
	@Resource(name = "logMapper")
	LogMapper logMapper;
	
	@Resource(name = "securityMapper")
	SecurityMapper securityMapper;
	
	 @Override
	    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
	        setDefaultTargetUrl(successUrl);
	        super.onLogoutSuccess(request, response, authentication);       
	    }
}
