Integrating with Jahia custom valves
December 14, 2022
If you have (or are planning to develop) custom Jahia valves, they will need to send a login event to jCustomer once the user is successfully authenticated. Failing to do that the Jahia user will not be properly associated with the jCustomer profile and features such as profiling merging will not work properly. All that is required is that a Spring Event is sent internally inside Jahia, jExperience already listens to this event to send a corresponding event to jCustomer. 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 Jahia user and the context is the context object passed to the valve in the invoke method.