Back to product page

Authentication function


Determines which authentication type is used.

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_GetAuthentication(void *Sftp, AuthenticationsEnum *pVal);
long Sftp_SetAuthentication(void *Sftp, AuthenticationsEnum newVal);
The Authentication(void *Sftp,AuthenticationsEnum *pVal, newVal) syntax has these parts:
void *SftpHandle of the created Sftp instance.
AuthenticationsEnum *pVal, newValAn AuthenticationsEnum enumeration, as described in settings.

Remarks

The settings for pVal/newVal are:

Constant Value Description
authBoth0 Use both authentications.
authPassword 1 Use password authentication
authPubkey 2 Use public key authentication
authSecurID3 Use SecurID token authentication
authKeyboardInteractive 4 Use KeyboardInteractive authentication
authGSSAPI 5 Use Kerberos GSS authentication


The Authentication function allows you to select the type of authentication to use with the server. The most common choice is authPassword authentication, which requires the Login and Password properties to be set before the Connect method is called. When wodSFTP connects to the server, it will authenticate with username and password ONLY.

If you prefer to authenticate using a PrivateKey (in which case the server MUST have the appropriate public key), you should set this property to authPubkey, and you should set the Login and PrivateKey properties accordingly.

If you allow any of these types of authentication to take place, set this property to authBoth. In this case wodSFTP will try to use both methods. Different server implementations may require that either one or both of the authentications are successful in order to login to the server. Please note that in this case you must set all three properties: Login, Password and PrivateKey.

To set the PrivateKey, use the Keys object (included in the setup package) which will allow you to generate (and store) the required keys.

You can also use authSecurID authentication. In this case, set your Login and instead of password enter the OTP (one time password) as provided by your token. wodSFTP will send authentication information to the server using these properties. In this scenario you cannot use Password at the same time as this property is used for both types.

wodSFTP also supports keyboard-interactive authentication. If Password authentication fails, wodSFTP will also attempt keyboard-interactive authentication as a fallback method.

authGSSAPI implements Kerberos protocol (http://web.mit.edu/Kerberos). When this authentication is used, there is no need to provide Login and Password at all - they are requested from the Kerberos authority (assuming you have valid credentials) and authentication is made without providing any login details in the code. wodSFTPdll supports both SSPI (Microsoft implementation) and KfW (MIT open source) implementations - whichever is available on the local system.

Platforms

Windows