Configuring Security

The SSHD server needs to be integrated and the security layer has to be customized to suit your needs. This layer is pluggable and use the following interfaces:

Those custom classes can be configured on the SSHD server using the following code:

SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPasswordAuthenticator(<SPAN class="code-keyword">new</SPAN> MyPasswordAuthenticator());
sshd.setPublickeyAuthenticator(<SPAN class="code-keyword">new</SPAN> MyPublickeyAuthenticator());

If only one of those class is implemented, only the related authentication mechanism will be enabled.

JAAS integration

SSHD provides a password based authentication that delegates to JAAS. This can be configured in the following way:

SshServer sshd = SshServer.setUpDefaultServer();
JaasPasswordAuthenticator pswdAuth = <SPAN class="code-keyword">new</SPAN> JaasPasswordAuthenticator();
pswdAuth.setDomain(<SPAN class="code-quote">&quot;myJaasDomain&quot;</SPAN>);
sshd.setPasswordAuthenticator(pswdAuth);

The domain name must be set to the JAAS domain that will be used for authentication.