diff --git a/docs/manual/src/docbook/cas-auth-provider.xml b/docs/manual/src/docbook/cas-auth-provider.xml index 63f5b728b1..04f01e7be8 100644 --- a/docs/manual/src/docbook/cas-auth-provider.xml +++ b/docs/manual/src/docbook/cas-auth-provider.xml @@ -307,6 +307,83 @@ need to be concerned about the fact CAS handled authentication. In the following sections we will discuss some (optional) more advanced configurations. +
+ + Single Logout + + The CAS protocol supports Single Logout and can be easily added to your Spring + Security configuration. Below are updates to the Spring Security configuration + that handle Single Logout + ... + + + + + + + + + + + + + + + + ]]> The logout element logs the user out of the local application, but + does not terminate the session with the CAS server or any other applications that have been logged + into. The requestSingleLogoutFilter filter will allow the url of + /spring_security_cas_logout to be requested to redirect the application to the + configured CAS Server logout url. Then the CAS Server will send a Single Logout request to all the + services that were signed into. The singleLogoutFilter handles the Single Logout + request by looking up the HttpSession in a static Map + and then invalidating it. + It might be confusing why both the logout element and the + singleLogoutFilter are needed. It is considered best practice to logout locally + first since the SingleSignOutFilter just stores the + HttpSession in a static Map in order to + call invalidate on it. With the configuration above, the flow of logout would be: + + The user requests /j_spring_security_logout which would log the user + out of the local application and send the user to the logout success page. + The logout success page, /cas-logout.jsp, should instruct the user + to click a link pointing to /j_spring_cas_security_logout in order to logout + out of all applications. + When the user clicks the link, the user is redirected to the CAS single logout URL + (https://localhost:9443/cas/logout). + On the CAS Server side, the CAS single logout URL then submits single logout requests to + all the CAS Services. On the CAS Service side, JASIG's + SingleSignOutFilter processes the logout request by invaliditing the + original session. + + + The next step is to add the following to your web.xml + + characterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + characterEncodingFilter + /* + + + org.jasig.cas.client.session.SingleSignOutHttpSessionListener + ]]> + When using the SingleSignOutFilter you might encounter some encoding issues. Therefore it is + recommended to add the CharacterEncodingFilter to ensure that the character + encoding is correct when using the SingleSignOutFilter. Again, refer to JASIG's + documentation for details. The SingleSignOutHttpSessionListener ensures that + when an HttpSession expires, the mapping used for single logout is + removed. +
Proxy Ticket Authentication diff --git a/samples/cas/src/integration-test/groovy/org/springframework/security/samples/cas/CasSampleSpec.groovy b/samples/cas/src/integration-test/groovy/org/springframework/security/samples/cas/CasSampleSpec.groovy index 8c426b330b..78ddc7621f 100644 --- a/samples/cas/src/integration-test/groovy/org/springframework/security/samples/cas/CasSampleSpec.groovy +++ b/samples/cas/src/integration-test/groovy/org/springframework/security/samples/cas/CasSampleSpec.groovy @@ -21,6 +21,7 @@ import org.junit.runner.RunWith; import org.spockframework.runtime.Sputnik; import org.springframework.security.samples.cas.pages.* +import spock.lang.Shared; import spock.lang.Stepwise; /** @@ -30,6 +31,7 @@ import spock.lang.Stepwise; */ @Stepwise class CasSampleSpec extends BaseSpec { + @Shared String casServerLogoutUrl = LoginPage.url.replaceFirst('/login','/logout') def 'access home page with unauthenticated user succeeds'() { when: 'Unauthenticated user accesses the Home Page' @@ -108,4 +110,17 @@ class CasSampleSpec extends BaseSpec { then: 'login page is displayed' at LoginPage } + + def 'loging out of the cas server successfully logs out of the cas servers'() { + setup: 'login with ROLE_USER' + to SecurePage + at LoginPage + login 'rod' + at SecurePage + when: 'logout of the CAS Server' + go casServerLogoutUrl + to SecurePage + then: 'user is logged out of the CAS Service' + at LoginPage + } } \ No newline at end of file