6、cas 4.2.x 單點登出|8月更文挑戰

這是我參與8月更文挑戰的第10天,活動詳情查看:8月更文挑戰html

上一篇是cas配置shiro,此次說一說單點登出java

cas配置shirogit

依然給出官方文檔,apereo.github.io/cas/4.2.x/i…github

單點登出很是簡單  在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>

複製代碼

這裏也許會有人在項目啓動時候報錯:web

java.lang.IllegalArgumentException: casServerUrlPrefix cannot be null.spring

緣由也很是簡單,jar包版本不對 解決方法:markdown

在 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
複製代碼

 


最後再說一種異常cookie

web.xml 報錯cvc-complex-type.2.4.a: Invalid content was found starting with element ‘cookie-config‘...session

 導入cas源碼 web.xml一直包紅叉, 發現只要加了下面兩句話 就ok了

     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">

複製代碼
相關文章
相關標籤/搜索