[java-identity-provider] branch master updated: IDP-1155 - Options for SSL checking bypass in command line tools

Scott Cantor cantor.2 at osu.edu
Tue Aug 21 16:44:20 EDT 2018


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

scantor pushed a commit to branch master
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/master by this push:
       new  61c7643   IDP-1155 - Options for SSL checking bypass in command line tools
61c7643 is described below

commit 61c764322f2e848b59caf79647f8d1f0741a367d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Aug 21 16:44:17 2018 -0400

    IDP-1155 - Options for SSL checking bypass in command line tools
    
    https://issues.shibboleth.net/jira/browse/IDP-1155
    
    Add disableNameChecking option.
---
 .../idp/cli/AbstractCommandLineArguments.java      | 27 +++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java
index ffe78e0..7c0e95e 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java
@@ -22,6 +22,9 @@ import java.net.URL;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
@@ -49,7 +52,11 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
     /** Path to add to base URL. */
     @Parameter(names = {"-p", "--path"}, description = "Path to append to base URL to invoke")
     @Nullable private String path;
-    
+
+    /** Disable TLS certificate name checking. */
+    @Parameter(names = {"-k", "--disableNameChecking"}, description = "Disable TLS certificate name checking")
+    private boolean disableNameChecking;
+
     /** Trust store for SSL connectivity. */
     @Parameter(names = {"-ts", "--trustStore"}, description = "Path to a trust store for SSL connections")
     @Nullable private String trustStore;
@@ -125,6 +132,15 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
     @Nullable public String getTrustStorePassword() {
         return trustStorePassword;
     }
+    
+    /**
+     * Value of "disableNameChecking" parameter.
+     * 
+     * @return parameter value
+     */
+    public boolean isDisableNameChecking() {
+        return disableNameChecking;
+    }
 
     /** {@inheritDoc} */
     @Override
@@ -148,6 +164,15 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
     @Nonnull public URL buildURL() throws MalformedURLException {
         installTrustStore();
         
+        if (disableNameChecking) {
+            final HostnameVerifier allHostsValid = new HostnameVerifier() {
+                public boolean verify(final String hostname, final SSLSession session) {
+                    return true;
+                }
+            };      
+            HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);                       
+        }
+        
         final StringBuilder builder = new StringBuilder(getURL());
         if (getPath() != null) {
             builder.append(getPath());

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


More information about the commits mailing list