[java-identity-provider] branch main updated: IDP-2133 seckeygen.sh not updated on upgrade to v5

Rod Widdowson rdw at steadingsoftware.com
Tue Jun 27 10:26:38 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=545473d4b3f7ff72253ec43506ea323fb75fd99e

The following commit(s) were added to refs/heads/main by this push:
     new 545473d4b IDP-2133 seckeygen.sh not updated on upgrade to v5
545473d4b is described below

commit 545473d4b3f7ff72253ec43506ea323fb75fd99e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jun 27 11:21:56 2023 +0100

    IDP-2133 seckeygen.sh not updated on upgrade to v5
    
    https://shibboleth.atlassian.net/browse/IDP-2133
    
    Make sure that the idp.EditWebApp and idp.CommandLine modules
    are always installed on every installtion and update.
---
 .../idp/installer/impl/CurrentInstallState.java    | 26 +++++++++++-----------
 .../idp/installer/impl/InstallerProperties.java    |  5 ++---
 .../shibboleth/idp/installer/impl/V5Install.java   |  6 +----
 .../idp/installer/plugin/impl/PluginInstaller.java |  2 ++
 4 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
index 0d55cc6bf..734cac5ed 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
@@ -129,8 +129,9 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
 
     /**
      * Populate {{@link #enabledModules} from the current classpath and the new IdP home.
+     * @throws IOException if we cannot convert a path to a URL
      */
-    private void findEnabledModules() {
+    private void findEnabledModules() throws IOException {
         if (getInstalledVersion() == null) {
             return;
         }
@@ -139,18 +140,13 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
         final ModuleContext moduleContext = new ModuleContext(td);
         enabledModules = new HashSet<>();
         final Iterator<IdPModule> modules = ServiceLoader.load(IdPModule.class).iterator();
-
         while (modules.hasNext()) {
-            try {
-                final IdPModule module = modules.next();
-                if (module.isEnabled(moduleContext)) {
-                    log.debug("Detected enabled Module {}", module.getId());
-                    enabledModules.add(module.getId());
-                } else {
-                    log.debug("Detected disabled Module {}", module.getId());
-                }
-            } catch (final ServiceConfigurationError e) {
-                log.error("Error loading modules", e);
+            final IdPModule module = modules.next();
+            if (module.isEnabled(moduleContext)) {
+                log.debug("Detected enabled Module {}", module.getId());
+                enabledModules.add(module.getId());
+            } else {
+                log.debug("Detected disabled Module {}", module.getId());
             }
         }
     }
@@ -167,7 +163,11 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
             throw new ComponentInitializationException("'systems folder exists");
         }
         findPreviousVersion();
-        findEnabledModules();
+        try {
+            findEnabledModules();
+        } catch (IOException | ServiceConfigurationError e) {
+            log.error("Error loading modules", e);
+        }
 
         if (null == getInstalledVersion()) {
             // New install.  We need all files
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
index 53f1e3532..648aa5bc3 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
@@ -167,11 +167,10 @@ public class InstallerProperties  {
     @Nonnull private final InputHandler inputHandler;
 
     /** Those modules which are "core". */
-    @Nonnull public static final Set<String> CORE_MODULES = CollectionSupport.setOf("idp.Core");
+    @Nonnull public static final Set<String> CORE_MODULES = CollectionSupport.setOf("idp.Core", "idp.EditWebApp", "idp.CommandLine");
 
     /** Those modules enabled by default. */
-    @Nonnull public static final Set<String> DEFAULT_MODULES = CollectionSupport.setOf("idp.EditWebApp",
-            "idp.CommandLine" ,"idp.authn.Password", "idp.admin.Hello");
+    @Nonnull public static final Set<String> DEFAULT_MODULES = CollectionSupport.setOf("idp.authn.Password", "idp.admin.Hello");
 
     /**
      * Constructor.
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
index 3817962db..ee7dd27f8 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
@@ -368,10 +368,6 @@ public class V5Install {
      * @throws BuildException if badness occurs
      */
     protected void enableCoreModules() throws BuildException {
-        if (currentState.getInstalledVersion() != null) {
-            // Not an initial install
-            return;
-        }
         final String targetDir = installerProps.getTargetDir().toString();
         assert targetDir!=null;
         final ModuleContext moduleContext = new ModuleContext(targetDir);
@@ -383,7 +379,7 @@ public class V5Install {
             try {
                 final IdPModule module = modules.next();
                 final String id = module.getId();
-                if (currentState.getInstalledVersion() == null && installerProps.getCoreModules().contains(id)) {
+                if (installerProps.getCoreModules().contains(id) && !currentState.getEnabledModules().contains(id)) {
                     try {
                         module.enable(moduleContext);
                     } catch (final ModuleException e) {
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index 9801522f3..3d72d65c0 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -754,6 +754,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
             unpackDirectory = Files.createTempDirectory("plugin-installer-unpack");
             
             final Path fullName = base.resolve(fileName);
+            assert fullName!=null;
             try (final ArchiveInputStream inStream = getStreamFor(fullName, isZip(fileName))) {
                 
                 ArchiveEntry entry = null;
@@ -956,6 +957,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
                     Files.createDirectories(workspacePath);
                 }
                 final Path pathToDir = Files.createTempDirectory(workspacePath, "classpath");
+                assert libs!=null && pathToDir!=null;
                 final LoggingVisitor visitor = new LoggingVisitor(libs, pathToDir);
                 try (final DirectoryStream<Path> webInfLibs = Files.newDirectoryStream(libs)) {
                     for (final Path jar : webInfLibs) {

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


More information about the commits mailing list