cookiessession-cookiessap-commerce-cloudhybris-data-hub

Hybris remove specific cookie when logout


I've created a custom cookie via Javascript and every time I logout, I want to remove this cookie from the browser. How/Where is the best place to perform this operation in the Hybris/Sap Commerce ecosystem?


Solution

  • You can use Spring MVC Interceptors like this.

    <alias name="defaultBeforeControllerHandlersList" alias="beforeControllerHandlersList"/>
    <util:list id="defaultBeforeControllerHandlersList">
        <!-- List of handlers to run -->
        <bean class="xyz.CheckUrlsBeforeControllerHandler">
            <property name="checkedUrls" ref="checkUrlsList"/>
        </bean>
       
      
    </util:list>
    

    Then Inside CustomHandler use guidCookieStrategy.deleteCookie(request, response); to delete cookies.