[java-identity-provider] 02/02: IDP-2388 Add timeout to the "update check" in the IdP (and plugins)

Rod Widdowson rdw at steadingsoftware.com
Sat Jul 12 15:02:29 UTC 2025


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=5c5c6e0880d3ae0a71dbcf15760bb57a8e516661

commit 5c5c6e0880d3ae0a71dbcf15760bb57a8e516661
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jul 12 16:01:29 2025 +0100

    IDP-2388 Add timeout to the "update check" in the IdP (and plugins)
    
    https://shibboleth.atlassian.net/browse/IDP-2388
    
    Make idp.updateCheck.enable turn off looking up update state
---
 .../admin/impl/InstallableComponentGaugeSet.java   | 48 ++++++++++++++--------
 .../net/shibboleth/idp/conf/metrics-system.xml     |  1 +
 .../net/shibboleth/idp/module/conf/idp.properties  |  3 +-
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentGaugeSet.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentGaugeSet.java
index b0dc00662..0ff21855c 100644
--- a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentGaugeSet.java
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentGaugeSet.java
@@ -83,26 +83,11 @@ public class InstallableComponentGaugeSet extends AbstractIdentifiableInitializa
     /** IdP Version to check. */
     @NonnullAfterInit private InstallableComponentVersion idpVersion;
     
+    /** Is update check enabled.*/
+    private boolean updateCheckEnabled;
+    
     /** Constructor. */
     public InstallableComponentGaugeSet() {
-        gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "plugins", "list"),
-                new Gauge<Map<String, InstallableComponentVersion>>() {
-                    public Map<String, InstallableComponentVersion> getValue() {
-                        return getPluginList();
-                    }
-                });
-        gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "plugins", "details"),
-                new Gauge<Map<String, InstallableComponentDetails>>() {
-                    public Map<String, InstallableComponentDetails> getValue() {
-                        return getPluginDetails();
-                    }
-                });
-        gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "idp", "details"),
-                new Gauge<InstallableComponentDetails>() {
-                    public InstallableComponentDetails getValue() {
-                        return getIdPDetails();
-                    }
-                });
 
     }
     
@@ -127,6 +112,13 @@ public class InstallableComponentGaugeSet extends AbstractIdentifiableInitializa
         httpClient = Constraint.isNotNull(client, "HttpClient cannot be null");
     }
     
+    /** Set whether to check for IdP and Plugin updates.
+     * @param what whether to check or not
+     */
+    public void setUpdateCheckEnabled(boolean what) {
+        updateCheckEnabled = what;
+    }
+    
     /** 
      * Null safe IdP Version.
      * 
@@ -261,6 +253,26 @@ public class InstallableComponentGaugeSet extends AbstractIdentifiableInitializa
         } else {
             idpVersion = new InstallableComponentVersion(idpVersionStr); 
         }
+        gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "plugins", "list"),
+                new Gauge<Map<String, InstallableComponentVersion>>() {
+                    public Map<String, InstallableComponentVersion> getValue() {
+                        return getPluginList();
+                    }
+                });
+        if (updateCheckEnabled) {
+            gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "plugins", "details"),
+                    new Gauge<Map<String, InstallableComponentDetails>>() {
+                        public Map<String, InstallableComponentDetails> getValue() {
+                            return getPluginDetails();
+                        }
+                    });
+            gauges.put(MetricRegistry.name(DEFAULT_METRIC_NAME, "idp", "details"),
+                    new Gauge<InstallableComponentDetails>() {
+                        public InstallableComponentDetails getValue() {
+                            return getIdPDetails();
+                        }
+                    });
+        }
     }
 
     /** {@inheritDoc} */
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/metrics-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/metrics-system.xml
index 23f4b24b9..42307778e 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/metrics-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/metrics-system.xml
@@ -82,6 +82,7 @@
 
     <bean id="shibboleth.metrics.InstallableComponents"
         class="net.shibboleth.idp.admin.impl.InstallableComponentGaugeSet" lazy-init="true"
+       p:updateCheckEnabled="%{idp.updateCheck.enable:true}"
        p:idpUpdateUrls-ref="%{idp.updateCheck.urls:shibboleth.IdPUpdateCheckUrls}"
        p:httpClient-ref="%{idp.updateCheck.httpClient:shibboleth.CallHomeHttpClient}"
        p:securityParams="#{ environment.containsProperty('idp.updateCheck.httpSecurityParameters') ? getObject('idp.updateCheck.httpSecurityParameters') :null}"/>
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/idp.properties b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/idp.properties
index 5cd59b91e..e09177936 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/idp.properties
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/idp.properties
@@ -1,5 +1,6 @@
 # Set false if you do not want the IdP to check (asynchronously) whether
-# it can be updated or not when the container starts
+# it can be updated or not when the container starts and when
+# evaulating the net.shibboleth.idp.installation metrics
 #idp.updateCheck.enable=true
 
 # Auto-load all files matching conf/**/*.properties

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list