public class NoneAuthentication extends Object implements AuthenticationMechanism
This authentication mechanism can be used to send custom banner messages to the client. When an SSH client connects it sends a 'none' authentication request with the username of the connecting user, normally the Maverick SSHD will send the default banner message configured in the ConfigurationContext.
However you can extend this class and override the getBannerForUser method to return a banner message for a specific user. To configure the SSHD to use your class instead of the default behaviour add it to the supported authentication mechanisms in your SshDaemon.configure method. Also make sure that no banner is configured in the SshContext.
context.supportedAuthenticationMechanisms().add("none", MyNoneAuthentication.class);
| Constructor and Description |
|---|
NoneAuthentication(org.apache.mina.core.session.IoSession session,
AuthenticationProtocol auth) |
| Modifier and Type | Method and Description |
|---|---|
String |
getBannerForUser(String username)
Override this method to send user customized banners, if this method is overridden then com.maverick.sshd.SshContext.setBannerMessage(null) should be set to null.
|
String |
getName()
Return the SSH method name for this authentication.
|
boolean |
isPassword()
Is this password authentication? We use this so user does not end up having to submit their
password if an alternative method provides password authentication but is not the core "password"
method (for example keyboard-interactive).
|
boolean |
processMessage(byte[] msg)
If the SSH protocol authentication method defines additional messages
which are sent from the client, they will be passed into your
implementation here when received.
|
boolean |
startRequest(String username,
byte[] msg)
Start an authentication transaction.
|
public NoneAuthentication(org.apache.mina.core.session.IoSession session,
AuthenticationProtocol auth)
public final String getName()
getName in interface com.maverick.ssh.components.SshComponentgetName in interface AuthenticationMechanismpublic final boolean processMessage(byte[] msg)
throws IOException
processMessage in interface AuthenticationMechanismmsg - byte[]IOExceptionpublic String getBannerForUser(String username)
username - public final boolean startRequest(String username, byte[] msg) throws IOException
startRequest in interface AuthenticationMechanismusername - Stringmsg - the request data from the SSH_MSG_USERAUTH_REQUEST messageIOExceptionpublic boolean isPassword()
AuthenticationMechanismisPassword in interface AuthenticationMechanismCopyright © 2012. All Rights Reserved.