Cas filter client端没有自带过滤掉某些url不进行单点登录的init-param ,需要实现自定义的Filter 取代org.jasig.cas.client.authentication.AuthenticationFilter和org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
1.实现CASAuthenticationFilter extends AbstractCasFilter
因为cas自带的filter中org.jasig.cas.client.authentication.AuthenticationFilter 的doFilter方法是final的,无法重写,所以需要直接继承AbstractCasFilter
实现代码如下
1.实现CASAuthenticationFilter extends AbstractCasFilter
因为cas自带的filter中org.jasig.cas.client.authentication.AuthenticationFilter 的doFilter方法是final的,无法重写,所以需要直接继承AbstractCasFilter
实现代码如下
[public class CASAuthenticationFilter extends AbstractCasFilter {
private final String ExcludeFile = "ExcludeFile"; //excludeFile 列表
private String casServerLoginUrl;
private boolean renew;
private boolean gateway;
private GatewayResolver gatewayStorage;
private String strExcludeFile;
private String[] arrExcludeFile = null;
public CASAuthenticationFilter(){
this.renew = false;
this.gateway = false;
this.gatewayStorage = new DefaultGatewayResolverImpl();
setStrExcludeFile("");
}
protected void initInternal(FilterConfig filterConfig) throws ServletException {
if (!(isIgnoreInitConfiguration())) {
super.initInternal(filterConfig);
setCasServerLoginUrl(getPropertyFromInitParams(filterConfig, "casServerLoginUrl", null));
this.log.trace("Loaded CasServerLoginUrl parameter: " + this.casServerLoginUrl);
setRenew(parseBoolean(getPropertyFromInitParams(filterConfig, "renew", "false")));
this.log.trace("Loaded renew parameter: " + this.renew);
setGateway(parseBoolean(getPropertyFromInitParams(filterConfig, "gateway", "false")));
this.log.trace("Loaded gateway parameter: " + this.gateway);
setStrExcludeFil