Integrating with custom DX valves

  Written by The Jahia Team
   Estimated reading time:

If you have (or are planning to develop) custom DX valves, they will need to send a login event to Apache Unomi once the user is successfully authenticated. Failing to do that the DX user will not be properly associated with the Apache Unomi profile and features such as profiling merging will not work properly. All that is required is that a Spring Event is sent internally inside DX, Marketing Factory already listens to this event to send a corresponding event to Apache Unomi. So make sure you include the following code to your valve to send the Spring Application Event :

final AuthValveContext authContext = (AuthValveContext) context;
SpringContextSingleton.getInstance().publishEvent(new LoginEvent(this, jahiaUser, authContext));

where the jahiaUser is the authenticated DX user and the context is the context object passed to the valve in the invoke method.