Integrating with Jahia custom valves
November 14, 2023
Using the Spring Framework and/or Blueprint in Jahia to declare services and handle services lifecycle and wiring is not recommended and is deprecated starting with Jahia 8.2. Consider using OSGi declarative services instead, you can find examples of implementation in Jahia's OSGI Modules Samples repository.
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.