com.maverick.ssh2
Class Ssh2HostbasedAuthentication

java.lang.Object
  extended bycom.maverick.ssh2.Ssh2HostbasedAuthentication
All Implemented Interfaces:
AuthenticationClient, SshAuthentication

public class Ssh2HostbasedAuthentication
extends java.lang.Object
implements AuthenticationClient

Provides hostbased authentication for the SSH2 protocol. Hostbased authentication allows a user to connect from a trusted client by providing the clients public key and their local/remote usernames. The server then allows access if the client can be verified through a combination of several different configuration files which include /etc/hosts.equiv /etc/ssh/ssh_known_hosts ~/.ssh/known_hosts ~/.rhosts ~./shosts.

Author:
Lee David Painter

Field Summary
 
Fields inherited from interface com.maverick.ssh.SshAuthentication
CANCELLED, COMPLETE, FAILED, FURTHER_AUTHENTICATION_REQUIRED, PUBLIC_KEY_ACCEPTABLE
 
Constructor Summary
Ssh2HostbasedAuthentication()
           
 
Method Summary
 void authenticate(AuthenticationProtocol authentication, java.lang.String servicename)
          Perform the authentication according to the specification.
 java.lang.String getClientUsername()
          Get the user's username on the client computer
 java.lang.String getMethod()
          The SSH authentication method name
 SshPrivateKey getPrivateKey()
          Get the private key used for this authentication
 SshPublicKey getPublicKey()
          Set the public key used for this authentication
 java.lang.String getUsername()
          Get the username for this authentication attempt.
 void setClientHostname(java.lang.String clientHostname)
          Set the hostname of the client
 void setClientUsername(java.lang.String clientUsername)
          Set the user's username on the client computer
 void setPrivateKey(SshPrivateKey prv)
          Set the private key for the authentication attempt
 void setPublicKey(SshPublicKey pub)
          Set the public key for the authentication attempt
 void setUsername(java.lang.String username)
          Set the username for this authentication attempt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ssh2HostbasedAuthentication

public Ssh2HostbasedAuthentication()
Method Detail

authenticate

public void authenticate(AuthenticationProtocol authentication,
                         java.lang.String servicename)
                  throws SshException,
                         com.maverick.ssh2.AuthenticationResult
Description copied from interface: AuthenticationClient
Perform the authentication according to the specification. The expected result of this method is for the caller to catch an AuthenticationResult. If the method returns without throwing this then the caller will attempt to read the next message available expecting it to be either a SSH_MSG_USERAUTH_SUCCESS or SSH_MSG_USERAUTH_FAILURE.

Specified by:
authenticate in interface AuthenticationClient
Parameters:
authentication -
servicename -
Throws:
SshException
com.maverick.ssh2.AuthenticationResult

getMethod

public java.lang.String getMethod()
Description copied from interface: SshAuthentication
The SSH authentication method name

Specified by:
getMethod in interface SshAuthentication
Returns:
String

setClientHostname

public void setClientHostname(java.lang.String clientHostname)
Set the hostname of the client

Parameters:
clientHostname -

setUsername

public void setUsername(java.lang.String username)
Description copied from interface: SshAuthentication
Set the username for this authentication attempt.

Specified by:
setUsername in interface SshAuthentication
Parameters:
username -

getUsername

public java.lang.String getUsername()
Description copied from interface: SshAuthentication
Get the username for this authentication attempt.

Specified by:
getUsername in interface SshAuthentication
Returns:
the username used.

setPublicKey

public void setPublicKey(SshPublicKey pub)
Set the public key for the authentication attempt

Parameters:
pub -

setPrivateKey

public void setPrivateKey(SshPrivateKey prv)
Set the private key for the authentication attempt

Parameters:
prv -

setClientUsername

public void setClientUsername(java.lang.String clientUsername)
Set the user's username on the client computer

Parameters:
clientUsername -

getClientUsername

public java.lang.String getClientUsername()
Get the user's username on the client computer

Returns:

getPrivateKey

public SshPrivateKey getPrivateKey()
Get the private key used for this authentication

Returns:

getPublicKey

public SshPublicKey getPublicKey()
Set the public key used for this authentication

Returns:


Copyright © 2003 3SP LTD. All Rights Reserved.