CFtpServer::OnAuthenticate Method  
 
virtual void OnAuthenticate(
  UINT nClientId,  
  LPCTSTR lpszHostName,  
  LPCTSTR lpszUserName,  
  LPCTSTR lpszPassword  
);

A virtual method that is invoked after the client has requested authentication.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszHostName
A pointer to a string that specifies the host name that the client used to establish the connection.
lpszUserName
A pointer to a string that specifies the user name provided by the client.
lpszPassword
A pointer to a string that specifies the cleartext user password provided by the client.

Return Value

None.

Remarks

The OnAuthenticate event handler is invoked when the client has requested authentication by sending the USER and PASS command to the server. To implement an event handler, the application should create a class derived from the CFtpServer class, and then override this method.

The event handler can call the AuthenticateClient method to authenticate the client session. To reject an authentication attempt because of an invalid user name or password, the handler should call the SendResponse method and specify a result code of 430.

If the client session is not authenticated, the server will perform its default authentication process. If the FTP_SERVER_ANONYMOUS configuration option has been specified, and the client has logged in as an anonymous user, the session will be authenticated as a restricted user. If the FTP_SERVER_LOCALUSER configuration option has been specified, the user name and password is checked against the local user database. If the credentials are valid, the session will be authenticated as a regular user. If neither the FTP_SERVER_ANONYMOUS or FTP_SERVER_LOCALUSER options were specified, the default action is to reject all authentication attempts.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftsv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

SendResponse, OnLogin, OnLogout