“This is the 10th day of my participation in the August Gwen Challenge.

Shiro is the configuration of cas

Cas configure shiro

Still give the official document, apereo. Making. IO/cas / 4.2 x/I…

Single sign-off is very simple to configure in client Web.xml

<! - single point logout - > < listener > < listener - class > org). Jasig cas. The client. The 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>Copy the code

You may get an error at project startup:

java.lang.IllegalArgumentException: casServerUrlPrefix cannot be null.

The reason is also very simple,jar package version is not correct solution:

Properties on the CAS server:

 # Specify whether CAS should redirect to the specified service parameter on /logout requests\
# cas.logout.followServiceRedirects=false
cas.logout.followServiceRedirects=true
Copy the code

##
# Single Logout Out Callbacks
#
# To turn off all back channel SLO requests set this to true
# slo.callbacks.disabled=false

 slo.callbacks.disabled=false
Copy the code

 


#
# To send callbacks to endpoints synchronously, set this to false
# slo.callbacks.asynchronous=true
slo.callbacks.asynchronous=true
Copy the code

 


One last exception

A: Invalid content was found starting with element ‘cookie-config’…

Import CAS source web. XML has been wrapped in Red Cross, found as long as add the following two sentences ok

     http://www.springmodules.org/schema/cache/springmodules-cache.xsd
    http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
Copy the code

The original web. XML

<? The 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" >Copy the code

Modified web.xml: The red area is the modified area. Be sure to include it in XMLNS :xsi=” “.

<? The 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" >Copy the code