You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2015/06/30 15:34:19 UTC

[3/3] mina-sshd git commit: [SSHD-510] Expose default singleton factories used to configure client/server

[SSHD-510] Expose default singleton factories used to configure client/server


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/82791d41
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/82791d41
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/82791d41

Branch: refs/heads/master
Commit: 82791d41b6b634d0a908d35004ae2227756f565d
Parents: 6a4d5ff
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Tue Jun 30 16:34:04 2015 +0300
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Tue Jun 30 16:34:04 2015 +0300

----------------------------------------------------------------------
 .../agent/local/ChannelAgentForwarding.java     |  20 ---
 .../local/ChannelAgentForwardingFactory.java    |  44 +++++++
 .../sshd/agent/local/LocalAgentFactory.java     |   2 +-
 .../sshd/agent/local/ProxyAgentFactory.java     |   2 +-
 .../sshd/agent/unix/ChannelAgentForwarding.java |  34 -----
 .../unix/ChannelAgentForwardingFactory.java     |  59 +++++++++
 .../sshd/agent/unix/UnixAgentFactory.java       |   2 +-
 .../org/apache/sshd/client/ClientBuilder.java   |  17 ++-
 .../java/org/apache/sshd/client/SshClient.java  |  35 +++--
 .../auth/UserAuthKeyboardInteractive.java       |  17 ---
 .../UserAuthKeyboardInteractiveFactory.java     |  40 ++++++
 .../sshd/client/auth/UserAuthPassword.java      |  17 ---
 .../client/auth/UserAuthPasswordFactory.java    |  39 ++++++
 .../sshd/client/auth/UserAuthPublicKey.java     |  18 ---
 .../client/auth/UserAuthPublicKeyFactory.java   |  40 ++++++
 .../client/session/ClientConnectionService.java |  20 ---
 .../session/ClientConnectionServiceFactory.java |  46 +++++++
 .../client/session/ClientUserAuthService.java   |  19 ---
 .../session/ClientUserAuthServiceFactory.java   |  46 +++++++
 .../org/apache/sshd/common/BaseBuilder.java     |  23 ++--
 .../file/nativefs/NativeFileSystemFactory.java  |   2 +
 .../sshd/server/PasswordAuthenticator.java      |  87 -------------
 .../sshd/server/PublickeyAuthenticator.java     | 130 -------------------
 .../org/apache/sshd/server/ServerBuilder.java   |  42 ++++--
 .../sshd/server/ServerFactoryManager.java       |   2 +
 .../java/org/apache/sshd/server/SshServer.java  |  72 +++++-----
 .../auth/CachingPublicKeyAuthenticator.java     |   2 +-
 .../auth/UserAuthKeyboardInteractive.java       |  20 +--
 .../UserAuthKeyboardInteractiveFactory.java     |  40 ++++++
 .../apache/sshd/server/auth/UserAuthNone.java   |  17 ---
 .../sshd/server/auth/UserAuthNoneFactory.java   |  39 ++++++
 .../sshd/server/auth/UserAuthPassword.java      |  19 +--
 .../server/auth/UserAuthPasswordFactory.java    |  39 ++++++
 .../sshd/server/auth/UserAuthPublicKey.java     |  21 +--
 .../server/auth/UserAuthPublicKeyFactory.java   |  41 ++++++
 .../sshd/server/auth/gss/UserAuthGSS.java       |  33 -----
 .../server/auth/gss/UserAuthGSSFactory.java     |  53 ++++++++
 .../AcceptAllPasswordAuthenticator.java         |  30 +++++
 .../auth/password/PasswordAuthenticator.java    |  36 +++++
 .../RejectAllPasswordAuthenticator.java         |  30 +++++
 .../password/StaticPasswordAuthenticator.java   |  47 +++++++
 .../pubkey/AcceptAllPublickeyAuthenticator.java |  30 +++++
 .../pubkey/KeySetPublickeyAuthenticator.java    |  65 ++++++++++
 .../auth/pubkey/PublickeyAuthenticator.java     |  41 ++++++
 .../pubkey/RejectAllPublickeyAuthenticator.java |  30 +++++
 .../pubkey/StaticPublickeyAuthenticator.java    |  51 ++++++++
 .../sshd/server/channel/ChannelSession.java     |  19 ---
 .../server/channel/ChannelSessionFactory.java   |  43 ++++++
 .../server/config/keys/AuthorizedKeyEntry.java  |   8 +-
 .../keys/AuthorizedKeysAuthenticator.java       |   7 +-
 .../forward/AcceptAllForwardingFilter.java      |  30 +++++
 .../sshd/server/forward/DirectTcpipFactory.java |  32 +++++
 .../server/forward/ForwardedTcpipFactory.java   |  32 +++++
 .../sshd/server/forward/ForwardingFilter.java   |  77 -----------
 .../forward/RejectAllForwardingFilter.java      |  30 +++++
 .../forward/StaticDecisionForwardingFilter.java |  77 +++++++++++
 .../sshd/server/forward/TcpipServerChannel.java |  16 ---
 .../server/jaas/JaasPasswordAuthenticator.java  |   2 +-
 .../server/session/ServerConnectionService.java |  16 ---
 .../session/ServerConnectionServiceFactory.java |  46 +++++++
 .../server/session/ServerUserAuthService.java   |  15 ---
 .../session/ServerUserAuthServiceFactory.java   |  46 +++++++
 .../shell/InteractiveProcessShellFactory.java   |  64 +++++++++
 .../sshd/server/shell/ProcessShellFactory.java  |  11 +-
 .../org/apache/sshd/AuthenticationTest.java     |  12 +-
 .../java/org/apache/sshd/KeepAliveTest.java     |   2 +-
 .../org/apache/sshd/PortForwardingLoadTest.java |   4 +-
 .../org/apache/sshd/PortForwardingTest.java     |   6 +-
 .../test/java/org/apache/sshd/ProxyTest.java    |   6 +-
 .../apache/sshd/SinglePublicKeyAuthTest.java    |   4 +-
 .../java/org/apache/sshd/SpringConfigTest.java  |  88 -------------
 .../java/org/apache/sshd/WelcomeBannerTest.java |   2 +-
 .../test/java/org/apache/sshd/WindowTest.java   |  41 +++---
 .../java/org/apache/sshd/agent/AgentTest.java   |   8 +-
 .../java/org/apache/sshd/client/ClientTest.java |  47 +++----
 .../client/session/ClientSessionImplTest.java   |   4 +-
 .../sshd/common/ForwardingFilterTest.java       |   8 +-
 .../apache/sshd/deprecated/UserAuthAgent.java   |   2 +-
 .../sshd/deprecated/UserAuthPublicKey.java      |   2 +-
 .../sshd/server/PasswordAuthenticatorTest.java  |   9 +-
 .../sshd/server/PublickeyAuthenticatorTest.java |   9 +-
 .../java/org/apache/sshd/server/ServerTest.java |   6 +-
 .../config/keys/AuthorizedKeyEntryTest.java     |   2 +-
 .../keys/AuthorizedKeysAuthenticatorTest.java   |   2 +-
 .../DefaultAuthorizedKeysAuthenticatorTest.java |   2 +-
 .../apache/sshd/spring/SpringConfigTest.java    |  94 ++++++++++++++
 .../sshd/util/BogusPasswordAuthenticator.java   |   2 +-
 .../org/apache/sshd/spring/SpringConfigTest.xml |  43 ++++++
 sshd-core/src/test/resources/spring.xml         |  97 --------------
 .../git/util/BogusPasswordAuthenticator.java    |   2 +-
 90 files changed, 1667 insertions(+), 967 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
index a59d7d2..c5c39ec 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
@@ -26,8 +26,6 @@ import org.apache.sshd.agent.common.AbstractAgentClient;
 import org.apache.sshd.client.future.DefaultOpenFuture;
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.SshConstants;
-import org.apache.sshd.common.channel.Channel;
-import org.apache.sshd.common.channel.ChannelFactory;
 import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.future.CloseFuture;
 import org.apache.sshd.common.future.SshFutureListener;
@@ -40,24 +38,6 @@ import org.apache.sshd.server.channel.AbstractServerChannel;
  */
 public class ChannelAgentForwarding extends AbstractServerChannel {
 
-    public static class ChannelAgentForwardingFactory implements ChannelFactory {
-        public static final ChannelAgentForwardingFactory INSTANCE = new ChannelAgentForwardingFactory();
-
-        public ChannelAgentForwardingFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "auth-agent@openssh.com";
-        }
-
-        @Override
-        public Channel create() {
-            return new ChannelAgentForwarding();
-        }
-    }
-
     private String authSocket;
     private long pool;
     private long handle;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwardingFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwardingFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwardingFactory.java
new file mode 100644
index 0000000..38f6c51
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwardingFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.agent.local;
+
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.channel.ChannelFactory;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ChannelAgentForwardingFactory implements ChannelFactory {
+    public static final ChannelAgentForwardingFactory INSTANCE = new ChannelAgentForwardingFactory();
+
+    public ChannelAgentForwardingFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "auth-agent@openssh.com";
+    }
+
+    @Override
+    public Channel create() {
+        return new ChannelAgentForwarding();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/local/LocalAgentFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/LocalAgentFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/LocalAgentFactory.java
index 14eabd2..f2d15d0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/LocalAgentFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/LocalAgentFactory.java
@@ -47,7 +47,7 @@ public class LocalAgentFactory implements SshAgentFactory {
 
     @Override
     public NamedFactory<Channel> getChannelForwardingFactory() {
-        return ChannelAgentForwarding.ChannelAgentForwardingFactory.INSTANCE;
+        return ChannelAgentForwardingFactory.INSTANCE;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
index 11d30ef..1955cd5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
@@ -45,7 +45,7 @@ public class ProxyAgentFactory implements SshAgentFactory {
 
     @Override
     public NamedFactory<Channel> getChannelForwardingFactory() {
-        return ChannelAgentForwarding.ChannelAgentForwardingFactory.INSTANCE;
+        return ChannelAgentForwardingFactory.INSTANCE;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
index 6cfc81a..9d80455 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
@@ -29,14 +29,11 @@ import org.apache.sshd.client.future.DefaultOpenFuture;
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.FactoryManagerUtils;
 import org.apache.sshd.common.SshConstants;
-import org.apache.sshd.common.channel.Channel;
-import org.apache.sshd.common.channel.ChannelFactory;
 import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.future.CloseFuture;
 import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.channel.AbstractServerChannel;
 import org.apache.tomcat.jni.Local;
@@ -49,37 +46,6 @@ import org.apache.tomcat.jni.Status;
  */
 public class ChannelAgentForwarding extends AbstractServerChannel {
 
-    public static class ChannelAgentForwardingFactory implements ChannelFactory, ExecutorServiceCarrier {
-        public static final ChannelAgentForwardingFactory INSTANCE = new ChannelAgentForwardingFactory();
-        
-        public ChannelAgentForwardingFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "auth-agent@openssh.com";
-        }
-
-        @Override   // user can override to provide an alternative
-        public ExecutorService getExecutorService() {
-            return null;
-        }
-
-        @Override
-        public boolean isShutdownOnExit() {
-            return false;
-        }
-
-        @Override
-        public Channel create() {
-            ChannelAgentForwarding  channel = new ChannelAgentForwarding();
-            channel.setExecutorService(getExecutorService());
-            channel.setShutdownOnExit(isShutdownOnExit());
-            return channel;
-        }
-    }
-
     private String authSocket;
     private long pool;
     private long handle;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
new file mode 100644
index 0000000..4b21ac3
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.agent.unix;
+
+import java.util.concurrent.ExecutorService;
+
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.channel.ChannelFactory;
+import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ChannelAgentForwardingFactory implements ChannelFactory, ExecutorServiceCarrier {
+    public static final ChannelAgentForwardingFactory INSTANCE = new ChannelAgentForwardingFactory();
+    
+    public ChannelAgentForwardingFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "auth-agent@openssh.com";
+    }
+
+    @Override   // user can override to provide an alternative
+    public ExecutorService getExecutorService() {
+        return null;
+    }
+
+    @Override
+    public boolean isShutdownOnExit() {
+        return false;
+    }
+
+    @Override
+    public Channel create() {
+        ChannelAgentForwarding  channel = new ChannelAgentForwarding();
+        channel.setExecutorService(getExecutorService());
+        channel.setShutdownOnExit(isShutdownOnExit());
+        return channel;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
index e2c9ea5..bc8dfaa 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
@@ -39,7 +39,7 @@ import org.apache.sshd.server.session.ServerSession;
 public class UnixAgentFactory implements SshAgentFactory, ExecutorServiceConfigurer {
     private ExecutorService executor;
     private boolean shutdownExecutor;
-    private final NamedFactory<Channel> factory = new ChannelAgentForwarding.ChannelAgentForwardingFactory() {
+    private final NamedFactory<Channel> factory = new ChannelAgentForwardingFactory() {
             @Override
             public ExecutorService getExecutorService() {
                 return UnixAgentFactory.this.getExecutorService();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
index 1ab0d28..435ec11 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
@@ -20,6 +20,7 @@
 package org.apache.sshd.client;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.sshd.client.kex.DHGClient;
@@ -32,7 +33,7 @@ import org.apache.sshd.common.kex.BuiltinDHFactories;
 import org.apache.sshd.common.kex.DHFactory;
 import org.apache.sshd.common.kex.KeyExchange;
 import org.apache.sshd.common.util.Transformer;
-import org.apache.sshd.server.forward.TcpipServerChannel;
+import org.apache.sshd.server.forward.ForwardedTcpipFactory;
 
 /**
  * SshClient builder
@@ -62,22 +63,30 @@ public class ClientBuilder extends BaseBuilder<SshClient, ClientBuilder> {
         return me();
     }
 
+    public static final List<NamedFactory<Channel>> DEFAULT_CHANNEL_FACTORIES =
+            Collections.unmodifiableList(Arrays.<NamedFactory<Channel>>asList(ForwardedTcpipFactory.INSTANCE));
+    public static final ServerKeyVerifier DEFAULT_SERVER_KEY_VERIFIER = AcceptAllServerKeyVerifier.INSTANCE;
+
     @Override
     protected ClientBuilder fillWithDefaultValues() {
         super.fillWithDefaultValues();
+
         if (keyExchangeFactories == null) {
             keyExchangeFactories = setUpDefaultKeyExchanges(false);
         }
+
         if (channelFactories == null) {
-            channelFactories = Arrays.<NamedFactory<Channel>>asList(
-                    TcpipServerChannel.ForwardedTcpipFactory.INSTANCE);
+            channelFactories = DEFAULT_CHANNEL_FACTORIES;
         }
+
         if (serverKeyVerifier == null) {
-            serverKeyVerifier = AcceptAllServerKeyVerifier.INSTANCE;
+            serverKeyVerifier = DEFAULT_SERVER_KEY_VERIFIER;
         }
+
         if (factory == null) {
             factory = SshClient.DEFAULT_SSH_CLIENT_FACTORY;
         }
+
         return me();
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
index 659e718..fca2412 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
@@ -27,6 +27,7 @@ import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -40,22 +41,23 @@ import java.util.logging.Logger;
 
 import org.apache.sshd.agent.SshAgentFactory;
 import org.apache.sshd.client.auth.UserAuth;
-import org.apache.sshd.client.auth.UserAuthKeyboardInteractive;
-import org.apache.sshd.client.auth.UserAuthPassword;
-import org.apache.sshd.client.auth.UserAuthPublicKey;
+import org.apache.sshd.client.auth.UserAuthKeyboardInteractiveFactory;
+import org.apache.sshd.client.auth.UserAuthPasswordFactory;
+import org.apache.sshd.client.auth.UserAuthPublicKeyFactory;
 import org.apache.sshd.client.auth.UserInteraction;
 import org.apache.sshd.client.channel.ChannelShell;
 import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.config.keys.ClientIdentity;
 import org.apache.sshd.client.future.ConnectFuture;
 import org.apache.sshd.client.future.DefaultConnectFuture;
-import org.apache.sshd.client.session.ClientConnectionService;
+import org.apache.sshd.client.session.ClientConnectionServiceFactory;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.client.session.ClientUserAuthService;
+import org.apache.sshd.client.session.ClientUserAuthServiceFactory;
 import org.apache.sshd.common.AbstractFactoryManager;
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.SshdSocketAddress;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.config.SshConfigFileReader;
@@ -161,6 +163,18 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         this.userAuthFactories = userAuthFactories;
     }
 
+    public static final List<NamedFactory<UserAuth>> DEFAULT_USER_AUTH_FACTORIES =
+            Collections.unmodifiableList(Arrays.<NamedFactory<UserAuth>>asList(
+                    UserAuthPublicKeyFactory.INSTANCE,
+                    UserAuthKeyboardInteractiveFactory.INSTANCE,
+                    UserAuthPasswordFactory.INSTANCE
+                ));
+    public static final List<ServiceFactory> DEFAULT_SERVICE_FACTORIES =
+            Collections.unmodifiableList(Arrays.asList(
+                    ClientUserAuthServiceFactory.INSTANCE,
+                    ClientConnectionServiceFactory.INSTANCE
+                ));
+
     @Override
     protected void checkConfig() {
         super.checkConfig();
@@ -183,18 +197,11 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         }
 
         if (GenericUtils.isEmpty(getServiceFactories())) {
-            setServiceFactories(Arrays.asList(
-                    ClientUserAuthService.ClientUserAuthServiceFactory.INSTANCE,
-                    ClientConnectionService.ClientConnectionServiceFactory.INSTANCE
-            ));
+            setServiceFactories(DEFAULT_SERVICE_FACTORIES);
         }
 
         if (GenericUtils.isEmpty(getUserAuthFactories())) {
-            setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(
-                    UserAuthPublicKey.UserAuthPublicKeyFactory.INSTANCE,
-                    UserAuthKeyboardInteractive.UserAuthKeyboardInteractiveFactory.INSTANCE,
-                    UserAuthPassword.UserAuthPasswordFactory.INSTANCE
-            ));
+            setUserAuthFactories(DEFAULT_USER_AUTH_FACTORIES);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
index 57ade35..100f0bd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
@@ -41,23 +41,6 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  */
 public class UserAuthKeyboardInteractive extends AbstractLoggingBean implements UserAuth {
 
-    public static class UserAuthKeyboardInteractiveFactory implements UserAuthFactory {
-        public static final UserAuthKeyboardInteractiveFactory INSTANCE = new UserAuthKeyboardInteractiveFactory();
-
-        public UserAuthKeyboardInteractiveFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "keyboard-interactive";
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthKeyboardInteractive();
-        }
-    }
-
     private ClientSession session;
     private String service;
     private Iterator<String> passwords;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractiveFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractiveFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractiveFactory.java
new file mode 100644
index 0000000..d2d45e1
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractiveFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.client.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthKeyboardInteractiveFactory implements UserAuthFactory {
+    public static final UserAuthKeyboardInteractiveFactory INSTANCE = new UserAuthKeyboardInteractiveFactory();
+
+    public UserAuthKeyboardInteractiveFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "keyboard-interactive";
+    }
+
+    @Override
+    public UserAuth create() {
+        return new UserAuthKeyboardInteractive();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPassword.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPassword.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPassword.java
index d0482f9..cfa9de4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPassword.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPassword.java
@@ -35,23 +35,6 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  */
 public class UserAuthPassword extends AbstractLoggingBean implements UserAuth {
 
-    public static class UserAuthPasswordFactory implements UserAuthFactory {
-        public static final UserAuthPasswordFactory INSTANCE = new UserAuthPasswordFactory();
-
-        public UserAuthPasswordFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "password";
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthPassword();
-        }
-    }
-
     private ClientSession session;
     private String service;
     private Iterator<String> passwords;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPasswordFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPasswordFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPasswordFactory.java
new file mode 100644
index 0000000..43c6db9
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPasswordFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.client.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthPasswordFactory implements UserAuthFactory {
+    public static final UserAuthPasswordFactory INSTANCE = new UserAuthPasswordFactory();
+
+    public UserAuthPasswordFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "password";
+    }
+    @Override
+    public UserAuth create() {
+        return new UserAuthPassword();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKey.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKey.java
index e737d57..7fb9954 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKey.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKey.java
@@ -48,24 +48,6 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  */
 public class UserAuthPublicKey extends AbstractLoggingBean implements UserAuth {
 
-    public static class UserAuthPublicKeyFactory implements UserAuthFactory {
-        public static final String NAME = "publickey";
-        public static final UserAuthPublicKeyFactory INSTANCE = new UserAuthPublicKeyFactory();
-
-        public UserAuthPublicKeyFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return NAME;
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthPublicKey();
-        }
-    }
-
     private ClientSession session;
     private String service;
     private SshAgent agent;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKeyFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKeyFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKeyFactory.java
new file mode 100644
index 0000000..be3e278
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthPublicKeyFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.client.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthPublicKeyFactory implements UserAuthFactory {
+    public static final String NAME = "publickey";
+    public static final UserAuthPublicKeyFactory INSTANCE = new UserAuthPublicKeyFactory();
+
+    public UserAuthPublicKeyFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+    @Override
+    public UserAuth create() {
+        return new UserAuthPublicKey();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
index 38bd7be..8c37579 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
@@ -25,8 +25,6 @@ import java.util.concurrent.TimeUnit;
 import org.apache.sshd.client.ClientFactoryManager;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.FactoryManagerUtils;
-import org.apache.sshd.common.Service;
-import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.session.AbstractConnectionService;
@@ -41,24 +39,6 @@ import org.apache.sshd.common.util.buffer.Buffer;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class ClientConnectionService extends AbstractConnectionService {
-    public static class ClientConnectionServiceFactory implements ServiceFactory {
-        public static final ClientConnectionServiceFactory INSTANCE = new ClientConnectionServiceFactory();
-
-        public ClientConnectionServiceFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "ssh-connection";
-        }
-
-        @Override
-        public Service create(Session session) throws IOException {
-            return new ClientConnectionService(session);
-        }
-    }
-
     public ClientConnectionService(Session s) throws SshException {
         super(s);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
new file mode 100644
index 0000000..d91f93d
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.client.session;
+
+import java.io.IOException;
+
+import org.apache.sshd.common.Service;
+import org.apache.sshd.common.ServiceFactory;
+import org.apache.sshd.common.session.Session;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ClientConnectionServiceFactory implements ServiceFactory {
+    public static final ClientConnectionServiceFactory INSTANCE = new ClientConnectionServiceFactory();
+
+    public ClientConnectionServiceFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "ssh-connection";
+    }
+
+    @Override
+    public Service create(Session session) throws IOException {
+        return new ClientConnectionService(session);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
index fbd6afa..c32fc8d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
@@ -32,7 +32,6 @@ import org.apache.sshd.common.FactoryManagerUtils;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.Service;
-import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.session.Session;
@@ -47,24 +46,6 @@ import org.apache.sshd.common.util.buffer.Buffer;
  */
 public class ClientUserAuthService extends CloseableUtils.AbstractCloseable implements Service {
 
-    public static class ClientUserAuthServiceFactory implements ServiceFactory {
-        public static final ClientUserAuthServiceFactory INSTANCE = new ClientUserAuthServiceFactory();
-
-        public ClientUserAuthServiceFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "ssh-userauth";
-        }
-
-        @Override
-        public Service create(Session session) throws IOException {
-            return new ClientUserAuthService(session);
-        }
-    }
-
     /**
      * The AuthFuture that is being used by the current auth request.  This encodes the state.
      * isSuccess -> authenticated, else if isDone -> server waiting for user auth, else authenticating.

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthServiceFactory.java
new file mode 100644
index 0000000..65a85c3
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthServiceFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.client.session;
+
+import java.io.IOException;
+
+import org.apache.sshd.common.Service;
+import org.apache.sshd.common.ServiceFactory;
+import org.apache.sshd.common.session.Session;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ClientUserAuthServiceFactory implements ServiceFactory {
+    public static final ClientUserAuthServiceFactory INSTANCE = new ClientUserAuthServiceFactory();
+
+    public ClientUserAuthServiceFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "ssh-userauth";
+    }
+
+    @Override
+    public Service create(Session session) throws IOException {
+        return new ClientUserAuthService(session);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
index 09e62b3..9f16618 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
@@ -45,6 +45,7 @@ import org.apache.sshd.common.signature.Signature;
 import org.apache.sshd.common.util.ObjectBuilder;
 import org.apache.sshd.common.util.SecurityUtils;
 import org.apache.sshd.server.forward.ForwardingFilter;
+import org.apache.sshd.server.forward.RejectAllForwardingFilter;
 
 /**
  * Base class for dedicated client/server instance builders
@@ -68,6 +69,13 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
         super();
     }
 
+    // Compression is not enabled by default
+    public static final List<NamedFactory<Compression>> DEFAULT_COMPRESSION_FACTORIES =
+            Collections.unmodifiableList(Arrays.<NamedFactory<Compression>>asList(BuiltinCompressions.none));
+    public static final FileSystemFactory DEFAULT_FILE_SYSTEM_FACTORY = NativeFileSystemFactory.INSTANCE;
+    public static final ForwardingFilter DEFAULT_FORWARDING_FILTER = RejectAllForwardingFilter.INSTANCE;
+    public static final TcpipForwarderFactory DEFAULT_FORWARDER_FACTORY = DefaultTcpipForwarderFactory.INSTANCE;
+
     protected S fillWithDefaultValues() {
         if (signatureFactories == null) {
             signatureFactories = setUpDefaultSignatures(false);
@@ -81,15 +89,8 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
             cipherFactories = setUpDefaultCiphers(false);
         }
 
-        // Compression is not enabled by default
-        //if (compressionFactories == null) {
-        //    compressionFactories = Arrays.<NamedFactory<Compression>>asList(
-        //            new CompressionNone.Factory(),
-        //            new CompressionZlib.Factory(),
-        //            new CompressionDelayedZlib.Factory());
-        //}
         if (compressionFactories == null) {
-            compressionFactories = Arrays.<NamedFactory<Compression>>asList(BuiltinCompressions.none);
+            compressionFactories = DEFAULT_COMPRESSION_FACTORIES;
         }
 
         if (macFactories == null) {
@@ -97,15 +98,15 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
         }
 
         if (fileSystemFactory == null) {
-            fileSystemFactory = new NativeFileSystemFactory();
+            fileSystemFactory = DEFAULT_FILE_SYSTEM_FACTORY;
         }
 
         if (forwardingFilter == null) {
-            forwardingFilter = ForwardingFilter.RejectAllForwardingFilter.INSTANCE;
+            forwardingFilter = DEFAULT_FORWARDING_FILTER;
         }
 
         if (tcpipForwarderFactory == null) {
-            tcpipForwarderFactory = DefaultTcpipForwarderFactory.INSTANCE;
+            tcpipForwarderFactory = DEFAULT_FORWARDER_FACTORY;
         }
 
         return me();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemFactory.java
index 61cfff0..53ae321 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemFactory.java
@@ -33,6 +33,8 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class NativeFileSystemFactory extends AbstractLoggingBean implements FileSystemFactory {
+    public static final NativeFileSystemFactory INSTANCE = new NativeFileSystemFactory();
+
     private boolean createHome;
 
     public NativeFileSystemFactory() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/PasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/PasswordAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/PasswordAuthenticator.java
deleted file mode 100644
index 9164e07..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/server/PasswordAuthenticator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF 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 org.apache.sshd.server;
-
-import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.server.session.ServerSession;
-
-/**
- * The <code>PasswordAuthenticator</code> is used to authenticate
- * users based on a password.
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public interface PasswordAuthenticator {
-
-    /**
-     * Check the validity of a password.
-     * @param username the username
-     * @param password the password
-     * @param session the server session
-     * @return a boolean indicating if authentication succeeded or not
-     */
-    boolean authenticate(String username, String password, ServerSession session);
-
-    /**
-     * Returns the same constant result {@code true/false} regardless
-     */
-    public static abstract class StaticPasswordAuthenticator extends AbstractLoggingBean implements PasswordAuthenticator {
-        private final boolean   acceptance;
-
-        protected StaticPasswordAuthenticator(boolean acceptance) {
-            this.acceptance = acceptance;
-        }
-
-        public final boolean isAccepted() {
-            return acceptance;
-        }
-
-        @Override
-        public final boolean authenticate(String username, String password, ServerSession session) {
-            boolean accepted = isAccepted();
-            if (log.isDebugEnabled()) {
-                log.debug("authenticate({}[{}]: {}", username, session, Boolean.valueOf(accepted));
-            }
-            
-            return accepted;
-        }
-    }
-
-    /**
-     * Accepts all authentication attempts
-     */
-    public static final class AcceptAllPasswordAuthenticator extends StaticPasswordAuthenticator {
-        public static final AcceptAllPasswordAuthenticator INSTANCE = new AcceptAllPasswordAuthenticator();
-
-        private AcceptAllPasswordAuthenticator() {
-            super(true);
-        }
-    }
-
-    /**
-     * Rejects all authentication attempts
-     */
-    public static final class RejectAllPasswordAuthenticator extends StaticPasswordAuthenticator {
-        public static final RejectAllPasswordAuthenticator INSTANCE = new RejectAllPasswordAuthenticator();
-
-        private RejectAllPasswordAuthenticator() {
-            super(false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/PublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/PublickeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/PublickeyAuthenticator.java
deleted file mode 100644
index b924bb2..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/server/PublickeyAuthenticator.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF 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 org.apache.sshd.server;
-
-import java.security.PublicKey;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.server.session.ServerSession;
-
-/**
- * The <code>PublickeyAuthenticator</code> is used on the server side
- * to authenticate user public keys.
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public interface PublickeyAuthenticator {
-
-    /**
-     * Check the validity of a public key.
-     * @param username the username
-     * @param key the key
-     * @param session the server session
-     * @return a boolean indicating if authentication succeeded or not
-     */
-    boolean authenticate(String username, PublicKey key, ServerSession session);
-
-    /**
-     * Checks against a {@link Collection} of {@link PublicKey}s
-     */
-    public static class KeySetPublickeyAuthenticator extends AbstractLoggingBean implements PublickeyAuthenticator {
-        private final Collection<? extends PublicKey> keySet;
-
-        public KeySetPublickeyAuthenticator(Collection<? extends PublicKey> keySet) {
-            this.keySet = (keySet == null) ? Collections.<PublicKey>emptyList() : keySet;
-        }
-
-        public final Collection<? extends PublicKey> getKeySet() {
-            return keySet;
-        }
-
-        @Override
-        public boolean authenticate(String username, PublicKey key, ServerSession session) {
-            return authenticate(username, key, session, getKeySet());
-        }
-        
-        public boolean authenticate(String username, PublicKey key, ServerSession session, Collection<? extends PublicKey> keys) {
-            if (GenericUtils.isEmpty(keys)) {
-                if (log.isDebugEnabled()) {
-                    log.debug("authenticate(" + username + ")[" + session + "] no keys");
-                }
-                
-                return false;
-            }
-            
-            PublicKey matchKey = KeyUtils.findMatchingKey(key, keys);
-            boolean matchFound = (matchKey != null);
-            if (log.isDebugEnabled()) {
-                log.debug("authenticate(" + username + ")[" + session + "] match found=" + matchFound);
-            }
-            return matchFound;
-        }
-    }
-    /**
-     * Returns the same constant result {@code true/false} regardless
-     */
-    public static abstract class StaticPublickeyAuthenticator extends AbstractLoggingBean implements PublickeyAuthenticator {
-        private final boolean   acceptance;
-
-        protected StaticPublickeyAuthenticator(boolean acceptance) {
-            this.acceptance = acceptance;
-        }
-
-        public final boolean isAccepted() {
-            return acceptance;
-        }
-
-        @Override
-        public final boolean authenticate(String username, PublicKey key, ServerSession session) {
-            boolean accepted = isAccepted();
-            if (log.isDebugEnabled()) {
-                log.debug("authenticate({}[{}][{}][{}]: {}",
-                          username, session, key.getAlgorithm(), KeyUtils.getFingerPrint(key), Boolean.valueOf(accepted));
-            }
-
-            return accepted;
-        }
-    }
-
-    /**
-     * Accepts all authentication attempts
-     */
-    public static final class AcceptAllPublickeyAuthenticator extends StaticPublickeyAuthenticator {
-        public static final AcceptAllPublickeyAuthenticator INSTANCE = new AcceptAllPublickeyAuthenticator();
-
-        private AcceptAllPublickeyAuthenticator() {
-            super(true);
-        }
-    }
-
-    /**
-     * Rejects all authentication attempts
-     */
-    public static final class RejectAllPublickeyAuthenticator extends StaticPublickeyAuthenticator {
-        public static final RejectAllPublickeyAuthenticator INSTANCE = new RejectAllPublickeyAuthenticator();
-
-        private RejectAllPublickeyAuthenticator() {
-            super(false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
index 1bc8d1b..0e60bc5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
@@ -20,6 +20,7 @@
 package org.apache.sshd.server;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.sshd.common.BaseBuilder;
@@ -31,9 +32,10 @@ import org.apache.sshd.common.kex.DHFactory;
 import org.apache.sshd.common.kex.KeyExchange;
 import org.apache.sshd.common.session.ConnectionService;
 import org.apache.sshd.common.util.Transformer;
-import org.apache.sshd.server.channel.ChannelSession;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
+import org.apache.sshd.server.channel.ChannelSessionFactory;
 import org.apache.sshd.server.config.keys.DefaultAuthorizedKeysAuthenticator;
-import org.apache.sshd.server.forward.TcpipServerChannel;
+import org.apache.sshd.server.forward.DirectTcpipFactory;
 import org.apache.sshd.server.global.CancelTcpipForwardHandler;
 import org.apache.sshd.server.global.KeepAliveHandler;
 import org.apache.sshd.server.global.NoMoreSessionsHandler;
@@ -70,32 +72,44 @@ public class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
         return this;
     }
 
+    public static final List<NamedFactory<Channel>> DEFAULT_CHANNEL_FACTORIES =
+            Collections.unmodifiableList(Arrays.<NamedFactory<Channel>>asList(
+                    ChannelSessionFactory.INSTANCE,
+                    DirectTcpipFactory.INSTANCE
+                ));
+    public static final List<RequestHandler<ConnectionService>> DEFAULT_GLOBAL_REQUEST_HANDLERS =
+            Collections.unmodifiableList(Arrays.<RequestHandler<ConnectionService>>asList(
+                    KeepAliveHandler.INSTANCE,
+                    NoMoreSessionsHandler.INSTANCE,
+                    TcpipForwardHandler.INSTANCE,
+                    CancelTcpipForwardHandler.INSTANCE
+                ));
+    public static final PublickeyAuthenticator DEFAULT_PUBLIC_KEY_AUTHENTICATOR = DefaultAuthorizedKeysAuthenticator.INSTANCE;
+
     @Override
     protected ServerBuilder fillWithDefaultValues() {
         super.fillWithDefaultValues();
+
         if (keyExchangeFactories == null) {
             keyExchangeFactories = setUpDefaultKeyExchanges(false);
         }
+
         if (channelFactories == null) {
-            channelFactories = Arrays.<NamedFactory<Channel>>asList(
-                    ChannelSession.ChannelSessionFactory.INSTANCE,
-                    TcpipServerChannel.DirectTcpipFactory.INSTANCE);
+            channelFactories = DEFAULT_CHANNEL_FACTORIES;
         }
+
         if (globalRequestHandlers == null) {
-            globalRequestHandlers = Arrays.<RequestHandler<ConnectionService>>asList(
-                    KeepAliveHandler.INSTANCE,
-                    NoMoreSessionsHandler.INSTANCE,
-                    TcpipForwardHandler.INSTANCE,
-                    CancelTcpipForwardHandler.INSTANCE);
+            globalRequestHandlers = DEFAULT_GLOBAL_REQUEST_HANDLERS;
+        }
+
+        if (pubkeyAuthenticator == null) {
+            pubkeyAuthenticator = DEFAULT_PUBLIC_KEY_AUTHENTICATOR;
         }
+
         if (factory == null) {
             factory = SshServer.DEFAULT_SSH_SERVER_FACTORY;
         }
         
-        if (pubkeyAuthenticator == null) {
-            pubkeyAuthenticator = DefaultAuthorizedKeysAuthenticator.INSTANCE;
-        }
-
         return me();
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
index bf9b634..4e3c4f3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
@@ -25,6 +25,8 @@ import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.server.auth.UserAuth;
 import org.apache.sshd.server.auth.gss.GSSAuthenticator;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 
 /**
  * The <code>ServerFactoryManager</code> enable the retrieval of additional

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
index 340770d..85f5d6d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
@@ -24,6 +24,7 @@ import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -34,6 +35,7 @@ import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManagerUtils;
 import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.io.IoAcceptor;
 import org.apache.sshd.common.io.IoServiceFactory;
 import org.apache.sshd.common.io.IoSession;
@@ -45,19 +47,24 @@ import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.common.util.SecurityUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.server.auth.UserAuth;
-import org.apache.sshd.server.auth.UserAuthKeyboardInteractive;
-import org.apache.sshd.server.auth.UserAuthPassword;
-import org.apache.sshd.server.auth.UserAuthPublicKey;
+import org.apache.sshd.server.auth.UserAuthKeyboardInteractiveFactory;
+import org.apache.sshd.server.auth.UserAuthPasswordFactory;
+import org.apache.sshd.server.auth.UserAuthPublicKeyFactory;
 import org.apache.sshd.server.auth.gss.GSSAuthenticator;
-import org.apache.sshd.server.auth.gss.UserAuthGSS;
+import org.apache.sshd.server.auth.gss.UserAuthGSSFactory;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
+import org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 import org.apache.sshd.server.command.ScpCommandFactory;
+import org.apache.sshd.server.forward.AcceptAllForwardingFilter;
 import org.apache.sshd.server.forward.ForwardingFilter;
 import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
-import org.apache.sshd.server.session.ServerConnectionService;
+import org.apache.sshd.server.session.ServerConnectionServiceFactory;
 import org.apache.sshd.server.session.ServerSession;
-import org.apache.sshd.server.session.ServerUserAuthService;
+import org.apache.sshd.server.session.ServerUserAuthServiceFactory;
 import org.apache.sshd.server.session.SessionFactory;
 import org.apache.sshd.server.sftp.SftpSubsystemFactory;
+import org.apache.sshd.server.shell.InteractiveProcessShellFactory;
 import org.apache.sshd.server.shell.ProcessShellFactory;
 
 /**
@@ -205,8 +212,22 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
         this.tcpipForwardingFilter = forwardingFilter;
     }
 
+    public static final List<ServiceFactory> DEFAULT_SERVICE_FACTORIES =
+            Collections.unmodifiableList(Arrays.asList(
+                    ServerUserAuthServiceFactory.INSTANCE,
+                    ServerConnectionServiceFactory.INSTANCE
+            ));
+    public static final UserAuthPublicKeyFactory DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY =
+            UserAuthPublicKeyFactory.INSTANCE;
+    public static final UserAuthGSSFactory DEFAULT_USER_AUTH_GSS_FACTORY =
+            UserAuthGSSFactory.INSTANCE;
+    public static final UserAuthPasswordFactory DEFAULT_USER_AUTH_PASSWORD_FACTORY =
+            UserAuthPasswordFactory.INSTANCE;
+    public static final UserAuthKeyboardInteractiveFactory DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY =
+            UserAuthKeyboardInteractiveFactory.INSTANCE;
+
     @Override
-    protected void checkConfig() {
+    protected void checkConfig() { 
         super.checkConfig();
 
         ValidateUtils.checkTrue(getPort() >= 0 /* zero means not set yet */, "Bad port number: %d", Integer.valueOf(getPort()));
@@ -214,14 +235,16 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
         if (GenericUtils.isEmpty(getUserAuthFactories())) {
             List<NamedFactory<UserAuth>> factories = new ArrayList<NamedFactory<UserAuth>>();
             if (getPasswordAuthenticator() != null) {
-                factories.add(UserAuthPassword.UserAuthPasswordFactory.INSTANCE);
-                factories.add(UserAuthKeyboardInteractive.UserAuthKeyboardInteractiveFactory.INSTANCE);
+                factories.add(DEFAULT_USER_AUTH_PASSWORD_FACTORY);
+                factories.add(DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY);
             }
+
             if (getPublickeyAuthenticator() != null) {
-                factories.add(UserAuthPublicKey.UserAuthPublicKeyFactory.INSTANCE);
+                factories.add(DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY);
             }
+
             if (getGSSAuthenticator() != null) {
-              factories.add(UserAuthGSS.UserAuthGSSFactory.INSTANCE);
+                factories.add(DEFAULT_USER_AUTH_GSS_FACTORY);
             }
             
             ValidateUtils.checkTrue(factories.size() > 0, "UserAuthFactories not set", GenericUtils.EMPTY_OBJECT_ARRAY); 
@@ -233,10 +256,7 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
         ValidateUtils.checkNotNull(getFileSystemFactory(), "FileSystemFactory not set", GenericUtils.EMPTY_OBJECT_ARRAY);
 
         if (GenericUtils.isEmpty(getServiceFactories())) {
-            setServiceFactories(Arrays.asList(
-                    new ServerUserAuthService.Factory(),
-                    new ServerConnectionService.Factory()
-            ));
+            setServiceFactories(DEFAULT_SERVICE_FACTORIES);
         }
     }
 
@@ -434,21 +454,15 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
             sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("key.ser")));
         }
 
-        if (OsUtils.isUNIX()) {
-            sshd.setShellFactory(new ProcessShellFactory(new String[] { "/bin/sh", "-i", "-l" },
-                                 EnumSet.of(ProcessShellFactory.TtyOptions.ONlCr)));
-        } else {
-            sshd.setShellFactory(new ProcessShellFactory(new String[] { "cmd.exe "},
-                                 EnumSet.of(ProcessShellFactory.TtyOptions.Echo, ProcessShellFactory.TtyOptions.ICrNl, ProcessShellFactory.TtyOptions.ONlCr)));
-        }
+        sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);
         sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session) {
-                return username != null && username.equals(password);
-            }
-        });
-        sshd.setPublickeyAuthenticator(PublickeyAuthenticator.AcceptAllPublickeyAuthenticator.INSTANCE);
-        sshd.setTcpipForwardingFilter(ForwardingFilter.AcceptAllForwardingFilter.INSTANCE);
+                @Override
+                public boolean authenticate(String username, String password, ServerSession session) {
+                    return username != null && username.equals(password);
+                }
+            });
+        sshd.setPublickeyAuthenticator(AcceptAllPublickeyAuthenticator.INSTANCE);
+        sshd.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
         sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(new CommandFactory() {
             @Override
             public Command createCommand(String command) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
index c7733b4..2d736a4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.session.SessionListener;
-import org.apache.sshd.server.PublickeyAuthenticator;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 import org.apache.sshd.server.session.ServerSession;
 
 /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
index 9740771..0bd506c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
@@ -24,8 +24,8 @@ import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.server.PasswordAuthenticator;
 import org.apache.sshd.server.ServerFactoryManager;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
 import org.apache.sshd.server.session.ServerSession;
 
 /**
@@ -33,24 +33,6 @@ import org.apache.sshd.server.session.ServerSession;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class UserAuthKeyboardInteractive extends AbstractUserAuth {
-    public static class UserAuthKeyboardInteractiveFactory implements UserAuthFactory {
-        public static final UserAuthKeyboardInteractiveFactory INSTANCE = new UserAuthKeyboardInteractiveFactory();
-
-        public UserAuthKeyboardInteractiveFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "keyboard-interactive";
-        }
-
-        @Override
-        public UserAuth create() {
-            return new UserAuthKeyboardInteractive();
-        }
-    }
-
     // configuration parameters on the FactoryManager to configure the message values
     public static final String KB_INTERACTIVE_NAME_PROP = "kb-interactive-name";
         public static final String DEFAULT_KB_INTERACTIVE_NAME = "Password authentication";

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractiveFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractiveFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractiveFactory.java
new file mode 100644
index 0000000..904e6ef
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractiveFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.server.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthKeyboardInteractiveFactory implements UserAuthFactory {
+    public static final UserAuthKeyboardInteractiveFactory INSTANCE = new UserAuthKeyboardInteractiveFactory();
+
+    public UserAuthKeyboardInteractiveFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "keyboard-interactive";
+    }
+
+    @Override
+    public UserAuth create() {
+        return new UserAuthKeyboardInteractive();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNone.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNone.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNone.java
index 254f5fd..c7112b8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNone.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNone.java
@@ -27,23 +27,6 @@ import org.apache.sshd.common.util.buffer.Buffer;
  */
 public class UserAuthNone extends AbstractUserAuth {
 
-    public static class UserAuthNoneFactory implements UserAuthFactory {
-        public static final UserAuthNoneFactory INSTANCE = new UserAuthNoneFactory();
-
-        public UserAuthNoneFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "none";
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthNone();
-        }
-    }
-
     public UserAuthNone() {
         super();
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNoneFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNoneFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNoneFactory.java
new file mode 100644
index 0000000..e869a17
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthNoneFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.server.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthNoneFactory implements UserAuthFactory {
+    public static final UserAuthNoneFactory INSTANCE = new UserAuthNoneFactory();
+
+    public UserAuthNoneFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "none";
+    }
+    @Override
+    public UserAuth create() {
+        return new UserAuthNone();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
index d0fa54e..77c73b3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
@@ -21,8 +21,8 @@ package org.apache.sshd.server.auth;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.server.PasswordAuthenticator;
 import org.apache.sshd.server.ServerFactoryManager;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
 import org.apache.sshd.server.session.ServerSession;
 
 /**
@@ -32,23 +32,6 @@ import org.apache.sshd.server.session.ServerSession;
  */
 public class UserAuthPassword extends AbstractUserAuth {
 
-    public static class UserAuthPasswordFactory implements UserAuthFactory {
-        public static final UserAuthPasswordFactory INSTANCE = new UserAuthPasswordFactory();
-        
-        public UserAuthPasswordFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return "password";
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthPassword();
-        }
-    }
-
     public UserAuthPassword() {
         super();
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPasswordFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPasswordFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPasswordFactory.java
new file mode 100644
index 0000000..2eedbc4
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPasswordFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.server.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthPasswordFactory implements UserAuthFactory {
+    public static final UserAuthPasswordFactory INSTANCE = new UserAuthPasswordFactory();
+    
+    public UserAuthPasswordFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return "password";
+    }
+    @Override
+    public UserAuth create() {
+        return new UserAuthPassword();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKey.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKey.java
index 48b8c97..fcbc421 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKey.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKey.java
@@ -27,8 +27,8 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
-import org.apache.sshd.server.PublickeyAuthenticator;
 import org.apache.sshd.server.ServerFactoryManager;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 
 /**
  * TODO Add javadoc
@@ -37,25 +37,6 @@ import org.apache.sshd.server.ServerFactoryManager;
  */
 public class UserAuthPublicKey extends AbstractUserAuth {
 
-    public static class UserAuthPublicKeyFactory implements UserAuthFactory {
-        public static final String NAME = "publickey";
-
-        public static final UserAuthPublicKeyFactory INSTANCE = new UserAuthPublicKeyFactory();
-
-        public UserAuthPublicKeyFactory() {
-            super();
-        }
-
-        @Override
-        public String getName() {
-            return NAME;
-        }
-        @Override
-        public UserAuth create() {
-            return new UserAuthPublicKey();
-        }
-    }
-
     public UserAuthPublicKey() {
         super();
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKeyFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKeyFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKeyFactory.java
new file mode 100644
index 0000000..70a14c0
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPublicKeyFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.server.auth;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class UserAuthPublicKeyFactory implements UserAuthFactory {
+    public static final String NAME = "publickey";
+
+    public static final UserAuthPublicKeyFactory INSTANCE = new UserAuthPublicKeyFactory();
+
+    public UserAuthPublicKeyFactory() {
+        super();
+    }
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+    @Override
+    public UserAuth create() {
+        return new UserAuthPublicKey();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
index d5786c2..9495c34 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
@@ -26,8 +26,6 @@ import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.server.ServerFactoryManager;
 import org.apache.sshd.server.auth.AbstractUserAuth;
-import org.apache.sshd.server.auth.UserAuth;
-import org.apache.sshd.server.auth.UserAuthFactory;
 import org.apache.sshd.server.session.ServerSession;
 import org.ietf.jgss.GSSContext;
 import org.ietf.jgss.GSSCredential;
@@ -232,35 +230,4 @@ public class UserAuthGSS extends AbstractUserAuth {
             return null;
         }
     }
-
-    /**
-     * Factory class.
-     */
-    public static class UserAuthGSSFactory implements UserAuthFactory {
-        public static final UserAuthGSSFactory INSTANCE = new UserAuthGSSFactory();
-        
-        public UserAuthGSSFactory() {
-            super();
-        }
-
-        /**
-         * Get the name of the authentication method.
-         *
-         * @return Tge name, always 'gssapi-with-mic' here.
-         */
-        @Override
-        public String getName() {
-            return "gssapi-with-mic";
-        }
-
-        /**
-         * Create a new authenticator instance.
-         *
-         * @return The instance
-         */
-        @Override
-        public UserAuth create() {
-            return new UserAuthGSS();
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/82791d41/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSSFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSSFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSSFactory.java
new file mode 100644
index 0000000..bf7e252
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSSFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.sshd.server.auth.gss;
+
+import org.apache.sshd.server.auth.UserAuth;
+import org.apache.sshd.server.auth.UserAuthFactory;
+
+/**
+ * Factory class.
+ */
+public class UserAuthGSSFactory implements UserAuthFactory {
+    public static final UserAuthGSSFactory INSTANCE = new UserAuthGSSFactory();
+    
+    public UserAuthGSSFactory() {
+        super();
+    }
+
+    /**
+     * Get the name of the authentication method.
+     *
+     * @return Tge name, always 'gssapi-with-mic' here.
+     */
+    @Override
+    public String getName() {
+        return "gssapi-with-mic";
+    }
+
+    /**
+     * Create a new authenticator instance.
+     *
+     * @return The instance
+     */
+    @Override
+    public UserAuth create() {
+        return new UserAuthGSS();
+    }
+}
\ No newline at end of file