我已经在tomcat上集成了一个应用程序来使用Jasig Cas。现在,我已经将整个应用程序(SampleApp)通过CAS进行了身份验证。但是我需要一个特定的URL来绕过这个身份验证,即(SampleApp/HomeListener)。
我已经为此编写了一个新的应用程序过滤器。但是,我需要修改Servlet请求对象中的哪些参数才能实现这一点。
滤波器
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;
public class PatternFilter implements Filter {
private FilterConfig config;
public void destroy() {
//nothing here
}
/**
* Filters the HTTP requests
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filter) throws IOException, ServletException {
filter.doFilter(request, response);
}
public void init(FilterConfig filterConfiguration) throws ServletException {
// TODO Auto-generated method stub
config = filterConfiguration;
}
}发布于 2015-06-19 04:30:20
您不需要编写自己的过滤器。尝试将"ignorePattern“参数添加到web.xml中的身份验证筛选器配置中。
<init-param>
<param-name>ignorePattern</param-name>
<param-value>http://<your url pattern to bypass>/(.*)</param-value>
</init-param>https://stackoverflow.com/questions/29163632
复制相似问题