0
votes

I have integrated an application on tomcat to use Jasig Cas. Now i have made the entire application(SampleApp) to be authenticated by CAS. But there is a certain URL that i need to bypass this authentication i.e. (SampleApp/HomeListener).

I have written a new application Filter for this. But what parameter do i need to modify in the Servlet request object to achieve this.

Filter

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;
}
}
1
using Spring Security make it too much easier for you...Mahdi

1 Answers

0
votes

You do not need to write your own filter. Try adding the "ignorePattern" parameter to your authentication filter configuration in your web.xml.

<init-param>            
    <param-name>ignorePattern</param-name>
    <param-value>http://<your url pattern to bypass>/(.*)</param-value>
</init-param>