org.springframework.security.web.authentication.logout
Class LogoutFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.authentication.logout.LogoutFilter
- All Implemented Interfaces:
- javax.servlet.Filter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.context.ServletContextAware
public class LogoutFilter
- extends org.springframework.web.filter.GenericFilterBean
Logs a principal out.
Polls a series of LogoutHandler
s. 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.
Fields inherited from class org.springframework.web.filter.GenericFilterBean |
logger |
Method Summary |
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
|
protected java.lang.String |
getFilterProcessesUrl()
|
protected boolean |
requiresLogout(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Allow subclasses to modify when a logout should take place. |
void |
setFilterProcessesUrl(java.lang.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 |
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(java.lang.String logoutSuccessUrl,
LogoutHandler... handlers)
doFilter
public void doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
- Throws:
java.io.IOException
javax.servlet.ServletException
requiresLogout
protected boolean requiresLogout(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
- Allow subclasses to modify when a logout should take place.
- Parameters:
request
- the requestresponse
- the response
- Returns:
true
if logout should occur, false
otherwise
setFilterProcessesUrl
public void setFilterProcessesUrl(java.lang.String filterProcessesUrl)
getFilterProcessesUrl
protected java.lang.String getFilterProcessesUrl()