Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Spring Security中将头未找到异常重定向到登录页面_Java_Spring_Spring Security_Pre Authentication - Fatal编程技术网

Java 如何在Spring Security中将头未找到异常重定向到登录页面

Java 如何在Spring Security中将头未找到异常重定向到登录页面,java,spring,spring-security,pre-authentication,Java,Spring,Spring Security,Pre Authentication,我正在使用SpringSecuritySiteMinder实现解决方案。如果在请求中找不到标题,我可以在标题中检查SM_用户。我想将请求重定向到登录页面。我是spring的新手,如何才能做到这一点 配置为: 在RequestHeaderFilterAuth中尝试以下操作: public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOE

我正在使用SpringSecuritySiteMinder实现解决方案。如果在请求中找不到标题,我可以在标题中检查SM_用户。我想将请求重定向到登录页面。我是spring的新手,如何才能做到这一点

配置为:


RequestHeaderFilterAuth
中尝试以下操作:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {

       String header = ((HttpServletRequest)request).getHeader(headerName);
       if(header == null){
           ((HttpServletResponse) response).sendRedirect(loginUrl);
       }  
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {

       String header = ((HttpServletRequest)request).getHeader(headerName);
       if(header == null){
           ((HttpServletResponse) response).sendRedirect(loginUrl);
       }  
}