“这是我参与8月更文挑战的第10天,活动详情查看:8月更文挑战”
上一篇是cas配置shiro,这次说一说单点登出
依然给出官方文档,apereo.github.io/cas/4.2.x/i…
单点登出非常简单 在client web.xml中配置
<!-- 单点登出 -->
<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>
复制代码
这里也许会有人在项目启动时候报错:
java.lang.IllegalArgumentException: casServerUrlPrefix cannot be null.
原因也非常简单,jar包版本不对 解决方法:
在 cas server 中的 cas.properties中进行配置:
# 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
复制代码
最后再说一种异常
web.xml 报错cvc-complex-type.2.4.a: Invalid content was found starting with element ‘cookie-config‘…
导入cas源码 web.xml一直包红叉, 发现只要加了下面两句话 就ok了
http://www.springmodules.org/schema/cache/springmodules-cache.xsd
http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
复制代码
原web.xml
<?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">
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END