“这是我参与8月更文挑战的第10天,活动详情查看:8月更文挑战”html
上一篇是cas配置shiro,此次说一说单点登出java
cas配置shirogit
依然给出官方文档,apereo.github.io/cas/4.2.x/i…github
<!-- 单点登出 -->
<listener>
<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
</listener>
<filter>
<filter-name>CAS Single Sign Out Filter</filter-name>
<filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CAS Single Sign Out Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
复制代码
这里也许会有人在项目启动时候报错:web
java.lang.IllegalArgumentException: casServerUrlPrefix cannot be null.spring
缘由也很是简单,jar包版本不对 解决方法:markdown
# Specify whether CAS should redirect to the specified service parameter on /logout requests\
# cas.logout.followServiceRedirects=false
cas.logout.followServiceRedirects=true
复制代码
##
# Single Logout Out Callbacks
#
# To turn off all back channel SLO requests set this to true
# slo.callbacks.disabled=false
slo.callbacks.disabled=false
复制代码
#
# To send callbacks to endpoints synchronously, set this to false
# slo.callbacks.asynchronous=true
slo.callbacks.asynchronous=true
复制代码
最后再说一种异常cookie
web.xml 报错cvc-complex-type.2.4.a: Invalid content was found starting with element ‘cookie-config‘...session
http://www.springmodules.org/schema/cache/springmodules-cache.xsd
http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
复制代码
原web.xmlapp
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
复制代码
修改后web.xml: 红色地方是修改地方,注意必定要包含在xmlns:xsi=" "之中.
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
http://www.springmodules.org/schema/cache/springmodules-cache.xsd
http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
复制代码