Reformatted LogoutFilter.

This commit is contained in:
Luke Taylor 2007-08-27 16:56:33 +00:00
parent f8689b18b2
commit 82599a72ba
1 changed files with 105 additions and 115 deletions

View File

@ -35,40 +35,33 @@ import org.springframework.util.Assert;
/** /**
* Logs a principal out. * Logs a principal out.
* <p> * <p>
* Polls a series of {@link LogoutHandler}s. The handlers should be specified * Polls a series of {@link LogoutHandler}s. The handlers should be specified in the order they are required.
* in the order they are required. Generally you will want to call logout * Generally you will want to call logout handlers <code>TokenBasedRememberMeServices</code> and
* handlers <code>TokenBasedRememberMeServices</code> and
* <code>SecurityContextLogoutHandler</code> (in that order). * <code>SecurityContextLogoutHandler</code> (in that order).
* </p> * </p>
* <p> * <p>
* After logout, the URL specified by {@link #logoutSuccessUrl} will be shown. * After logout, the URL specified by {@link #logoutSuccessUrl} will be shown.
* </p> * </p>
* <p> * <p>
* <b>Do not use this class directly.</b> Instead configure * <b>Do not use this class directly.</b> Instead configure <code>web.xml</code> to use the
* <code>web.xml</code> to use the {@link * {@link org.acegisecurity.util.FilterToBeanProxy}.
* org.acegisecurity.util.FilterToBeanProxy}.
* </p> * </p>
* *
* @author Ben Alex * @author Ben Alex
* @version $Id$ * @version $Id$
*/ */
public class LogoutFilter implements Filter { public class LogoutFilter implements Filter {
// ~ Static fields/initializers //~ Static fields/initializers =====================================================================================
// =====================================================================================
private static final Log logger = LogFactory.getLog(LogoutFilter.class); private static final Log logger = LogFactory.getLog(LogoutFilter.class);
// ~ Instance fields //~ Instance fields ================================================================================================
// ================================================================================================
private String filterProcessesUrl = "/j_acegi_logout"; private String filterProcessesUrl = "/j_acegi_logout";
private String logoutSuccessUrl; private String logoutSuccessUrl;
private LogoutHandler[] handlers; private LogoutHandler[] handlers;
// ~ Constructors //~ Constructors ===================================================================================================
// ===================================================================================================
public LogoutFilter(String logoutSuccessUrl, LogoutHandler[] handlers) { public LogoutFilter(String logoutSuccessUrl, LogoutHandler[] handlers) {
Assert.hasText(logoutSuccessUrl, "LogoutSuccessUrl required"); Assert.hasText(logoutSuccessUrl, "LogoutSuccessUrl required");
@ -77,8 +70,7 @@ public class LogoutFilter implements Filter {
this.handlers = handlers; this.handlers = handlers;
} }
// ~ Methods //~ Methods ========================================================================================================
// ========================================================================================================
/** /**
* Not used. Use IoC container lifecycle methods instead. * Not used. Use IoC container lifecycle methods instead.
@ -129,13 +121,12 @@ public class LogoutFilter implements Filter {
} }
/** /**
* Allow subclasses to modify when a logout should tak eplace. * Allow subclasses to modify when a logout should take place.
* *
* @param request the request * @param request the request
* @param response the response * @param response the response
* *
* @return <code>true</code> if logout should occur, <code>false</code> * @return <code>true</code> if logout should occur, <code>false</code> otherwise
* otherwise
*/ */
protected boolean requiresLogout(HttpServletRequest request, HttpServletResponse response) { protected boolean requiresLogout(HttpServletRequest request, HttpServletResponse response) {
String uri = request.getRequestURI(); String uri = request.getRequestURI();
@ -175,5 +166,4 @@ public class LogoutFilter implements Filter {
Assert.hasText(filterProcessesUrl, "FilterProcessesUrl required"); Assert.hasText(filterProcessesUrl, "FilterProcessesUrl required");
this.filterProcessesUrl = filterProcessesUrl; this.filterProcessesUrl = filterProcessesUrl;
} }
} }