[java-identity-provider] 02/04: IDP-2073 Consider enabling the installer to download new versions

Rod Widdowson rdw at steadingsoftware.com
Tue Jun 6 14:12:28 UTC 2023


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=4a6e29c2a57602ae596b739c365f2645d71377e9

commit 4a6e29c2a57602ae596b739c365f2645d71377e9
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jun 5 14:39:35 2023 +0100

    IDP-2073 Consider enabling the installer to download new versions
    
    https://shibboleth.atlassian.net/browse/IDP-2073
    
    More refactoring
    
    PluginSupport becomes InstallableComponentSupport (with a stub left behind taken directly from V4)
    Move around the arguments to the helper function to download properties to make it less plugin
    specific and change its name.
    
    The Idp `update` verb now goes to its own set of URLs.
---
 .../idp/plugin/InstallableComponentInfo.java       |  16 +--
 ...pport.java => InstallableComponentSupport.java} |  25 +---
 .../net/shibboleth/idp/plugin/PluginSupport.java   | 137 ++-------------------
 .../net/shibboleth/idp/plugin/PluginVersion.java   |  13 +-
 .../idp/installer/impl/UpdateIdPCLI.java           |  23 ++--
 .../idp/installer/plugin/impl/PluginInfo.java      |   6 +-
 .../installer/plugin/impl/PluginInstallerCLI.java  |  38 ++++--
 .../shibboleth/idp/installer/TestInstallerCLI.java |   2 +-
 8 files changed, 81 insertions(+), 179 deletions(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentInfo.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentInfo.java
index 5fae44edf..8b975b668 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentInfo.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentInfo.java
@@ -29,7 +29,7 @@ import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
 
-import net.shibboleth.idp.plugin.PluginSupport.SupportLevel;
+import net.shibboleth.idp.plugin.InstallableComponentSupport.SupportLevel;
 import net.shibboleth.shared.collection.Pair;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.primitive.StringSupport;
@@ -120,7 +120,7 @@ public abstract class InstallableComponentInfo {
      * @param props what to load.
      */
     private void  parse(@Nonnull final Properties props) {
-        final String name = componentId + PluginSupport.AVAILABLE_VERSIONS_PROPERTY_SUFFIX;
+        final String name = componentId + InstallableComponentSupport.AVAILABLE_VERSIONS_PROPERTY_SUFFIX;
         final String availableVersions = StringSupport.trim(props.getProperty(name));
         if (availableVersions == null) {
             log.warn("Component {}: Could not find {} property.", componentId, name);
@@ -158,8 +158,8 @@ public abstract class InstallableComponentInfo {
         }
 
         final String supportLevelString = StringSupport.trimOrNull(
-                props.getProperty(componentId + PluginSupport.SUPPORT_LEVEL_INTERFIX + version));
-        PluginSupport.SupportLevel supportLevel;
+                props.getProperty(componentId + InstallableComponentSupport.SUPPORT_LEVEL_INTERFIX + version));
+        InstallableComponentSupport.SupportLevel supportLevel;
         if (supportLevelString == null) {
             log.debug("Component {}, Version {}: Could not find support level for {}.", componentId, version);
             supportLevel = SupportLevel.Unknown;
@@ -178,9 +178,9 @@ public abstract class InstallableComponentInfo {
         info = new InstallableComponentInfo.VersionInfo(maxVersionInfo, minVersionInfo, supportLevel);
         versionInfo.put(theVersion, info);
         String downloadURL =  StringSupport.trimOrNull(
-                getDefaultedValue(props, PluginSupport.DOWNLOAD_URL_INTERFIX, version));
+                getDefaultedValue(props, InstallableComponentSupport.DOWNLOAD_URL_INTERFIX, version));
         final String baseName =  StringSupport.trimOrNull(
-                getDefaultedValue(props, PluginSupport.BASE_NAME_INTERFIX, version));
+                getDefaultedValue(props, InstallableComponentSupport.BASE_NAME_INTERFIX, version));
         if (baseName != null && downloadURL != null) {
             try {
                 if (!downloadURL.endsWith("/")) {
@@ -240,11 +240,11 @@ public abstract class InstallableComponentInfo {
         if (result != null) {
             return result;
         }
-        result = props.getProperty(componentId + interfix + PluginSupport.VERSION_PATTERN);
+        result = props.getProperty(componentId + interfix + InstallableComponentSupport.VERSION_PATTERN);
         if (result == null) {
             return result;
         }
-        return result.replaceAll(PluginSupport.VERSION_PATTERN_REGEX, version);
+        return result.replaceAll(InstallableComponentSupport.VERSION_PATTERN_REGEX, version);
     }
 
     /** Can the specified component be installed into this version?
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentSupport.java
similarity index 91%
copy from idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
copy to idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentSupport.java
index aed999de8..74a5ab2d3 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/InstallableComponentSupport.java
@@ -39,10 +39,10 @@ import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
 
-/** Useful methods for supporting plugins. 
+/** Useful methods for supporting Installable Components.
  *
  */
-public final class PluginSupport {
+public final class InstallableComponentSupport {
     
     /** Property Name suffix for available versions inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String AVAILABLE_VERSIONS_PROPERTY_SUFFIX = ".versions";
@@ -85,10 +85,10 @@ public final class PluginSupport {
     }
 
     /** Class logger. */
-    @Nonnull private static Logger log = LoggerFactory.getLogger(PluginSupport.class);
+    @Nonnull private static Logger log = LoggerFactory.getLogger(InstallableComponentSupport.class);
     
     /** Constructor. */
-    private PluginSupport() {
+    private InstallableComponentSupport() {
     }
 
     /** Get parse IdP Version (with fallback for testing).
@@ -158,23 +158,10 @@ public final class PluginSupport {
      * @param securityParameters the HttpClientSecurityParameters, if any
      * @return the property files for the component.
      */
-    @Nullable public static Properties loadPluginInfo(@Nonnull final List<URL> updateURLs, @Nonnull final HttpClient client,
+    @Nullable public static Properties loadInfo(@Nonnull final List<URL> updateURLs, @Nonnull final HttpClient client,
             @Nullable final HttpClientSecurityParameters securityParameters) {
-        final List<URL> urls;
         final Properties props = new Properties();
-        try {
-            if (updateURLs.isEmpty()) {
-                urls = List.of(
-                        new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"),
-                        new URL("http://plugins.shibboleth.net/plugins.properties"));
-            } else {
-                urls = updateURLs;
-            }
-        } catch (final IOException e) {
-            log.error("Could not load update URLs", e);
-            return null;
-        }
-        for (final URL url: urls) {
+        for (final URL url: updateURLs) {
             final Resource propertyResource;
             try {
                 if ("file".equals(url.getProtocol())) {
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
index aed999de8..7dfa28d16 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
@@ -17,32 +17,16 @@
 
 package net.shibboleth.idp.plugin;
 
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 
-import org.apache.hc.client5.http.classic.HttpClient;
-import org.opensaml.security.httpclient.HttpClientSecurityContextHandler;
-import org.opensaml.security.httpclient.HttpClientSecurityParameters;
 import org.slf4j.Logger;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.core.io.Resource;
+import org.slf4j.LoggerFactory;
 
 import net.shibboleth.idp.Version;
-import net.shibboleth.idp.plugin.InstallableComponentInfo.VersionInfo;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
 
-/** Useful methods for supporting plugins. 
- *
+/** @deprecated.  Methods for supporting plugins.
  */
-public final class PluginSupport {
+ at Deprecated(forRemoval = true, since = "5.0.0") public final class PluginSupport {
     
     /** Property Name suffix for available versions inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String AVAILABLE_VERSIONS_PROPERTY_SUFFIX = ".versions";
@@ -92,119 +76,14 @@ public final class PluginSupport {
     }
 
     /** Get parse IdP Version (with fallback for testing).
-     * @return a {@link InstallableComponentVersion} of the version.
+     * @return a {@link PluginVersion} of the version.
      */
-    public static InstallableComponentVersion getIdPVersion() {
+    public static PluginVersion getIdPVersion() {
         final String idpVersion = Version.getVersion();
         if (idpVersion!=null) {
-            return new InstallableComponentVersion(idpVersion);
-        }
-        log.error("Could not locate IdP Version, assuming 5.0.0");
-        return new InstallableComponentVersion(5,0,0);
-    }
-
-    /** Find the best update version  (plugin or IdP).
-     * @param installIntoVersion The IdP version to check.
-     * @param pluginVersion The Plugin version
-     * @param pluginInfo all about the plugin
-     * @return the best version (or null)
-     */
-    @Nullable static public InstallableComponentVersion getBestVersion(
-            @Nonnull final InstallableComponentVersion installIntoVersion,
-            @Nonnull final InstallableComponentVersion pluginVersion,
-            @Nonnull final InstallableComponentInfo pluginInfo) {
-        final List<InstallableComponentVersion> availableVersions = new ArrayList<>(pluginInfo.getAvailableVersions().keySet());
-        availableVersions.sort(null);
-        log.debug("Considering versions: {}", availableVersions);
-    
-        for (int i = availableVersions.size()-1; i >= 0; i--) {
-            final InstallableComponentVersion version = availableVersions.get(i);
-            if (version.compareTo(pluginVersion) <= 0) {
-                log.debug("Version {} is less than or the same as {}. All done", version, pluginVersion);
-                return null;
-            }
-            final VersionInfo versionInfo = pluginInfo.getAvailableVersions().get(version);
-            if (versionInfo.getSupportLevel() != SupportLevel.Current) {
-                log.debug("Version {} has support level {}, ignoring", version, versionInfo.getSupportLevel());
-                continue;
-            }
-            if (!pluginInfo.isSupportedWithIdPVersion(version, installIntoVersion)) {
-                log.debug("Version {} is not supported with Application Version {}", version, installIntoVersion);
-                continue;
-            }
-            log.debug("Version {} is supported with Application Version {}", version, installIntoVersion);
-            if (pluginInfo.getUpdateURL(version) == null || pluginInfo.getUpdateBaseName(version) == null) {
-                log.debug("Version {} is does not have update information", version);
-                continue;
-            }
-            return version;
-        }
-        return null;
-    }
-
-    /** Find the best update version (plugin or IdP).
-     * @param pluginVersion The Plugin version
-     * @param pluginInfo all about the plugin
-     * @return the best version (or null)
-     */
-    @Nullable static public InstallableComponentVersion getBestVersion(
-            @Nonnull final InstallableComponentVersion pluginVersion, @Nonnull final InstallableComponentInfo pluginInfo) {
-        return getBestVersion(getIdPVersion(), pluginVersion, pluginInfo);
-    }
-
-    /** Load the property file describing all the plugin we know about from a known location.
-     * @param updateURLs where to look
-     * @param client the http client to use
-     * @param securityParameters the HttpClientSecurityParameters, if any
-     * @return the property files for the component.
-     */
-    @Nullable public static Properties loadPluginInfo(@Nonnull final List<URL> updateURLs, @Nonnull final HttpClient client,
-            @Nullable final HttpClientSecurityParameters securityParameters) {
-        final List<URL> urls;
-        final Properties props = new Properties();
-        try {
-            if (updateURLs.isEmpty()) {
-                urls = List.of(
-                        new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"),
-                        new URL("http://plugins.shibboleth.net/plugins.properties"));
-            } else {
-                urls = updateURLs;
-            }
-        } catch (final IOException e) {
-            log.error("Could not load update URLs", e);
-            return null;
-        }
-        for (final URL url: urls) {
-            final Resource propertyResource;
-            try {
-                if ("file".equals(url.getProtocol())) {
-                    final String path =url.getPath();
-                    assert path != null;
-                    propertyResource = new FileSystemResource(path);
-                } else if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
-                    final HTTPResource httpResource;
-                    propertyResource = httpResource = new HTTPResource(client , url);
-                    final HttpClientSecurityContextHandler handler = new HttpClientSecurityContextHandler();
-                    handler.setHttpClientSecurityParameters(securityParameters);
-                    handler.initialize();
-                    httpResource.setHttpClientContextHandler(handler);
-                } else {
-                    log.error("Only file and http[s] URLs are allowed");
-                    continue;
-                }
-                log.debug("Plugin Listing: Looking for update at {}", propertyResource.getDescription());
-                if (!propertyResource.exists()) {
-                    log.info("{} could not be located", propertyResource.getDescription());
-                    continue;
-                }
-                props.load(propertyResource.getInputStream());
-                return props;
-            } catch (final IOException | ComponentInitializationException e) {
-                log.error("Could not open Update URL {} :", url, e);
-                continue;
-            }
+            return new PluginVersion(idpVersion);
         }
-        log.error("Could not locate any active update servers");
-        return null;
+        log.error("Could not locate IdP Version, assuming 4.1.0");
+        return new PluginVersion(4,1,0);
     }
 }
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginVersion.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginVersion.java
index ac0b7142f..5a7618418 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginVersion.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginVersion.java
@@ -34,7 +34,6 @@ import javax.annotation.Nonnull;
         super(plugin);
     }
 
-    
     /**
      * Constructor.
      *
@@ -45,4 +44,16 @@ import javax.annotation.Nonnull;
     public PluginVersion(final String version) throws NumberFormatException {
         super(version);
     }
+
+    /**
+     * Constructor.
+     *
+     * @param maj Major Version
+     * @param min Minor Version
+     * @param pat Patch Version
+     * @throws NumberFormatException if the values are out of range
+     */
+    public PluginVersion(final int maj, final int min, final int pat) {
+        super(maj, min, pat);
+    }
 }
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
index 7666cb096..1c3a5fd97 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
@@ -50,7 +50,7 @@ import net.shibboleth.idp.installer.plugin.impl.TrustStore;
 import net.shibboleth.idp.installer.plugin.impl.TrustStore.Signature;
 import net.shibboleth.idp.plugin.InstallableComponentInfo;
 import net.shibboleth.idp.plugin.InstallableComponentVersion;
-import net.shibboleth.idp.plugin.PluginSupport;
+import net.shibboleth.idp.plugin.InstallableComponentSupport;
 import net.shibboleth.shared.cli.AbstractCommandLine;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
@@ -120,18 +120,23 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
             return RC_INIT;
         }
 
-        final List<URL> urls = new ArrayList<>(args.getUpdateURLs().size());
-        try {
-            for (final String s:args.getUpdateURLs()) {
+        final List<String> urlStrings = args.getUpdateURLs().isEmpty() ?
+                CollectionSupport.listOf(
+                        "https://shibboleth.net/downloads/identity-provider/plugins/idp-versions.properties",
+                        "http://plugins.shibboleth.net/idp-versions.properties") :
+                args.getUpdateURLs();
+        final List<URL> urls = new ArrayList<>(urlStrings.size());
+        for (final String s:urlStrings) {
+            try {
                 urls.add(new URL(s));
+            } catch (MalformedURLException e) {
+                getLogger().error("Could not convert {} to a URL", s);
+                return RC_IO;
             }
-        } catch (MalformedURLException e) {
-            getLogger().error("Internal error", e);
-            return RC_IO;
         }
         final HttpClient client = getHttpClient();
         assert client != null;
-        final Properties properties = PluginSupport.loadPluginInfo(urls, client, getHttpClientSecurityParameters());
+        final Properties properties = InstallableComponentSupport.loadInfo(urls, client, getHttpClientSecurityParameters());
         if (properties == null) {
             return RC_IO;
         }
@@ -155,7 +160,7 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
         
         final InstallableComponentVersion from = args.getUpdateFromVersion();
         final InstallableComponentVersion newIdPVersion =
-                PluginSupport.getBestVersion(from, from, info);
+                InstallableComponentSupport.getBestVersion(from, from, info);
         if (newIdPVersion == null) {
             getLogger().info("No Upgrade available from {}", from);
             return RC_OK;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInfo.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInfo.java
index 7613e0677..2040b0606 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInfo.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInfo.java
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
 
 import net.shibboleth.idp.plugin.InstallableComponentInfo;
 import net.shibboleth.idp.plugin.InstallableComponentVersion;
-import net.shibboleth.idp.plugin.PluginSupport;
+import net.shibboleth.idp.plugin.InstallableComponentSupport;
 import net.shibboleth.shared.primitive.StringSupport;
 
 /**
@@ -46,7 +46,7 @@ public class PluginInfo extends InstallableComponentInfo {
     @Override
     protected @Nullable InstallableComponentVersion getMaxVersion(@Nonnull Properties props, @Nonnull String version) {
         final String maxVersionInfo = StringSupport.trimOrNull(
-                props.getProperty(getComponentId()  + PluginSupport.MAX_IDP_VERSION_INTERFIX + version));
+                props.getProperty(getComponentId()  + InstallableComponentSupport.MAX_IDP_VERSION_INTERFIX + version));
         if (maxVersionInfo == null) {
             return null;
         }
@@ -58,7 +58,7 @@ public class PluginInfo extends InstallableComponentInfo {
     @Nullable
     protected InstallableComponentVersion getMinVersion(@Nonnull Properties props, @Nonnull String version) {
         final String minVersionInfo = StringSupport.trimOrNull(
-                props.getProperty(getComponentId() + PluginSupport.MIN_IDP_VERSION_INTERFIX + version));
+                props.getProperty(getComponentId() + InstallableComponentSupport.MIN_IDP_VERSION_INTERFIX + version));
         if (minVersionInfo == null) {
             return null;
         }
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index 951c71560..1d0019987 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -50,7 +50,7 @@ import net.shibboleth.idp.installer.InstallerSupport;
 import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.idp.plugin.InstallableComponentInfo;
 import net.shibboleth.idp.plugin.InstallableComponentVersion;
-import net.shibboleth.idp.plugin.PluginSupport;
+import net.shibboleth.idp.plugin.InstallableComponentSupport;
 import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.cli.AbstractCommandLine;
 import net.shibboleth.shared.collection.CollectionSupport;
@@ -391,7 +391,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
     private int doListAvailable() {
         final HttpClient client = getHttpClient();
         assert client != null;
-        final Properties props = PluginSupport.loadPluginInfo(updateURLs, client, getHttpClientSecurityParameters());
+        final Properties props = loadAllPluginInfo();
         if (props == null) {
             return RC_IO;
         }
@@ -418,7 +418,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
             assert installer != null;
             final IdPPlugin existingPlugin = installer.getInstalledPlugin(key);
             if (existingPlugin == null) {
-                final InstallableComponentVersion version = PluginSupport.getBestVersion(nullVersion, value);
+                final InstallableComponentVersion version = InstallableComponentSupport.getBestVersion(nullVersion, value);
                 if (version == null) {
                     log.debug("Plugin {} has no version available", entry.getKey());
                 } else {
@@ -426,7 +426,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
                 }
             } else {
                 final InstallableComponentVersion existingVersion = new InstallableComponentVersion(existingPlugin);
-                final InstallableComponentVersion version = PluginSupport.getBestVersion(existingVersion, value);
+                final InstallableComponentVersion version = InstallableComponentSupport.getBestVersion(existingVersion, value);
                 if (version == null) {
                     outOrLog(String.format("Plugin %s: Installed version %s: No update available",
                             entry.getKey(),
@@ -457,9 +457,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
             log.error("Plugin {} is already installed", pluginId);
             return RC_INIT;
         }
-        final HttpClient client = getHttpClient();
-        assert client != null;
-        final Properties props = PluginSupport.loadPluginInfo(updateURLs, client, getHttpClientSecurityParameters());
+        final Properties props = loadAllPluginInfo();
         if (props == null) {
             log.error("AutoInstall not possible");
             return RC_INIT;
@@ -469,7 +467,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
             log.error("Plugin {}: Information not found", pluginId);
             return RC_INIT;
         }
-        final InstallableComponentVersion versionToInstall = PluginSupport.getBestVersion(new InstallableComponentVersion(0,0,0), info);
+        final InstallableComponentVersion versionToInstall = InstallableComponentSupport.getBestVersion(new InstallableComponentVersion(0,0,0), info);
         if (versionToInstall == null) {
             log.error("Plugin {}: No version available to install", pluginId);
             return RC_INIT;
@@ -482,6 +480,28 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
         return RC_OK;
     }
 
+    /* Download all plugin info from the provide or "known" location.
+     * @return the properties.
+     */
+    private Properties loadAllPluginInfo() {
+        final HttpClient client = getHttpClient();
+        assert client != null;
+        if (updateURLs.isEmpty()) {
+            try {
+                return  InstallableComponentSupport.loadInfo(
+                        CollectionSupport.listOf(
+                                new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"),
+                                new URL("http://plugins.shibboleth.net/plugins.properties")),
+                        client,
+                        getHttpClientSecurityParameters());
+            } catch (MalformedURLException e) {
+                getLogger().error("Could not contruct URL list");
+                return new Properties();
+            }
+        }
+        return  InstallableComponentSupport.loadInfo(updateURLs, client, getHttpClientSecurityParameters());
+    }
+
     /** Update the plugin.
      * @param pluginId the pluginId or null.
      * @param pluginVersion (optionally) the version to update to.
@@ -513,7 +533,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
         }
         final InstallableComponentVersion installVersion;
         if (pluginVersion == null) {
-            installVersion = PluginSupport.getBestVersion(new InstallableComponentVersion(plugin), state.getPluginInfo());
+            installVersion = InstallableComponentSupport.getBestVersion(new InstallableComponentVersion(plugin), state.getPluginInfo());
             if (installVersion == null) {
                 log.info("No suitable update version available");
                 return;
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestInstallerCLI.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestInstallerCLI.java
index fd94fe5f8..7b8449d33 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestInstallerCLI.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestInstallerCLI.java
@@ -42,7 +42,7 @@ public class TestInstallerCLI {
                });
     }
 
-    @Test(enabled = false)
+    @Test(enabled = true)
     public void silentInstall() {
 
         IdPInstallerCLI.runMain(new String[] {

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


More information about the commits mailing list