Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-72592

SAML KeyStoreManager OSGi @Reference must be greedy to reference always the latest version to avoid read/write to random stores



      SAML certificates are read and written to different locations (DL vs FileSystem).

      Currently there are two implementations,

       configurationPid = "com.liferay.saml.runtime.configuration.SamlConfiguration",
       immediate = true, service = KeyStoreManager.class
      public class FileSystemKeyStoreManagerImpl extends BaseKeyStoreManagerImpl \{
       configurationPid = "com.liferay.saml.runtime.configuration.SamlConfiguration",
       immediate = true, property = {"service.ranking:Integer=-1"},
       service = KeyStoreManager.class
      public class DLKeyStoreManagerImpl extends BaseKeyStoreManagerImpl \{

      But having

      	private KeyStoreManager _keyStoreManager;

      is policyOption = ReferencePolicyOption.RELUCTANT by default, which means it will hold reference to the highest service ranking at that time but won't change if another service is registered after the field is initialized, regardless of the new service's service.ranking

      Cannot be easily tested due to random nature of components initialization order.