简体   繁体   English

绕过jasig CAS认证

[英]Bypass jasig CAS authentication

I have integrated an application on tomcat to use Jasig Cas. 我已经在tomcat上集成了一个应用程序以使用Jasig Cas。 Now i have made the entire application(SampleApp) to be authenticated by CAS. 现在,我已经完成了要由CAS进行身份验证的整个应用程序(SampleApp)。 But there is a certain URL that i need to bypass this authentication ie (SampleApp/HomeListener). 但是我需要绕过某些身份验证,即(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. 但是我需要在Servlet请求对象中修改什么参数才能实现此目的。

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. 尝试将“ ignorePattern”参数添加到web.xml中的身份验证筛选器配置中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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