Repository: maven-wagon
Updated Branches:
  refs/heads/master 412c0fbd7 -> ffa7fc883


[WAGON-467] Allow customisation of some SSH options

Submitted by: Nikolas Falco

This commit add StrictHostKeyChecking and PreferredAuthentications custom
fields that together allow you to perform, the command scp enough to
remove any user interaction (username, password and add host key to
know_hosts file).


Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/ffa7fc88
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/ffa7fc88
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/ffa7fc88

Branch: refs/heads/master
Commit: ffa7fc8830e916e9d3d91a222b641cd5363ffafe
Parents: 412c0fb
Author: Dan Tran <dan.t...@emc.com>
Authored: Wed Nov 23 15:01:05 2016 -0800
Committer: Dan Tran <dan.t...@emc.com>
Committed: Wed Nov 23 15:01:05 2016 -0800

----------------------------------------------------------------------
 .../providers/ssh/jsch/AbstractJschWagon.java   | 35 ++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/ffa7fc88/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
----------------------------------------------------------------------
diff --git 
a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
 
b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
index 8695235..0b60cbb 100644
--- 
a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
+++ 
b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
@@ -81,6 +81,8 @@ public abstract class AbstractJschWagon
 
     protected Session session;
 
+    private String strictHostKeyChecking;
+
     /**
      * @plexus.requirement role-hint="file"
      */
@@ -92,6 +94,11 @@ public abstract class AbstractJschWagon
     private volatile InteractiveUserInfo interactiveUserInfo;
 
     /**
+     * @plexus.configuration 
default-value="gssapi-with-mic,publickey,password,keyboard-interactive"
+     */
+    private volatile String preferredAuthentications;
+
+    /**
      * @plexus.requirement
      */
     private volatile UIKeyboardInteractive uIKeyboardInteractive;
@@ -235,12 +242,16 @@ public abstract class AbstractJschWagon
             {
                 // continue without known_hosts
             }
-            config.setProperty( "StrictHostKeyChecking", 
getKnownHostsProvider().getHostKeyChecking() );
+            if ( strictHostKeyChecking == null )
+            {
+                strictHostKeyChecking = 
getKnownHostsProvider().getHostKeyChecking();
+            }
+            config.setProperty( "StrictHostKeyChecking", strictHostKeyChecking 
);
         }
 
         if ( authenticationInfo.getPassword() != null )
         {
-            config.setProperty( "PreferredAuthentications", 
"gssapi-with-mic,publickey,password,keyboard-interactive" );
+            config.setProperty( "PreferredAuthentications", 
preferredAuthentications );
         }
 
         config.setProperty( "BatchMode", interactive ? "no" : "yes" );
@@ -447,4 +458,24 @@ public abstract class AbstractJschWagon
     {
         this.uIKeyboardInteractive = uIKeyboardInteractive;
     }
+
+    public String getPreferredAuthentications()
+    {
+        return preferredAuthentications;
+    }
+
+    public void setPreferredAuthentications( String preferredAuthentications )
+    {
+        this.preferredAuthentications = preferredAuthentications;
+    }
+
+    public String getStrictHostKeyChecking()
+    {
+        return strictHostKeyChecking;
+    }
+
+    public void setStrictHostKeyChecking( String strictHostKeyChecking )
+    {
+        this.strictHostKeyChecking = strictHostKeyChecking;
+    }
 }

Reply via email to