Updated integration tests to detect case reported as SPR-7563.

This commit is contained in:
Luke Taylor
2010-09-19 18:09:59 +01:00
parent 265cdaf2a6
commit 8d867e8b67
8 changed files with 108 additions and 32 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.security.web.authentication.logout;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.Assert;
@@ -27,12 +29,14 @@ import javax.servlet.http.HttpSession;
/**
* Performs a logout by modifying the {@link org.springframework.security.core.context.SecurityContextHolder}.
* <p>
* Will also invalidate the {@link HttpSession} if {@link #isInvalidateHttpSession()} is <code>true</code> and the
* session is not <code>null</code>.
* Will also invalidate the {@link HttpSession} if {@link #isInvalidateHttpSession()} is {@code true} and the
* session is not {@code null}.
*
* @author Ben Alex
*/
public class SecurityContextLogoutHandler implements LogoutHandler {
protected final Log logger = LogFactory.getLog(this.getClass());
private boolean invalidateHttpSession = true;
//~ Methods ========================================================================================================
@@ -49,6 +53,7 @@ public class SecurityContextLogoutHandler implements LogoutHandler {
if (invalidateHttpSession) {
HttpSession session = request.getSession(false);
if (session != null) {
logger.debug("Invalidating session: " + session.getId());
session.invalidate();
}
}