Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.ui.rememberme
Class RememberMeProcessingFilter  view RememberMeProcessingFilter download RememberMeProcessingFilter.java

java.lang.Object
  extended byorg.acegisecurity.ui.rememberme.RememberMeProcessingFilter
All Implemented Interfaces:
org.springframework.context.ApplicationEventPublisherAware, javax.servlet.Filter, org.springframework.beans.factory.InitializingBean

public class RememberMeProcessingFilter
extends java.lang.Object
implements javax.servlet.Filter, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware

Detects if there is no Authentication object in the SecurityContext, and populates it with a remember-me authentication token if a RememberMeServices implementation so requests.

Concrete RememberMeServices implementations will have their RememberMeServices.autoLogin(HttpServletRequest, HttpServletResponse) 55 method called by this filter. The Authentication or null returned by that method will be placed into the SecurityContext.

If authentication is successful, an org.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent will be published to the application context. No events will be published if authentication was unsuccessful, because this would generally be recorded via an AuthenticationManager-specific application event.

Do not use this class directly. Instead configure web.xml to use the org.acegisecurity.util.FilterToBeanProxy.

Version:
$Id: RememberMeProcessingFilter.java,v 1.10 2005/11/17 00:56:09 benalex Exp $

Field Summary
private  org.springframework.context.ApplicationEventPublisher eventPublisher
           
private static org.apache.commons.logging.Log logger
           
private  RememberMeServices rememberMeServices
           
 
Constructor Summary
RememberMeProcessingFilter()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 void destroy()
          Does nothing - we rely on IoC lifecycle services instead.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.
 RememberMeServices getRememberMeServices()
           
 void init(javax.servlet.FilterConfig ignored)
          Does nothing - we rely on IoC lifecycle services instead.
 void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
          Set the ApplicationEventPublisher that this object runs in.
 void setRememberMeServices(RememberMeServices rememberMeServices)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger

eventPublisher

private org.springframework.context.ApplicationEventPublisher eventPublisher

rememberMeServices

private RememberMeServices rememberMeServices
Constructor Detail

RememberMeProcessingFilter

public RememberMeProcessingFilter()
Method Detail

setApplicationEventPublisher

public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
Description copied from interface: org.springframework.context.ApplicationEventPublisherAware
Set the ApplicationEventPublisher that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.

Specified by:
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware

setRememberMeServices

public void setRememberMeServices(RememberMeServices rememberMeServices)

getRememberMeServices

public RememberMeServices getRememberMeServices()

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from interface: org.springframework.beans.factory.InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

destroy

public void destroy()
Does nothing - we rely on IoC lifecycle services instead.

Specified by:
destroy in interface javax.servlet.Filter

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Description copied from interface: javax.servlet.Filter
The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed in to this method allows the Filter to pass on the request and response to the next entity in the chain.

A typical implementation of this method would follow the following pattern:-
1. Examine the request
2. Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
3. Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
4. a) Either invoke the next entity in the chain using the FilterChain object (chain.doFilter()),
4. b) or not pass on the request/response pair to the next entity in the filter chain to block the request processing
5. Directly set headers on the response after invocation of the next entity in the filter chain.

Specified by:
doFilter in interface javax.servlet.Filter

init

public void init(javax.servlet.FilterConfig ignored)
          throws javax.servlet.ServletException
Does nothing - we rely on IoC lifecycle services instead.

Specified by:
init in interface javax.servlet.Filter