Class SecurityUserCheckBeforeControllerHandler

  • All Implemented Interfaces:
    BeforeControllerHandler

    public class SecurityUserCheckBeforeControllerHandler
    extends java.lang.Object
    implements BeforeControllerHandler
    Spring MVC interceptor that validates that the spring security user and the hybris session user are in sync. If the spring security user and the hybris session user are not in sync then the session is invalidated and the visitor is redirect to the homepage.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean beforeController​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handler)
      Called before the DispatcherServlet calls the controller.
      protected void invalidateSessionAndRedirect​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String redirectPath)  
      protected boolean isPreviewDataModelValid​(javax.servlet.http.HttpServletRequest httpRequest)
      Checks whether there is a preview data setup for the current request
      protected boolean isUserDeactivated​(UserModel userModel)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SecurityUserCheckBeforeControllerHandler

        public SecurityUserCheckBeforeControllerHandler()
    • Method Detail

      • beforeController

        public boolean beforeController​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        org.springframework.web.method.HandlerMethod handler)
                                 throws java.io.IOException
        Description copied from interface: BeforeControllerHandler
        Called before the DispatcherServlet calls the controller.
        Specified by:
        beforeController in interface BeforeControllerHandler
        Parameters:
        request - current HTTP request
        response - current HTTP response
        Returns:
        true if the execution chain should proceed with the next interceptor or the handler itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself.
        Throws:
        java.io.IOException
      • invalidateSessionAndRedirect

        protected void invalidateSessionAndRedirect​(javax.servlet.http.HttpServletRequest request,
                                                    javax.servlet.http.HttpServletResponse response,
                                                    java.lang.String redirectPath)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • isUserDeactivated

        protected boolean isUserDeactivated​(UserModel userModel)
      • isPreviewDataModelValid

        protected boolean isPreviewDataModelValid​(javax.servlet.http.HttpServletRequest httpRequest)
        Checks whether there is a preview data setup for the current request
        Parameters:
        httpRequest - current request
        Returns:
        true whether is valid otherwise false