org.tmatesoft.svn.core.auth

## Class SVNSSHAuthentication

- java.lang.Object
- - org.tmatesoft.svn.core.auth.SVNAuthentication
  - - org.tmatesoft.svn.core.auth.SVNSSHAuthentication

    public class SVNSSHAuthentication
    extends SVNAuthentication

The SVNSSHAuthentication class represents a kind of credentials used to authenticate a user over an SSH tunnel.

To obtain an ssh user credential, specify the `SSH` kind to credentials getter method of ISVNAuthenticationManager: `getFirstAuthentication()`, `getNextAuthentication()`.

Since:
  1.2
Version:
  1.3
Author:
  TMate Software Ltd.
See Also:
  `ISVNAuthenticationManager`

### Constructor Summary

Constructors
Constructor and Description
`SVNSSHAuthentication(java.lang.String userName, char[] privateKey, java.lang.String passphrase, int portNumber, boolean storageAllowed)` Deprecated. use constructor with SVNURL parameter instead
`SVNSSHAuthentication(java.lang.String userName, char[] privateKey, java.lang.String passphrase, int portNumber, boolean storageAllowed, SVNURL url, boolean isPartial)` Creates a user credential object for authenticating over an ssh tunnel.
`SVNSSHAuthentication(java.lang.String userName, java.io.File keyFile, java.lang.String passphrase, int portNumber, boolean storageAllowed)` Deprecated. use constructor with SVNURL parameter instead
`SVNSSHAuthentication(java.lang.String userName, java.io.File keyFile, java.lang.String passphrase, int portNumber, boolean storageAllowed, SVNURL url, boolean isPartial)` Creates a user credential object for authenticating over an ssh tunnel.
`SVNSSHAuthentication(java.lang.String userName, java.lang.String password, int portNumber, boolean storageAllowed)` Deprecated. use constructor with SVNURL parameter instead
`SVNSSHAuthentication(java.lang.String userName, java.lang.String password, int portNumber, boolean storageAllowed, SVNURL url, boolean isPartial)` Creates a user credential object for authenticating over an ssh tunnel.

### Method Summary

Methods
`java.lang.String` `getPassphrase()` Returns the password to the ssh private key.
`java.lang.String` `getPassword()` Returns the user account's password.
`int` `getPortNumber()` Returns the number of the port across which an ssh tunnel is established.
`char[]` `getPrivateKey()` Returns ssh private key.
`java.io.File` `getPrivateKeyFile()` Returns the File representation referring to the file with the user's ssh private key.
`boolean` `hasPrivateKey()` Tells whether this authentication object contains a user's private key.

### Methods inherited from class org.tmatesoft.svn.core.auth.SVNAuthentication

`getKind, getURL, getUserName, isPartial, isStorageAllowed`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        java.lang.String password,
                        int portNumber,
                        boolean storageAllowed)

Deprecated. use constructor with SVNURL parameter instead
Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires a user password instead of an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `password` - the user's password
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        java.lang.String password,
                        int portNumber,
                        boolean storageAllowed,
                        SVNURL url,
                        boolean isPartial)

Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires a user password instead of an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `password` - the user's password
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not
  `url` - url these credentials are applied to
Since:
  1.3.1

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        java.io.File keyFile,
                        java.lang.String passphrase,
                        int portNumber,
                        boolean storageAllowed)

Deprecated. use constructor with SVNURL parameter instead
Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `keyFile` - the user's ssh private key file
  `passphrase` - a password to the ssh private key
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        java.io.File keyFile,
                        java.lang.String passphrase,
                        int portNumber,
                        boolean storageAllowed,
                        SVNURL url,
                        boolean isPartial)

Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `keyFile` - the user's ssh private key file
  `passphrase` - a password to the ssh private key
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not
  `url` - url these credentials are applied to
Since:
  1.3.1

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        char[] privateKey,
                        java.lang.String passphrase,
                        int portNumber,
                        boolean storageAllowed)

Deprecated. use constructor with SVNURL parameter instead
Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `privateKey` - the user's ssh private key
  `passphrase` - a password to the ssh private key
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not

#### SVNSSHAuthentication

    public SVNSSHAuthentication(java.lang.String userName,
                        char[] privateKey,
                        java.lang.String passphrase,
                        int portNumber,
                        boolean storageAllowed,
                        SVNURL url,
                        boolean isPartial)

Creates a user credential object for authenticating over an ssh tunnel. This kind of credentials is used when an ssh connection requires an ssh private key.

Parameters:
  `userName` - the name of a user to authenticate
  `privateKey` - the user's ssh private key
  `passphrase` - a password to the ssh private key
  `portNumber` - the number of a port to establish an ssh tunnel over
  `storageAllowed` - if true then this credential is allowed to be stored in the global auth cache, otherwise not
  `url` - url these credentials are applied to
Since:
  1.3.1

### Method Detail

#### getPassword

    public java.lang.String getPassword()

Returns the user account's password. This is used when an ssh private key is not used.

Returns:
  the user's password

#### getPassphrase

    public java.lang.String getPassphrase()

Returns the password to the ssh private key.

Returns:
  the password to the private key
See Also:
  `getPrivateKeyFile()`

#### getPrivateKeyFile

    public java.io.File getPrivateKeyFile()

Returns the File representation referring to the file with the user's ssh private key. If the private key is encrypted with a passphrase, it should have been provided to an appropriate constructor.

Returns:
  the user's private key file

#### getPrivateKey

    public char[] getPrivateKey()

Returns ssh private key. If the private key is encrypted with a passphrase, it should have been provided to an appropriate constructor.

Returns:
  the user's private key file

#### getPortNumber

    public int getPortNumber()

Returns the number of the port across which an ssh tunnel is established.

Returns:
  the port number to establish an ssh tunnel over

#### hasPrivateKey

    public boolean hasPrivateKey()

Tells whether this authentication object contains a user's private key.

Returns:
  true if either `getPrivateKey()` or `getPrivateKeyFile()` returns non-null
Since:
  1.2.0