[java-identity-provider] branch main updated: IDP-1595 Prompt user to install certificate
Rod Widdowson
rdw at steadingsoftware.com
Wed Aug 19 16:31:04 UTC 2020
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=2e4fa0e7a9225f6ff90bab59314cd695d5ba6ad2
The following commit(s) were added to refs/heads/main by this push:
new 2e4fa0e7a IDP-1595 Prompt user to install certificate
2e4fa0e7a is described below
commit 2e4fa0e7a9225f6ff90bab59314cd695d5ba6ad2
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Aug 19 17:28:34 2020 +0100
IDP-1595 Prompt user to install certificate
https://issues.shibboleth.net/jira/browse/IDP-1595
---
.../idp/installer/plugin/PluginInstallerCLI.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
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 b8c3d390d..f4b1c088f 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
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.function.Predicate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -44,6 +45,7 @@ import net.shibboleth.idp.plugin.PluginVersion;
import net.shibboleth.idp.plugin.impl.PluginState;
import net.shibboleth.idp.plugin.impl.PluginState.VersionInfo;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
* Command line for Plugin Installation.
@@ -159,6 +161,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
private void constructPluginInstaller() throws ComponentInitializationException {
installer= new PluginInstaller();
installer.setIdpHome(getIdpHome());
+ installer.setAcceptCert(new TrustStoreQuery());
if (httpClient!= null) {
installer.setHttpClient(httpClient);
}
@@ -241,5 +244,19 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
public static void main(@Nonnull final String[] args) {
System.exit(runMain(args));
}
+
+ /** Predicate to ask the user if they want to install the trust store provided. */
+ private class TrustStoreQuery implements Predicate<String> {
+ /** {@inheritDoc} */
+ public boolean test(final String certString) {
+ String result = null;
+ while (result == null) {
+ System.console().printf("Accept this Certificate:\n%s [yN]", certString);
+ System.console().flush();
+ result = StringSupport.trimOrNull(System.console().readLine());
+ }
+ return "y".equalsIgnoreCase(result.substring(0, 1));
+ }
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list