You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2023/06/04 08:26:05 UTC

[sling-org-apache-sling-jcr-base] branch issues/SLING-11741 updated: Make sure configurations are updated before using service starts

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch issues/SLING-11741
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-base.git


The following commit(s) were added to refs/heads/issues/SLING-11741 by this push:
     new 91a1555  Make sure configurations are updated before using service starts
91a1555 is described below

commit 91a1555cf600d31d0d1873a46a3ef1c904003c35
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jun 4 10:26:01 2023 +0200

    Make sure configurations are updated before using service starts
---
 .../sling/jcr/base/internal/ConfigurationUpdater.java       |  2 +-
 .../apache/sling/jcr/base/internal/LoginAdminAllowList.java | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java b/src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java
index 9a0ba70..eceeff4 100644
--- a/src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java
+++ b/src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java
@@ -39,7 +39,7 @@ import org.osgi.service.component.annotations.Reference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component(service = ConfigurationListener.class)
+@Component(service = {ConfigurationListener.class, ConfigurationUpdater.class})
 public class ConfigurationUpdater implements ConfigurationListener {
 
     static final String LOGIN_ADMIN_WHITELIST_PID = "org.apache.sling.jcr.base.internal.LoginAdminWhitelist";
diff --git a/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminAllowList.java b/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminAllowList.java
index 8ae079e..f3aaa7b 100644
--- a/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminAllowList.java
+++ b/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminAllowList.java
@@ -46,7 +46,18 @@ import static org.apache.sling.commons.osgi.PropertiesUtil.toStringArray;
  * The default configuration lets a few trusted Sling bundles
  * use the loginAdministrative method.
  */
-@Component(service = LoginAdminAllowList.class, configurationPid = LoginAdminAllowList.PID)
+@Component(service = LoginAdminAllowList.class, 
+    configurationPid = LoginAdminAllowList.PID,
+    reference = {
+        // ConfigurationUpdater is a required dependency to make sure that configurations are
+        // updated before this component is activated
+        @Reference(
+            name = "ConfigurationUpdater",
+            service = ConfigurationUpdater.class,
+            cardinality = ReferenceCardinality.MANDATORY
+        )
+    }
+)
 @Designate(
         ocd = LoginAdminAllowListConfiguration.class
 )