org.ow2.petals.bc.sftp.authentication
Class SshPublicKeyAuthentication

java.lang.Object
  extended by org.ow2.petals.bc.sftp.authentication.SshAuthentication
      extended by org.ow2.petals.bc.sftp.authentication.SshPublicKeyAuthentication

public final class SshPublicKeyAuthentication
extends SshAuthentication

Utility class used to authenticate a client onto a SSH server using a public key. NOTE : This method of authentication uses public-key cryptography to verify the user's identity. The user can access an account on an SSH server by proving that they possess a private key. The key is authorized if it is contained within the user's authorization file. NOTE : when using this authentication method, key MUST be stored on the same server as PEtALS. We can attach private key with XML message, but this is not a good solution, since private key might not be private anymore.

Author:
Charles Casadei - eBM WebSourcing

Constructor Summary
SshPublicKeyAuthentication(java.lang.String user, java.lang.String pathToPrivateKey, java.lang.String passphrase)
          Default constructor.
 
Method Summary
 com.sshtools.j2ssh.authentication.SshAuthenticationClient getAuthenticationClient()
          Builds the object used by the SFTPClientPool to perform the authentication on the SSH server.
 java.lang.String getKey()
          Builds & returns a portion of the key used by the SFTPClientPool to identify a SSH session.
 java.lang.String toString()
          Return the object content as String (Overrides the toString method).
 
Methods inherited from class org.ow2.petals.bc.sftp.authentication.SshAuthentication
getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SshPublicKeyAuthentication

public SshPublicKeyAuthentication(java.lang.String user,
                                  java.lang.String pathToPrivateKey,
                                  java.lang.String passphrase)
                           throws ConfigurationException
Default constructor. Initialize the user the private key and the passphrase holded by an instance of this class with the given values

Parameters:
user - the username used for SSH user / private key authentication
pathToPrivateKey - the PrivateKey used for SSH user / private key authentication
passphrase - the optional passphrase used for SSH user / private key authentication
Throws:
ConfigurationException
Method Detail

getAuthenticationClient

public final com.sshtools.j2ssh.authentication.SshAuthenticationClient getAuthenticationClient()
                                                                                        throws java.io.IOException
Builds the object used by the SFTPClientPool to perform the authentication on the SSH server.

Specified by:
getAuthenticationClient in class SshAuthentication
Returns:
an object used by the SFTPClientPool to perform the authentication
Throws:
SshAuthenticationException
java.io.IOException

getKey

public final java.lang.String getKey()
Builds & returns a portion of the key used by the SFTPClientPool to identify a SSH session.

Specified by:
getKey in class SshAuthentication
Returns:
a portion of the key used by the SFTPClientPool

toString

public final java.lang.String toString()
Return the object content as String (Overrides the toString method).

Overrides:
toString in class SshAuthentication
Returns:
the object content as String


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.