org.springframework.security.web.authentication.logout
Class LogoutFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.security.web.authentication.logout.LogoutFilter
All Implemented Interfaces:
Filter, BeanNameAware, DisposableBean, InitializingBean, ServletContextAware

public class LogoutFilter
extends GenericFilterBean

Logs a principal out.

Polls a series of LogoutHandlers. The handlers should be specified in the order they are required. Generally you will want to call logout handlers TokenBasedRememberMeServices and SecurityContextLogoutHandler (in that order).

After logout, a redirect will be performed to the URL determined by either the configured LogoutSuccessHandler or the logoutSuccessUrl, depending on which constructor was used.

Version:
$Id: LogoutFilter.java 3915 2009-09-30 15:53:46Z ltaylor $
Author:
Ben Alex

Field Summary
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
LogoutFilter(LogoutSuccessHandler logoutSuccessHandler, LogoutHandler... handlers)
          Constructor which takes a LogoutSuccessHandler instance to determine the target destination after logging out.
LogoutFilter(String logoutSuccessUrl, LogoutHandler... handlers)
           
 
Method Summary
 void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
           
protected  String getFilterProcessesUrl()
           
protected  boolean requiresLogout(HttpServletRequest request, HttpServletResponse response)
          Allow subclasses to modify when a logout should take place.
 void setFilterProcessesUrl(String filterProcessesUrl)
           
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogoutFilter

public LogoutFilter(LogoutSuccessHandler logoutSuccessHandler,
                    LogoutHandler... handlers)
Constructor which takes a LogoutSuccessHandler instance to determine the target destination after logging out. The list of LogoutHandlers are intended to perform the actual logout functionality (such as clearing the security context, invalidating the session, etc.).


LogoutFilter

public LogoutFilter(String logoutSuccessUrl,
                    LogoutHandler... handlers)
Method Detail

doFilter

public void doFilter(ServletRequest req,
                     ServletResponse res,
                     FilterChain chain)
              throws IOException,
                     ServletException
Throws:
IOException
ServletException

requiresLogout

protected boolean requiresLogout(HttpServletRequest request,
                                 HttpServletResponse response)
Allow subclasses to modify when a logout should take place.

Parameters:
request - the request
response - the response
Returns:
true if logout should occur, false otherwise

setFilterProcessesUrl

public void setFilterProcessesUrl(String filterProcessesUrl)

getFilterProcessesUrl

protected String getFilterProcessesUrl()


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.