Class CustomerStateFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
org.broadleafcommerce.common.web.filter.AbstractIgnorableOncePerRequestFilter
org.broadleafcommerce.profile.web.site.security.CustomerStateFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.core.env.EnvironmentCapable, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware

@Component("blCustomerStateFilter") public class CustomerStateFilter extends org.broadleafcommerce.common.web.filter.AbstractIgnorableOncePerRequestFilter

This filter should be configured after the RememberMe listener from Spring Security. Retrieves the Broadleaf Customer based using the authenticated user OR creates an Anonymous customer and stores them in the session. Calls Customer.setCookied(true) if the authentication token is an instance of {@link org.springframework.security.providers.rememberme.RememberMeAuthenticationToken). Calls Customer.setLoggedIn(true) if the authentication token is an instance of {@link org.springframework.security.providers.UsernamePasswordAuthenticationToken}

Author:
bpolster
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class org.springframework.web.filter.OncePerRequestFilter

    ALREADY_FILTERED_SUFFIX

    Fields inherited from class org.springframework.web.filter.GenericFilterBean

    logger

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    doFilterInternalUnlessIgnored(jakarta.servlet.http.HttpServletRequest baseRequest, jakarta.servlet.http.HttpServletResponse baseResponse, jakarta.servlet.FilterChain chain)
     
    int
     
    protected boolean
    isIgnored(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse)
     
    protected boolean
     

    Methods inherited from class org.broadleafcommerce.common.web.filter.AbstractIgnorableOncePerRequestFilter

    doFilterInternal

    Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

    doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch

    Methods inherited from class org.springframework.web.filter.GenericFilterBean

    addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • customerStateProcessor

      @Autowired @Qualifier("blCustomerStateRequestProcessor") protected CustomerStateRequestProcessor customerStateProcessor
  • Constructor Details

    • CustomerStateFilter

      public CustomerStateFilter()
  • Method Details

    • doFilterInternalUnlessIgnored

      public void doFilterInternalUnlessIgnored(jakarta.servlet.http.HttpServletRequest baseRequest, jakarta.servlet.http.HttpServletResponse baseResponse, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      Specified by:
      doFilterInternalUnlessIgnored in class org.broadleafcommerce.common.web.filter.AbstractIgnorableOncePerRequestFilter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • isIgnored

      protected boolean isIgnored(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse)
      Overrides:
      isIgnored in class org.broadleafcommerce.common.web.filter.AbstractIgnorableOncePerRequestFilter
    • getOrder

      public int getOrder()
    • shouldNotFilterErrorDispatch

      protected boolean shouldNotFilterErrorDispatch()
      Overrides:
      shouldNotFilterErrorDispatch in class org.springframework.web.filter.OncePerRequestFilter