如何将SpringMVC中的cas单点配置在Spring boot中?

之前做了一个SpringMVC的多模块项目,登录用的是cas来管理的,现在需要再增加一个模块,但是用的Springboot开发的,模块登录也是没问题的,但是退出系统时,MVC的模块都退出成功了,boot的模块的登录信息却还在,不知道是什么原因,以下是SpringMVC和SpringBoot关于退出的配置,退出系统
调用url:http://localhost:8080/cas/logout

MVC:

<listener>
    <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
</listener>
<!-- 单点登出 -->
<filter>
    <filter-name>SingleSignOutFilter</filter-name>
    <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>SingleSignOutFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

boot:

    @Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}

        @Bean
public FilterRegistrationBean singleSignOutFilter(CasProperties casProperties, ServiceProperties serviceProperties) {
    FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
    filterRegistration.setName("SingleSignOutFilter");
    filterRegistration.setFilter(new SingleSignOutFilter());
    filterRegistration.setEnabled(true);
    filterRegistration.addUrlPatterns("/*");
    filterRegistration.addInitParameter("casServerUrlPrefix", casProperties.getCasServerUrlPrefix());
    filterRegistration.addInitParameter("serverName", serviceProperties.getServerName());
    filterRegistration.setOrder(3);
    return filterRegistration;
}


    已经解决了,是filter顺序问题
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问