我在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;
}
}
答案 0 :(得分:0)
您无需编写自己的过滤器。尝试将“ignorePattern”参数添加到web.xml中的身份验证筛选器配置中。
<init-param>
<param-name>ignorePattern</param-name>
<param-value>http://<your url pattern to bypass>/(.*)</param-value>
</init-param>