[java-identity-provider] branch main updated: IDP-1664 - Support Module service API

Scott Cantor cantor.2 at osu.edu
Thu Sep 3 21:07:18 UTC 2020


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

scantor 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=37239507ef05586795c186ba663ddcb03b98b5ef

The following commit(s) were added to refs/heads/main by this push:
       new  37239507e IDP-1664 - Support Module service API
37239507e is described below

commit 37239507ef05586795c186ba663ddcb03b98b5ef
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Sep 3 17:07:09 2020 -0400

    IDP-1664 - Support Module service API
    
    https://issues.shibboleth.net/jira/browse/IDP-1664
    
    Redo idp.home handling for CLI tools.
    Initial CLI for modules.
---
 .../idp/module/impl/ModuleManagerArguments.java    | 184 ++++++++++++++++++++
 .../idp/module/impl/ModuleManagerCLI.java          | 189 +++++++++++++++++++++
 .../shibboleth/idp/module/impl/package-info.java   |  22 +++
 .../idp/cli/AbstractIdPHomeAwareCommandLine.java   |  68 ++------
 .../AbstractIdPHomeAwareCommandLineArguments.java  |  56 ++++++
 idp-distribution/src/main/resources/bin/module.bat |   4 +
 idp-distribution/src/main/resources/bin/module.sh  |   7 +
 idp-installer/.settings/org.eclipse.jdt.core.prefs |   2 +-
 .../installer/plugin/PluginInstallerArguments.java |   4 +-
 .../idp/installer/plugin/PluginInstallerCLI.java   |   5 +-
 .../idp/installer/plugin/PluginCLITest.java        |   2 +-
 11 files changed, 481 insertions(+), 62 deletions(-)

diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerArguments.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerArguments.java
new file mode 100644
index 000000000..d18b4e0b2
--- /dev/null
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerArguments.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.module.impl;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.apache.http.client.HttpClient;
+import org.opensaml.security.httpclient.HttpClientSecurityParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.beust.jcommander.Parameter;
+
+import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLineArguments;
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+
+/**
+ * Arguments for {@link IdPModule} management CLI.
+ */
+public class ModuleManagerArguments extends AbstractIdPHomeAwareCommandLineArguments {
+
+    /** Logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(ModuleManagerArguments.class);
+
+    /** Brief info about installed modules. */
+    @Parameter(names= {"-l", "--list"})
+    @Nullable private boolean list;
+
+    /** Detailed info about installed modules. */
+    @Parameter(names= {"-al", "--full-list"})
+    @Nullable private boolean fullList;
+
+    /** ID of module to enable. */
+    @Parameter(names= {"-e", "--enable"})
+    @Nullable @NonnullElements private List<String> enableModuleIds = new ArrayList<>();
+
+    /** ID of module to enable. */
+    @Parameter(names= {"-d", "--disable"})
+    @Nullable @NonnullElements private List<String> disableModuleIds = new ArrayList<>();
+
+    /** Clean when disabling. */
+    @Parameter(names= {"-f", "--clean"})
+    @Nullable private boolean clean;
+
+    /** Name for the {@link HttpClient} . */
+    @Parameter(names= {"-h", "--http-client"})
+    @Nullable @NotEmpty private String httpClientName;
+
+    /** Name for the {@link HttpClientSecurityParameters} . */
+    @Parameter(names= {"-s", "--http-security"})
+    @Nullable @NotEmpty private String httpClientSecurityParametersName;
+
+    /**
+     * Are we doing a list?
+     * 
+     * @return {@link #list}
+     */
+    public boolean getList() {
+        return list;
+    }
+
+    /**
+     * Are we doing a full list?
+     * 
+     * @return {@link #fullList}
+     */
+    public boolean getFullList() {
+        return fullList;
+    }
+    
+    /**
+     * Gets the module IDs to enable.
+     * 
+     * @return {@link #enableModuleIds}
+     */
+    @Nullable @NonnullElements @NotLive @Unmodifiable public Collection<String> getEnableModuleIds() {
+        return List.copyOf(enableModuleIds);
+    }
+    
+    /**
+     * Gets the module IDs to disable.
+     * 
+     * @return {@link #disableModuleIds}
+     */
+    @Nullable @NonnullElements @NotLive @Unmodifiable public Collection<String> getDisableModuleIds() {
+        return List.copyOf(disableModuleIds);
+    }
+
+    /**
+     * Are we disabling with the clean option?
+     * 
+     * @return {@link #clean}
+     */
+    public boolean getClean() {
+        return clean;
+    }
+    
+    /**
+     * Get bean name for the {@link HttpClient} (if specified).
+     * 
+     * @return the name or null
+     */
+    @Nullable @NotEmpty public String getHttpClientName() {
+        return httpClientName;
+    }
+
+    /**
+     * Get bean name for the {@link HttpClientSecurityParameters} (if specified).
+     * 
+     * @return the name or null
+     */
+    @Nullable @NotEmpty public String getHttpClientSecurityParameterstName() {
+        return httpClientSecurityParametersName;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void validate() throws IllegalArgumentException {
+        super.validate();
+
+        if (enableModuleIds.isEmpty() && disableModuleIds.isEmpty()) {
+            if (!list && !fullList) {
+                list = true;
+            }
+        } else if (list || fullList) {
+            log.error("Cannot list and enable/disable in the same operation");
+            throw new IllegalArgumentException("Cannot list and enable/disable in the same operation.");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void printHelp(final PrintStream out) {
+        out.println("ModuleManager");
+        out.println("Provides a command line interface for IdP Module management operations.");
+        out.println();
+        out.println("   module [options] [springConfiguration]");
+        out.println();
+        out.println("      springConfiguration      name of optional Spring configuration resource to use");
+        super.printHelp(out);
+        out.println();
+        out.println(String.format("  %-22s %s", "-l, --list",
+                "Brief Information on all installed modules"));
+        out.println(String.format("  %-22s %s", "-al, --full-list",
+                "Full details on all installed modules"));
+        out.println(String.format("  %-22s %s", "-e, --enable <id>",
+                "Enable module"));
+        out.println(String.format("  %-22s %s", "-u, --disable <id>",
+                "Disable module"));
+        out.println(String.format("  %-22s %s", "-f, --clean",
+                "Clean disabled files instead of preserving them"));
+        out.println(String.format("  %-22s %s", "-h, --http-client <bean name>",
+                "Use the named bean for HTTP operations"));
+        out.println(String.format("  %-22s %s", "-s, --http-security <bean name>",
+                "Use the named bean for HTTP security"));
+        out.println();
+    }
+
+}
\ No newline at end of file
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerCLI.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerCLI.java
new file mode 100644
index 000000000..d87b9c34b
--- /dev/null
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/ModuleManagerCLI.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.module.impl;
+
+import java.util.List;
+import java.util.ServiceLoader;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.apache.http.client.HttpClient;
+import org.opensaml.security.httpclient.HttpClientSecurityParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import net.shibboleth.idp.Version;
+import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLine;
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleContext;
+import net.shibboleth.idp.module.ModuleException;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+
+/**
+ * Command line for {@link IdPModule} management.
+ */
+public final class ModuleManagerCLI extends AbstractIdPHomeAwareCommandLine<ModuleManagerArguments> {
+
+    /** Class logger. */
+    @Nullable private Logger log;
+    
+    /** The injected HttpClient. */
+    @Nullable private HttpClient httpClient;
+    
+    /** Injected security parameters. */
+    @Nullable private HttpClientSecurityParameters httpClientSecurityParameters;
+
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull protected Logger getLogger() {
+        if (log == null) {
+            log = LoggerFactory.getLogger(ModuleManagerCLI.class);
+        }
+        return log;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull protected Class<ModuleManagerArguments> getArgumentClass() {
+        return ModuleManagerArguments.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected String getVersion() {
+        return Version.getVersion();
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull @NonnullElements @NotLive @Unmodifiable protected List<Resource> getAdditionalSpringResources() {
+        return List.of(new ClassPathResource("net/shibboleth/idp/conf/http-client.xml"));
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    protected int doRun(@Nonnull final ModuleManagerArguments args) {
+        final int ret = super.doRun(args);
+        if (ret != RC_OK) {
+            return ret;
+        }
+
+        final String clientName = args.getHttpClientName() != null ? args.getHttpClientName() :
+            "shibboleth.InternalHttpClient";
+        try {
+            httpClient = getApplicationContext().getBean(clientName, HttpClient.class);
+        } catch (final NoSuchBeanDefinitionException e) {
+            log.error("Could not locate HttpClient '{}'", clientName);
+            return RC_IO;
+        }
+        
+        if (args.getHttpClientSecurityParameterstName() != null) {
+            try {
+                httpClientSecurityParameters =
+                        getApplicationContext().getBean(args.getHttpClientSecurityParameterstName(),
+                                HttpClientSecurityParameters.class);
+            } catch (final NoSuchBeanDefinitionException e) {
+                log.error("Could not locate HttpClientSecurityParameters '{}'",
+                        args.getHttpClientSecurityParameterstName());
+                return RC_IO;
+            }
+        }
+
+        try {
+            final ModuleContext moduleContext =
+                    new ModuleContext(getApplicationContext().getEnvironment().getProperty("idp.home"));
+            moduleContext.setHttpClient(httpClient);
+            moduleContext.setHttpClientSecurityParameters(httpClientSecurityParameters);
+            
+            if (args.getList() || args.getFullList()) {
+                doList(moduleContext, args.getFullList());
+            } else {
+                doManage(moduleContext, args);
+            }
+        } catch (final ModuleException e) {
+            System.out.println("FAILED");
+            System.out.println();
+            return RC_INIT;
+        }
+        return ret;
+    }
+
+    /**
+     * List all modules.
+     * 
+     * @param moduleContext context
+     * @param full whether to do a long list
+     */
+    private void doList(@Nonnull final ModuleContext moduleContext, final boolean full) {
+        
+        for (final IdPModule module : ServiceLoader.load(IdPModule.class)) {
+            if (full) {
+                System.out.println();
+                System.out.println("Module: " + module.getId());
+                System.out.println("\tName: " + module.getName());
+                System.out.println("\tDesc: " + module.getDescription());
+                System.out.println("\tHelp: " + module.getURL());
+                System.out.println("\tStatus: " + (module.isEnabled(moduleContext) ? "ENABLED" : "DISABLED"));
+            } else {
+                System.out.println("Module: " + module.getId() + ": " +
+                        (module.isEnabled(moduleContext) ? "ENABLED" : "DISABLED"));
+            }
+            System.out.println();
+        }
+    }
+
+    /**
+     * Manage modules as directed.
+     * 
+     * @param moduleContext context
+     * @param args arguments
+     * 
+     * @throws ModuleException to report module errors
+     */
+    private void doManage(@Nonnull final ModuleContext moduleContext, @Nonnull final ModuleManagerArguments args)
+            throws ModuleException {
+        for (final IdPModule module : ServiceLoader.load(IdPModule.class)) {
+            if (args.getEnableModuleIds().contains(module.getId())) {
+                System.out.print("Enabling " + module.getId() + "...");
+                module.enable(moduleContext);
+                System.out.println("OK");
+            } else if (args.getDisableModuleIds().contains(module.getId())) {
+                System.out.print("Disabling " + module.getId() + "...");
+                module.disable(moduleContext, args.getClean());
+                System.out.println("OK");
+            }
+        }
+    }
+    
+
+    /**
+     * CLI entry point.
+     * 
+     * @param args arguments
+     */
+    public static void main(@Nonnull final String[] args) {
+        System.exit(new ModuleManagerCLI().run(args));
+    }
+
+}
\ No newline at end of file
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/package-info.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/package-info.java
new file mode 100644
index 000000000..5177c93fc
--- /dev/null
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implementation classes supporting module system.
+ */
+
+package net.shibboleth.idp.module.impl;
diff --git a/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLine.java b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLine.java
index cfdccce5b..eb1ff6f38 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLine.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLine.java
@@ -17,80 +17,36 @@
 
 package net.shibboleth.idp.cli;
 
-import java.nio.file.Files;
-import java.nio.file.Path;
-
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
 
 import net.shibboleth.ext.spring.cli.AbstractCommandLine;
-import net.shibboleth.ext.spring.cli.CommandLineArguments;
 import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
- * An extension to {@link AbstractCommandLine} that understand that idp.home is set via a property
- * when called inside the IdP.
+ * An extension to {@link AbstractCommandLine} that auto-adds our context initializer for idp.home
+ * and property support.
  *
  * @param <T> argument object type
  * 
  * @since 4.1.0
  */
-public abstract class AbstractIdPHomeAwareCommandLine<T extends CommandLineArguments> extends AbstractCommandLine<T> {
-
-    /** Where the IdP is installed to. */
-    @Nullable private Path idpHome;
+public abstract class AbstractIdPHomeAwareCommandLine<T extends AbstractIdPHomeAwareCommandLineArguments>
+        extends AbstractCommandLine<T> {
     
     /**
      * Constructor.
      */
     protected AbstractIdPHomeAwareCommandLine() {
-        setIdpHome(StringSupport.trimOrNull(System.getProperty("net.shibboleth.idp.cli.idp.home")));
-        setContextInitializer(this.new Initializer());
     }
 
-    /** Set where the IdP is installed to.
-     * @param home where
-     */
-    protected void setIdpHome(@Nullable final String home) {
-        if (home == null) {
-            getLogger().error("net.shibboleth.idp.cli.idp.home property not set, could not find IdP home directory");
-            return;
+    /** {@inheritDoc} */
+    @Override
+    protected int doRun(@Nonnull final T args) {
+        if (args.getIdPHome() != null) {
+            System.setProperty("idp.home", args.getIdPHome());
         }
-        idpHome = Path.of(home);
-        
-        if (!Files.exists(idpHome) || !Files.isDirectory(idpHome)) {
-            getLogger().error("IdP home directory '{}' did not exist or was not a directory", idpHome);
-            idpHome = null;
-        }
-    }
-    
-    /** 
-     * Gets IdP installation location.
-     * 
-     * @return the home directory
-     */
-    @Nullable protected Path getIdpHome() {
-        return idpHome;
+        setContextInitializer(new IdPPropertiesApplicationContextInitializer());
+        return super.doRun(args);
     }
     
-    /**
-     * An {@link ApplicationContextInitializer} which knows about our idp.home.
-     */
-    private class Initializer extends IdPPropertiesApplicationContextInitializer {
-
-        /** {@inheritDoc} */
-        @Override @Nonnull public String selectSearchLocation(
-                @Nonnull final ConfigurableApplicationContext applicationContext) {
-            return idpHome.toString();
-        }
-
-        /** {@inheritDoc} */
-        @Override @Nonnull public String getSearchLocation() {
-            return idpHome.toString();
-        }
-    }
-}
+}
\ No newline at end of file
diff --git a/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLineArguments.java b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLineArguments.java
new file mode 100644
index 000000000..da088510d
--- /dev/null
+++ b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractIdPHomeAwareCommandLineArguments.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.cli;
+
+import java.io.PrintStream;
+
+import javax.annotation.Nullable;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * An extension to {@link net.shibboleth.ext.spring.cli.AbstractCommandLineArguments}
+ * that allows idp.home override.
+ * 
+ * @since 4.1.0
+ */
+public abstract class AbstractIdPHomeAwareCommandLineArguments
+        extends net.shibboleth.ext.spring.cli.AbstractCommandLineArguments {
+
+    /** IdP location. */
+    @Parameter(names = "--home")
+    @Nullable private String idpHome;
+    
+    /** 
+     * Gets the configured home location.
+     * 
+     * @return home location
+     */
+    @Nullable public String getIdPHome() {
+        return idpHome;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void printHelp(final PrintStream out) {
+        super.printHelp(out);
+        out.println(String.format("  --%-20s %s", "home",
+                "Sets idp.home if not installed to default location."));
+        out.println();
+    }
+}
\ No newline at end of file
diff --git a/idp-distribution/src/main/resources/bin/module.bat b/idp-distribution/src/main/resources/bin/module.bat
new file mode 100644
index 000000000..09f01112a
--- /dev/null
+++ b/idp-distribution/src/main/resources/bin/module.bat
@@ -0,0 +1,4 @@
+ at echo off
+setlocal
+
+"%~dp0\runclass.bat" net.shibboleth.idp.module.impl.ModuleManagerCLI %*
diff --git a/idp-distribution/src/main/resources/bin/module.sh b/idp-distribution/src/main/resources/bin/module.sh
new file mode 100644
index 000000000..2cea54b15
--- /dev/null
+++ b/idp-distribution/src/main/resources/bin/module.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+declare LOCATION
+
+LOCATION=$(dirname $0)
+
+$LOCATION/runclass.sh net.shibboleth.idp.module.impl.ModuleManagerCLI "$@"
diff --git a/idp-installer/.settings/org.eclipse.jdt.core.prefs b/idp-installer/.settings/org.eclipse.jdt.core.prefs
index 7fa508cf8..af08edf91 100644
--- a/idp-installer/.settings/org.eclipse.jdt.core.prefs
+++ b/idp-installer/.settings/org.eclipse.jdt.core.prefs
@@ -132,7 +132,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.release=enabled
 org.eclipse.jdt.core.compiler.source=11
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerArguments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerArguments.java
index d91982ade..1bcdb7927 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerArguments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerArguments.java
@@ -32,13 +32,13 @@ import org.slf4j.LoggerFactory;
 
 import com.beust.jcommander.Parameter;
 
-import net.shibboleth.ext.spring.cli.AbstractCommandLineArguments;
+import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLineArguments;
 import net.shibboleth.idp.plugin.PluginVersion;
 
 /**
  * Arguments for Plugin Installer CLI.
  */
-public class PluginInstallerArguments extends AbstractCommandLineArguments {
+public class PluginInstallerArguments extends AbstractIdPHomeAwareCommandLineArguments {
 
     /** Logger. */
     private final Logger log = LoggerFactory.getLogger(PluginInstallerArguments.class);
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerCLI.java
index 1f1117aaf..dec89b170 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/PluginInstallerCLI.java
@@ -17,6 +17,7 @@
 
 package net.shibboleth.idp.installer.plugin;
 
+import java.nio.file.Path;
 import java.security.Security;
 import java.util.ArrayList;
 import java.util.List;
@@ -172,7 +173,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      * @throws ComponentInitializationException as required*/
     private void constructPluginInstaller() throws ComponentInitializationException {
         installer= new PluginInstaller();
-        installer.setIdpHome(getIdpHome());
+        installer.setIdpHome(Path.of(getApplicationContext().getEnvironment().getProperty("idp.home")));
         installer.setAcceptCert(new InstallerQuery("Accept this Certificate"));
         installer.setAcceptDownload(new InstallerQuery("Download from"));
         if (httpClient!= null) {
@@ -342,7 +343,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      */
     public static int runMain(@Nonnull final String[] args) {
         final PluginInstallerCLI cli = new PluginInstallerCLI();
-        if (cli.getIdpHome() == null) {
+        if (System.getProperty("idp.home") == null) {
             return RC_INIT;
         }
         return cli.run(args);
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/PluginCLITest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/PluginCLITest.java
index 0011b81fb..aedb9114c 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/PluginCLITest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/PluginCLITest.java
@@ -48,7 +48,7 @@ public class PluginCLITest extends BasePluginTest {
 
     @BeforeSuite public void setUp() throws IOException
     {
-        System.setProperty("net.shibboleth.idp.cli.idp.home",getIdpHome().toString());
+        System.setProperty("idp.home",getIdpHome().toString());
         plugin = getIdpHome().resolve("conf").resolve("admin").resolve("plugin-installer.xml").toFile();
     }
 

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


More information about the commits mailing list