PowerTCP SSH and SFTP for .NET
Authenticate(SshLoginData) Method




Parameters to use for authentication.
A server-driven upper-level authentication method that also automatically performs multi-factor authentication if required.
Syntax
'Declaration
 
Public Overloads Sub Authenticate( _
   ByVal loginData As SshLoginData _
) 
'Usage
 
Dim instance As SshConnection
Dim loginData As SshLoginData
 
instance.Authenticate(loginData)
public void Authenticate( 
   SshLoginData loginData
)
public: void Authenticate( 
   SshLoginData* loginData
) 
public:
void Authenticate( 
   SshLoginData^ loginData
) 

Parameters

loginData
Parameters to use for authentication.
Exceptions
ExceptionDescription
System.Security.Authentication.AuthenticationException Authentication was unsuccessful.
System.ArgumentException One or more of the details provided in loginData is invalid, or required and not provided.
Remarks

This method relies upon 'none' authentication to request the available authentication methods, and is driven by the server's response and the provided authentication details. The authentication method used will be selected in the order of preference: 'publickey', 'password', 'keyboard-interactive', excluding any not supported by the server or not possible with the provided authentication details. If the server reports partial success for any authentication attempt, multi-factor authentication will be attempted based upon the server's available authentication methods and the provided authentication details until authentication succeeds or an exception is thrown. This automatic multi-factor authentication is limited to 20 attempts.

If keyboard-interactive authentication is used by this method, a Challenge event handler is not required if the server only prompts for the password and loginData.Password is populated; in all other cases, a handler is required to sucessfully complete authentication. If the Challenge event is handled, the response for the password prompt will be pre-populated with the password. Note: This method will only pre-populate a response for the first prompt that contains 'password' (case-insensitive); alternative password prompts must be handled manually in the Challenge event.

The technique used to invoke this method is dependent upon the value of ThreadingModel. If ThreadingModel.Free, this method executes on the current thread and returns when complete (this is standard for creating applications in multi-threading environments like .NET). If ThreadingModel.ApartmentBlocking, this method blocks and processes windows UI messages while a worker thread executes (this is useful for making a simple blocking call in an apartment model environment like VB6). If ThreadingModel.ApartmentAsync, this method immediately returns after starting a worker thread that executes asynchronously (this is useful for creating advanced communications applications in an apartment model environment like VB6). The StateChanged event will be raised upon completion, or the Error event raised if an exception is thrown.

Note: Server support of the 'none' authentication method will never be announced by the server per RFC 4252.

See Also

Reference

SshConnection Class
SshConnection Members
Overload List


PowerTCP SSH and SFTP for .NET Documentation Version 8.0
© 2025 Dart Communications. All Rights Reserved.
Send comments on this topic