maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r312660 - in /maven/wagon/trunk/wagon-providers/wagon-ssh: ./ src/main/java/org/apache/maven/wagon/providers/ssh/ src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/ src/main/resources/META-INF/plexus/ src/test/java/org/apache/mav...
Date Mon, 10 Oct 2005 14:30:08 GMT
Author: brett
Date: Mon Oct 10 07:29:37 2005
New Revision: 312660

URL: http://svn.apache.org/viewcvs?rev=312660&view=rev
Log:
PR: WAGONSSH-12
Submitted by: Juan F. Codagnone
Reviewed by:  Brett Porter
Implement known_hosts handling to protect against man-in-the-middle attacks
(applied with significant changes)

Added:
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml   (with props)
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/fail.knownhosts
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/ok.knownhosts
Modified:
    maven/wagon/trunk/wagon-providers/wagon-ssh/pom.xml
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/xdocs/index.xml

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/pom.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/pom.xml?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/pom.xml Mon Oct 10 07:29:37 2005
@@ -19,6 +19,18 @@
       <artifactId>jsch</artifactId>
       <version>0.1.21</version>
     </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.3</version>
+    </dependency>
+    <dependency> 
+      <!-- used by org.apache.maven.wagon.providers.ssh.InteractiveUserInfo -->
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-input-handler-api</artifactId>
+      <version>1.0-alpha-3</version>
+    </dependency>
+
   </dependencies>
   <build>
     <plugins>
@@ -30,6 +42,7 @@
             <exclude>**/ScpWagon*Test.*</exclude>
             <exclude>**/SftpWagonTest.*</exclude>
             <exclude>**/SshCommandExecutorTest.*</exclude>
+            <exclude>**/knownhost/**</exclude>
           </excludes>
         </configuration>
       </plugin>

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java Mon Oct 10 07:29:37 2005
@@ -28,6 +28,7 @@
 import org.apache.maven.wagon.ResourceDoesNotExistException;
 import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.WagonConstants;
+import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
 import org.apache.maven.wagon.authentication.AuthenticationException;
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
 import org.apache.maven.wagon.events.TransferEvent;
@@ -38,6 +39,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Properties;
 
 /**
  * Common SSH operations.
@@ -61,6 +63,12 @@
 
     private static final byte LF = '\n';
 
+    private KnownHostsProvider knownHostsProvider;
+
+    private InteractiveUserInfo interactiveUserInfo;
+
+    private JSch sch;
+
     public void openConnection()
         throws AuthenticationException
     {
@@ -69,7 +77,7 @@
             throw new IllegalArgumentException( "Authentication Credentials cannot be null for SSH protocol" );
         }
 
-        JSch jsch = new JSch();
+        sch = new JSch();
 
         int port = getRepository().getPort();
 
@@ -82,7 +90,7 @@
 
         try
         {
-            session = jsch.getSession( authenticationInfo.getUserName(), host, port );
+            session = sch.getSession( authenticationInfo.getUserName(), host, port );
         }
         catch ( JSchException e )
         {
@@ -116,7 +124,7 @@
 
                 try
                 {
-                    jsch.addIdentity( privateKey.getAbsolutePath(), authenticationInfo.getPassphrase() );
+                    sch.addIdentity( privateKey.getAbsolutePath(), authenticationInfo.getPassphrase() );
                 }
                 catch ( JSchException e )
                 {
@@ -164,8 +172,26 @@
             }
         }
 
+        Properties config = new Properties();
+
         // username and password will be given via UserInfo interface.
-        UserInfo ui = new WagonUserInfo( authenticationInfo );
+        UserInfo ui = new WagonUserInfo( authenticationInfo, interactiveUserInfo );
+
+        if ( knownHostsProvider != null )
+        {
+            try
+            {
+                knownHostsProvider.addConfiguration( config );
+                knownHostsProvider.addKnownHosts( sch, ui );
+            }
+            catch ( JSchException e )
+            {
+                fireSessionError( e );
+                // continue without known_hosts
+            }
+        }
+
+        session.setConfig( config );
 
         session.setUserInfo( ui );
 
@@ -284,10 +310,18 @@
 
     public void closeConnection()
     {
+        if ( knownHostsProvider != null )
+        {
+            knownHostsProvider.storeKnownHosts( sch );
+        }
+
         if ( session != null )
         {
             session.disconnect();
+            session = null;
         }
+        
+        sch = null;
     }
 
     protected void handleGetException( Resource resource, Exception e, File destination )
@@ -326,11 +360,14 @@
     private static class WagonUserInfo
         implements UserInfo
     {
-        private AuthenticationInfo authInfo;
+        private final AuthenticationInfo authInfo;
+
+        private final InteractiveUserInfo userInfo;
 
-        WagonUserInfo( AuthenticationInfo authInfo )
+        WagonUserInfo( AuthenticationInfo authInfo, InteractiveUserInfo userInfo )
         {
             this.authInfo = authInfo;
+            this.userInfo = userInfo;
         }
 
         public String getPassphrase()
@@ -355,13 +392,50 @@
 
         public boolean promptYesNo( String arg0 )
         {
-            return true;
+            if ( userInfo != null )
+            {
+                return userInfo.promptYesNo( arg0 );
+            }
+            else
+            {
+                return false;
+            }
         }
 
         public void showMessage( String message )
         {
-            // TODO: is this really debug?
-            //fireTransferDebug( message );
+            if ( userInfo != null )
+            {
+                userInfo.showMessage( message );
+            }
+        }
+    }
+
+    public final KnownHostsProvider getKnownHostsProvider()
+    {
+        return knownHostsProvider;
+    }
+
+    public final void setKnownHostsProvider( KnownHostsProvider knownHostsProvider )
+    {
+        if ( knownHostsProvider == null )
+        {
+            throw new IllegalArgumentException( "knownHostsProvider can't be null" );
+        }
+        this.knownHostsProvider = knownHostsProvider;
+    }
+
+    public InteractiveUserInfo getInteractiveUserInfo()
+    {
+        return interactiveUserInfo;
+    }
+
+    public void setInteractiveUserInfo( InteractiveUserInfo interactiveUserInfo )
+    {
+        if ( interactiveUserInfo == null )
+        {
+            throw new IllegalArgumentException( "interactiveUserInfo can't be null" );
         }
+        this.interactiveUserInfo = interactiveUserInfo;
     }
 }

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,90 @@
+package org.apache.maven.wagon.providers.ssh;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.codehaus.plexus.components.inputhandler.InputHandler;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.IOException;
+
+/**
+ * Shows messages to System.out, and ask replies using an InputHandler 
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public class ConsoleInteractiveUserInfo
+    implements InteractiveUserInfo
+{
+    private InputHandler inputHandler;
+
+    public ConsoleInteractiveUserInfo()
+    {
+    }
+
+    public ConsoleInteractiveUserInfo( InputHandler inputHandler )
+    {
+        this.inputHandler = inputHandler;
+    }
+
+    /** @see InteractiveUserInfo#promptYesNo(java.lang.String) */
+    public boolean promptYesNo( String message )
+    {
+        boolean ret = false;
+
+        showMessage( message );
+        String answer;
+        try
+        {
+            answer = inputHandler.readLine();
+            if ( !StringUtils.isEmpty( answer ) )
+            {
+                answer = answer.toLowerCase();
+
+                // TODO: localization and i18n? 
+                if ( answer.startsWith( "y" ) )
+                {
+                    ret = true;
+                }
+                else if ( answer.startsWith( "n" ) )
+                {
+                    ret = false;
+
+                }
+            }
+        }
+        catch ( final IOException e )
+        {
+            // TODO log?
+            
+            // nothing to do
+        }
+
+        return ret;
+    }
+
+    /** @see InteractiveUserInfo#showMessage(java.lang.String) */
+    public void showMessage( String message )
+    {
+        System.out.println( message );
+    }
+
+    public void setInputHandler( InputHandler inputHandler )
+    {
+        this.inputHandler = inputHandler;
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ConsoleInteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,35 @@
+package org.apache.maven.wagon.providers.ssh;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Interactive part for <code>UserInfo</code>
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ * @see com.jcraft.jsch.UserInfo
+ */
+public interface InteractiveUserInfo
+{
+    String ROLE = InteractiveUserInfo.class.getName();
+
+    /** @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String) */
+    boolean promptYesNo( String message );
+
+    /*** @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String) */
+    void showMessage( String message );
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,62 @@
+package org.apache.maven.wagon.providers.ssh;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.wagon.providers.ssh.InteractiveUserInfo;
+
+/**
+ * Dummy Implementation for <code>InteractiveUserInfo</code>, nice for
+ * non-Interactive environments
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ * @see org.apache.maven.wagon.providers.ssh.InteractiveUserInfo
+ */
+public class NullInteractiveUserInfo
+    implements InteractiveUserInfo
+{
+    private final boolean promptYesNoResult;
+
+    /** @see #NullInteractiveUserInfo(boolean) */
+    public NullInteractiveUserInfo()
+    {
+        this( false ); // the safest value
+    }
+
+    /** 
+     * Creates a <code>NullInteractiveUserInfo</code> with a hardcoded 
+     * prompYesNo result
+     * 
+     * @param promptYesNoResult the hardcoded result
+     */
+    public NullInteractiveUserInfo( final boolean promptYesNoResult )
+    {
+        this.promptYesNoResult = promptYesNoResult;
+    }
+
+    /** @see InteractiveUserInfo#promptYesNo(java.lang.String) */
+    public boolean promptYesNo( final String message )
+    {
+        return promptYesNoResult;
+    }
+
+    /** @see InteractiveUserInfo#showMessage(java.lang.String) */
+    public void showMessage( final String message )
+    {
+        // nothing to do
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/NullInteractiveUserInfo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java Mon Oct 10 07:29:37 2005
@@ -339,4 +339,5 @@
     {
         throw new UnsupportedOperationException( "getIfNewer is scp wagon must be still implemented" );
     }
+
 }

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,48 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import com.jcraft.jsch.JSch;
+
+import java.util.Properties;
+import java.io.IOException;
+
+/**
+ * Common base for known hosts providers.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public abstract class AbstractKnownHostsProvider
+    implements KnownHostsProvider
+{
+    private String hostKeyChecking;
+
+    public void addConfiguration( Properties config )
+    {
+        config.setProperty( HOST_KEY_CHECKING, hostKeyChecking );
+    }
+
+    public void setHostKeyChecking( String hostKeyChecking )
+    {
+        this.hostKeyChecking = hostKeyChecking;
+    }
+
+    public void storeKnownHosts( JSch sch )
+    {
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,101 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+import com.jcraft.jsch.HostKey;
+import com.jcraft.jsch.HostKeyRepository;
+import com.jcraft.jsch.JSch;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.codehaus.plexus.util.IOUtil;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Provides known hosts from a file
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public class FileKnownHostsProvider
+    extends StreamKnownHostsProvider
+{
+    private final File file;
+
+    /**
+     * Creates the FileKnownHostsProvider.
+     *
+     * @param file the file that holds the known hosts, in the openssh format
+     * @throws IOException
+     */
+    public FileKnownHostsProvider( File file )
+        throws IOException
+    {
+        super( file.exists() ? (InputStream) new FileInputStream( file ) : new ByteArrayInputStream( "".getBytes() ) );
+        this.file = file;
+    }
+
+    /**
+     * Creates a FileKnownHostsProvider using as file openssh knwon_host
+     *
+     * @throws IOException
+     * @see #FileKnownHostsProvider(File)
+     */
+    public FileKnownHostsProvider()
+        throws IOException
+    {
+        this( new File( System.getProperty( "user.home" ), ".ssh/known_hosts" ) );
+    }
+
+    public void storeKnownHosts( JSch sch )
+    {
+        PrintWriter w = null;
+        try
+        {
+            w = new PrintWriter( new FileWriter( file ) );
+
+            HostKeyRepository hkr = sch.getHostKeyRepository();
+            HostKey[] keys = hkr.getHostKey();
+
+            for ( int i = 0; i < keys.length; i++ )
+            {
+                HostKey key = keys[i];
+                w.println( key.getHost() + " " + key.getType() + " " + key.getKey() );
+            }
+        }
+        catch ( IOException e )
+        {
+            // TODO: log it
+        }
+        finally
+        {
+            IOUtil.close( w );
+        }
+
+        super.storeKnownHosts( sch );
+    }
+
+    public File getFile()
+    {
+        return file;
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,51 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.wagon.TransferFailedException;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.UserInfo;
+
+import java.util.Properties;
+import java.io.IOException;
+
+/**
+ * Provides a way to add Known Hosts fingerprints to the JSch transport
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public interface KnownHostsProvider
+{
+    String ROLE = KnownHostsProvider.class.getName();
+
+    String HOST_KEY_CHECKING = "StrictHostKeyChecking";
+
+    /**
+     * Adds to the session all the known hosts
+     * 
+     * @param sch JSch transport
+     */
+    void addKnownHosts( JSch sch, UserInfo userInfo )
+        throws JSchException;
+
+    void addConfiguration( Properties config );
+
+    void storeKnownHosts( JSch sch );
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,41 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.UserInfo;
+import org.apache.maven.wagon.TransferFailedException;
+
+import java.util.Properties;
+
+/**
+ * Dummy <code>KnownHostsProvider</code>
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public final class NullKnownHostProvider
+    extends AbstractKnownHostsProvider
+{
+    /**
+     * @see KnownHostsProvider#addKnownHosts(com.jcraft.jsch.JSch, com.jcraft.jsch.UserInfo)
+     */
+    public void addKnownHosts( JSch sch, UserInfo userInfo )
+    {
+        // nothing to do ;-)
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,64 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import com.jcraft.jsch.HostKeyRepository;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.UserInfo;
+import org.apache.commons.codec.binary.Base64;
+
+/**
+ * Simple <code>KnownHostsProvider</code> with known wired values
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public class SingleKnownHostProvider
+    extends AbstractKnownHostsProvider
+{
+    /**
+     * the host ...
+     */
+    private String host;
+
+    /**
+     * the key ...
+     */
+    private String key;
+
+    public SingleKnownHostProvider()
+    {
+    }
+
+    /**
+     * Creates the SingleKnownHostProvider.
+     */
+    public SingleKnownHostProvider( String host, String key )
+    {
+        this.host = host;
+        this.key = key;
+    }
+
+    /**
+     * @see KnownHostsProvider#addKnownHosts(com.jcraft.jsch.JSch, UserInfo)
+     */
+    public void addKnownHosts( JSch sch, UserInfo userInfo )
+    {
+        HostKeyRepository hkr = sch.getHostKeyRepository();
+        hkr.add( host, Base64.decodeBase64( key.getBytes() ), userInfo );
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,66 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.UserInfo;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringOutputStream;
+import org.codehaus.plexus.util.StringInputStream;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Provides known hosts from a file
+ *
+ * @author Juan F. Codagnone
+ * @since Sep 12, 2005
+ */
+public class StreamKnownHostsProvider
+    extends AbstractKnownHostsProvider
+{
+    /**
+     * the known hosts, in the openssh format
+     */
+    private final String contents;
+
+    public StreamKnownHostsProvider( InputStream stream )
+        throws IOException
+    {
+        try
+        {
+            StringOutputStream stringOutputStream = new StringOutputStream();
+            IOUtil.copy( stream, stringOutputStream );
+            this.contents = stringOutputStream.toString();
+        }
+        finally
+        {
+            IOUtil.close( stream );
+        }
+    }
+
+    /**
+     * @see KnownHostsProvider#addKnownHosts(com.jcraft.jsch.JSch, UserInfo)
+     */
+    public void addKnownHosts( JSch sch, UserInfo userInfo )
+        throws JSchException
+    {
+        sch.setKnownHosts( new StringInputStream( contents ) );
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml Mon Oct 10 07:29:37 2005
@@ -5,17 +5,59 @@
       <role-hint>scp</role-hint>
       <implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+        </requirement>
+      </requirements>
     </component>
     <component>
       <role>org.apache.maven.wagon.Wagon</role>
       <role-hint>sftp</role-hint>
       <implementation>org.apache.maven.wagon.providers.ssh.SftpWagon</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+        </requirement>
+      </requirements>
     </component>
     <component>
       <role>org.apache.maven.wagon.providers.ssh.SshCommandExecutor</role>
       <implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.ConsoleInteractiveUserInfo</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.components.inputhandler.InputHandler</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.knownhost.FileKnownHostsProvider</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <configuration>
+        <hostKeyChecking>ask</hostKeyChecking>
+      </configuration>
     </component>
   </components>
 </component-set>

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java Mon Oct 10 07:29:37 2005
@@ -26,16 +26,29 @@
 {
     public static String getTestRepositoryUrl()
     {
-        return "scp://localhost/tmp/home/projects/" + getUserName() + "/public_html";
+        return "scp://" + getHostname() + "/tmp/wagon-ssh-test/" + getUserName();
     }
 
     public static String getUserName()
     {
-        return System.getProperty( "user.name" );
+        return System.getProperty( "test.user", System.getProperty( "user.name" ) );
     }
 
     public static File getPrivateKey()
     {
         return new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
+    }
+
+    public static String getHostname()
+    {
+        return System.getProperty( "test.host", "beaver.codehaus.org" );
+    }
+
+    public static String getHostKey()
+    {
+        // beaver.codehaus.org
+        return "AAAAB3NzaC1yc2EAAAABIwAAAIEAwCT2lARY2T3EYjhQW1G4fYDltZgKKdg35esqhqM" +
+            "Z3lUV8QTg26aY1HfotUNJ0qaWsa587KP3zRUtHW4oP+hrOq/XQNsn57LKFFceCoy2vf" +
+            "/t9/Qin24mCW2QsGdyZ/txEhADbGjPkt4/Z9e/KoZGahWoPTjR26G1i1St9IsZPcU=";
     }
 }

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,85 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import junit.framework.TestCase;
+import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
+import org.apache.maven.wagon.providers.ssh.TestData;
+
+/**
+ * Generic Unit test for <code>KnownHostsProvider</code>
+ *
+ * @author Juan F. Codagnone
+ * @see org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider
+ * @since Sep 12, 2005
+ */
+public abstract class AbstractKnownHostsProviderTest
+    extends TestCase
+{
+    protected KnownHostsProvider okHostsProvider;
+
+    protected KnownHostsProvider failHostsProvider;
+
+    protected final String user = TestData.getUserName();
+
+    protected final String host = TestData.getHostname();
+
+    /**
+     * tests what happens if the remote host has a different key than the one
+     * we expect
+     *
+     * @throws Exception on error
+     */
+    public void testIncorrectKey()
+        throws Exception
+    {
+        final JSch sch = new JSch();
+
+        failHostsProvider.addKnownHosts( sch, null );
+        try
+        {
+            sch.getSession( user, host ).connect();
+
+            fail( "Should not have successfully connected - host is not known" );
+        }
+        catch ( JSchException e )
+        {
+            assertTrue( e.getMessage().startsWith( "UnknownHostKey:" ) );
+        }
+    }
+
+    /**
+     * tests what happens if the remote host has the expected key
+     *
+     * @throws Exception on error
+     */
+    public void testCorrectKey()
+        throws Exception
+    {
+        final JSch sch = new JSch();
+        sch.addIdentity( TestData.getPrivateKey().getAbsolutePath(), "" );
+
+        okHostsProvider.addKnownHosts( sch, null );
+
+        final Session session = sch.getSession( user, host );
+
+        session.connect();
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,43 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+import org.apache.maven.wagon.providers.ssh.TestData;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Unit test for <code>SingleKnownHostProvider</code>
+ *
+ * @author Juan F. Codagnone
+ * @see SingleKnownHostProvider
+ * @since Sep 12, 2005
+ */
+public class SingleKnownHostsProviderTest
+    extends AbstractKnownHostsProviderTest
+{
+    private final String correctKey = TestData.getHostKey();
+
+    private final String incorrectKey = "thisisawrongkey=";
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        this.okHostsProvider = new SingleKnownHostProvider( host, correctKey );
+        this.failHostsProvider = new SingleKnownHostProvider( host, incorrectKey );
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java Mon Oct 10 07:29:37 2005
@@ -0,0 +1,49 @@
+package org.apache.maven.wagon.providers.ssh.knownhost;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Unit test for <code>StreamKnownHostsProviderTest</code>
+ *
+ * @author Juan F. Codagnone
+ * @see StreamKnownHostsProviderTest
+ * @since Sep 12, 2005
+ */
+public class StreamKnownHostsProviderTest
+    extends AbstractKnownHostsProviderTest
+{
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        okHostsProvider = getProvider( "ok.knownhosts" );
+        failHostsProvider = getProvider( "fail.knownhosts" );
+    }
+
+    private StreamKnownHostsProvider getProvider( String s )
+        throws IOException
+    {
+        String prefix = "/org/apache/maven/wagon/providers/ssh/knownhost/";
+        InputStream ok = getClass().getResourceAsStream( prefix + s );
+        assertNotNull( ok );
+        return new StreamKnownHostsProvider( ok );
+    }
+}

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml Mon Oct 10 07:29:37 2005
@@ -0,0 +1,17 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.NullInteractiveUserInfo</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <configuration>
+        <hostKeyChecking>no</hostKeyChecking>
+      </configuration>
+    </component>
+  </components>
+</component-set>

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml Mon Oct 10 07:29:37 2005
@@ -0,0 +1,17 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.NullInteractiveUserInfo</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <configuration>
+        <hostKeyChecking>no</hostKeyChecking>
+      </configuration>
+    </component>
+  </components>
+</component-set>

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml Mon Oct 10 07:29:37 2005
@@ -0,0 +1,17 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.NullInteractiveUserInfo</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <configuration>
+        <hostKeyChecking>no</hostKeyChecking>
+      </configuration>
+    </component>
+  </components>
+</component-set>

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SftpWagonTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml Mon Oct 10 07:29:37 2005
@@ -0,0 +1,17 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.InteractiveUserInfo</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.NullInteractiveUserInfo</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
+    <component>
+      <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
+      <implementation>org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <configuration>
+        <hostKeyChecking>no</hostKeyChecking>
+      </configuration>
+    </component>
+  </components>
+</component-set>

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/SshCommandExecutorTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/fail.knownhosts
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/fail.knownhosts?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/fail.knownhosts (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/fail.knownhosts Mon Oct 10 07:29:37 2005
@@ -0,0 +1 @@
+beaver.codehaus.org,64.7.141.17 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAwps9EL+UKFG6Fb9spvV6YSOiyLFwVGAgtyQ5r6xdADZRw0AdcCE87uwlVgUgMjGm0D/kifVEYFZu1DQUaKfg+6B3LEz7Dgq5Ir8eJJXq62mIVqHnXKPOqGIp1TPrtc2BMhSHk5z+4puun6Nbi0hw+g7b0/ywHVbs+7wb01SMREU=
\ No newline at end of file

Added: maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/ok.knownhosts
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/ok.knownhosts?rev=312660&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/ok.knownhosts (added)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/knownhost/ok.knownhosts Mon Oct 10 07:29:37 2005
@@ -0,0 +1 @@
+beaver.codehaus.org,64.7.141.17 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAwCT2lARY2T3EYjhQW1G4fYDltZgKKdg35esqhqMZ3lUV8QTg26aY1HfotUNJ0qaWsa587KP3zRUtHW4oP+hrOq/XQNsn57LKFFceCoy2vf/t9/Qin24mCW2QsGdyZ/txEhADbGjPkt4/Z9e/KoZGahWoPTjR26G1i1St9IsZPcU=

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/xdocs/index.xml?rev=312660&r1=312659&r2=312660&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/xdocs/index.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/xdocs/index.xml Mon Oct 10 07:29:37 2005
@@ -1,13 +1,18 @@
 <document>
   <properties>
-    <title>Wagon File provider</title>
+    <title>Wagon SSH provider</title>
     <author email="michal.maczka@dimatics.com">Michal Maczka</author>
   </properties>
   <body>
-    <section name="Wagon SCH provider">
+    <section name="Wagon SSH provider">
       <p>
-        This project is an implementation of Wagon provider for <b>scp</b> and <b>sftp</b> protocols using
-        <a href="http://www.jcraft.com/jsch/">JSCH</a> library
+        This project is an implementation of Wagon provider for
+        <b>scp</b>
+        and
+        <b>sftp</b>
+        protocols using
+        <a href="http://www.jcraft.com/jsch/">JSCH</a>
+        library
       </p>
     </section>
     <section name="Features">
@@ -17,13 +22,215 @@
             SCP and SFTP protocols are supported.
           </li>
           <li>
-            <b>PUT</b> and <b>GET</b> requests are are supported for both protocols.
+            <b>PUT</b>
+            and
+            <b>GET</b>
+            requests are are supported for both protocols.
           </li>
           <li>
             SCH Wagon is able to set remote UNIX group for deployed resource (see: xxx ), but for SFTP protocol
             group id should be a positive integer.
           </li>
         </ul>
+      </p>
+    </section>
+    <section name="Configuration">
+      <p>This wagon can be configured in some ways:
+        <table>
+          <tr>
+            <th>What? / Interface</th>
+            <th>Default Value</th>
+            <th>Why?</th>
+          </tr>
+          <tr>
+            <td>
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/KnownHostsProvider.html">Known Hosts Provider</a>
+            </td>
+            <td>
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">
+                FileKnownHostsProvider</a>
+              with fallback to
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">
+                NullKnownHostProvider</a>
+            </td>
+            <td>provides known hosts keys, needed to check the hosts
+              identity. This is an important thing!
+              <p>Some implementations:
+                <ul>
+                  <li>
+                    <a
+                        href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">
+                      NullKnownHostProvider</a>
+                    : Don't provide anything
+                  </li>
+                  <li>
+                    <a
+                        href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProvider.html">
+                      SingleKnownHostProvider</a>
+                    : One host key can be setuped
+                  </li>
+                  <li>
+                    <a
+                        href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">
+                      FileKnownHostProvider</a>
+                    :
+                    Load known hosts keys from a openssh's ~/.ssh/known_hosts
+                    like stream
+                  </li>
+                  <li>
+                    <a
+                        href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.html">
+                      StreamKnownHostProvider</a>
+                    :
+                    Load known hosts keys from ~/.ssh/known_hosts (you can
+                    set another location)
+                  </li>
+
+                </ul>
+              </p>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/HostCheckingEnum.html">Host Checking</a>
+            </td>
+            <td>Ask (type safe enum)</td>
+            <td>The policy with the hosts keys:
+              <ul>
+                <li>
+                  <strong>Yes:</strong>
+                  Check host keys. If the incoming
+                  key is not available in the Known Hosts Provider
+                  fails
+                </li>
+                <li>
+                  <strong>Ask:</strong>
+                  If the incoming key is not
+                  available in the Known Hosts Provider it ask the user
+                  if the fingerprint is trusted
+                </li>
+                <li>
+                  <strong>No:</strong>
+                  don't check host keys at all.
+                  pretty unsafe!!
+                </li>
+
+              </ul>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.html">Interactive User Info</a>
+            </td>
+            <td>
+              <a
+                  href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">
+                ConsoleInteractiveUserInfo</a>
+            </td>
+            <td>If the user choose
+              <em>Ask</em>
+              as
+              <em>Host Checking</em>
+              , this
+              bean is used to interact with the user
+              <p>Some implementations:
+                <ul>
+                  <li>
+                    <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullInteractiveUserInfo.html">
+                      NullInteractiveUserInfo</a>
+                  </li>
+                  <li>
+                    <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">
+                      ConsoleInteractiveUserInfo</a>
+                  </li>
+                </ul>
+              </p>
+
+            </td>
+          </tr>
+        </table>
+      </p>
+    </section>
+    <section name="Configuration">
+      <p>This wagon can be configured in some ways:
+         <table>
+	    <tr>
+	       <th>What? / Interface</th>
+	       <th>Default Value</th>
+	       <th>Why?</th>
+	    </tr>
+	    <tr>
+	       <td><a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/KnownHostsProvider.html">Known Hosts Provider </a></td> 
+	       <td><a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">FileKnownHostsProvider</a>
+	       with fallback to
+	       <a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">NullKnownHostProvider</a></td>
+	       <td>provides known hosts keys, needed to check the hosts
+	           identity. This is an important thing!
+	           <p>Some implementations:
+		     <ul>
+		       <li> <a
+		       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">NullKnownHostProvider</a>: Don't provide anything</li>
+		       <li> <a
+		       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProvider.html">SingleKnownHostProvider</a>: One host key can be setuped</li>
+		       <li> <a
+		       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">FileKnownHostProvider</a>:
+		       Load known hosts keys from a openssh's ~/.ssh/known_hosts
+		       like stream</li>
+		       <li> <a
+		       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.html">StreamKnownHostProvider</a>:
+		       Load known hosts keys from ~/.ssh/known_hosts (you can
+		       set another location)</li>
+
+		     </ul>
+	           </p>
+	       </td>
+	    </tr>
+	    <tr>
+	       <td><a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/HostCheckingEnum.html">Host Checking</a></td> 
+	       <td>Ask (type safe enum)</td>
+	       <td>The policy with the hosts keys:
+	           <ul>
+		     <li><strong>Yes:</strong> Check host keys. If the incoming 
+		         key is not available in the Known Hosts Provider
+			 fails</li>
+		     <li><strong>Ask:</strong> If the incoming key is not
+		         available in the Known Hosts Provider it ask the user
+ 		         if the fingerprint is trusted</li>
+		     <li><strong>No:</strong> don't check host keys at all.
+		           pretty unsafe!!</li>
+		     
+		   </ul>
+	       </td>
+	    </tr>
+	    <tr>
+	       <td><a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.html">Interactive User Info</a></td> 
+	       <td><a
+	       href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">ConsoleInteractiveUserInfo</a></td>
+	       <td>If the user choose <em>Ask</em> as <em>Host Checking</em>, this
+	       bean is used to interact with the user
+	         <p>Some implementations:
+		     <ul>
+		       <li> <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullInteractiveUserInfo.html">NullInteractiveUserInfo</a> </li>
+		       <li> <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">ConsoleInteractiveUserInfo</a> </li>
+		     </ul>
+	        </p>
+
+	       </td>
+	    </tr>
+
+	 </table>
+	 <strong>TODO</strong>
+	 Autogenerate some of this information with a xdoclet2 plugin?
       </p>
     </section>
   </body>



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message