简体   繁体   中英

Bypass jasig CAS authentication

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 ie (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;
}
}

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM