com.maverick.sshd
Class AuthenticationProtocol

java.lang.Object
  extended by com.maverick.sshd.AuthenticationProtocol
All Implemented Interfaces:
Service

public class AuthenticationProtocol
extends Object
implements Service

This class implements the SSH Authentication Protocol. The only required interaction with this class would be if you were creating an AuthenticationMechanism. In this scenario you would simply call either completedAuthentication() or failedAuthentication() to inform the protocol that your authentication either completed or failed.

Author:
Lee David Painter

Field Summary
static int SSH_MSG_USERAUTH_BANNER
           
static int SSH_MSG_USERAUTH_FAILURE
           
static int SSH_MSG_USERAUTH_REQUEST
           
static int SSH_MSG_USERAUTH_SUCCESS
           
 
Constructor Summary
AuthenticationProtocol()
           
 
Method Summary
 void completedAuthentication()
          Each successful completion of an authentication method should call this method.
 void discardAuthentication()
          Inform the protocol that the current authentication should be discarded.
 void failedAuthentication()
          A failed authentication attempt should call this method.
 void failedAuthentication(boolean partial, boolean ignoreFailed)
          Called by the completeAuthentication method if a partial authentication success occurred.
 Object getParameter(String name)
           
 void idle(org.apache.mina.core.session.IdleStatus status)
          Called when the transport layer has been idle for 10 seconds
 void init(org.apache.mina.core.session.IoSession session, SshTransport transport)
          Construct the protocol using the given transport
 boolean processMessage(byte[] msg)
          Process an SSH message.
 void setParameter(String name, Object value)
           
 void start()
          Called by the TransportProtocol when the service starts.
 void stop()
          Called by the TransportProtocol when the service stops.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH_MSG_USERAUTH_REQUEST

public static final int SSH_MSG_USERAUTH_REQUEST
See Also:
Constant Field Values

SSH_MSG_USERAUTH_FAILURE

public static final int SSH_MSG_USERAUTH_FAILURE
See Also:
Constant Field Values

SSH_MSG_USERAUTH_SUCCESS

public static final int SSH_MSG_USERAUTH_SUCCESS
See Also:
Constant Field Values

SSH_MSG_USERAUTH_BANNER

public static final int SSH_MSG_USERAUTH_BANNER
See Also:
Constant Field Values
Constructor Detail

AuthenticationProtocol

public AuthenticationProtocol()
Method Detail

init

public void init(org.apache.mina.core.session.IoSession session,
                 SshTransport transport)
Construct the protocol using the given transport

Specified by:
init in interface Service
Parameters:
transport -
Throws:
IOException

stop

public void stop()
Called by the TransportProtocol when the service stops.

Specified by:
stop in interface Service

start

public void start()
Called by the TransportProtocol when the service starts. Here we check for an authentication banner and send if configured.

Specified by:
start in interface Service

processMessage

public boolean processMessage(byte[] msg)
                       throws IOException
Process an SSH message.

Specified by:
processMessage in interface Service
Parameters:
msg - the message to process
Returns:
true if the message was processed, otherwise false
Throws:
IOException

getParameter

public Object getParameter(String name)

setParameter

public void setParameter(String name,
                         Object value)

completedAuthentication

public void completedAuthentication()
                             throws IOException
Each successful completion of an authentication method should call this method. The state of the authentication is then determined and if completed the SSH_MSG_USERAUTH_SUCCESS message is sent, if a further authentication is required, SSH_MSG_USERAUTH_FAILURE is sent with the partial value set to true.

Throws:
IOException

discardAuthentication

public void discardAuthentication()
Inform the protocol that the current authentication should be discarded. This will result in no failure message being sent to the client.


failedAuthentication

public void failedAuthentication()
                          throws IOException
A failed authentication attempt should call this method.

Throws:
IOException

failedAuthentication

public void failedAuthentication(boolean partial,
                                 boolean ignoreFailed)
                          throws IOException
Called by the completeAuthentication method if a partial authentication success occurred.

Parameters:
partial - the authentication succeeded but another authentication is required
ignoreFailed - don't count this as a failed authentication
Throws:
IOException

idle

public void idle(org.apache.mina.core.session.IdleStatus status)
Description copied from interface: Service
Called when the transport layer has been idle for 10 seconds

Specified by:
idle in interface Service


Copyright © 2012. All Rights Reserved.