package sgc.portal.security;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <pre>
 * 승인된 URL 요청자에 대해서만 접속.
 * referer : 당사 접속 url, localhost
 * </pre>
 *
 * @author YongSang
 */
class SecurityRefererPolicy extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {

//        boolean retb = false;
//        String ref = request.getHeader("referer");
//        if(ref.indexOf(".sgc.co.kr") >= 1 || ref.indexOf("localhost") >= 1 || ref.indexOf("165.141.228.221") >= 1){
//            retb = true;
//        }
//        if(ref.indexOf("http://", 30) >= 1){
//            retb = false;
//        }
        return true;
    }

}