CHttpServer::GetClientCredentials Method  
 
BOOL GetClientCredentials(
  UINT nClientId,  
  LPHTTPCLIENTCREDENTIALS lpCredentials  
);
BOOL GetClientCredentials(
  UINT nClientId,  
  CString& strUserName,  
  CString& strPassword  
);

Return the user credentials for the specified client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpCredentials
A pointer to an HTTPCLIENTCREDENTIALS structure that will contain information about the user when the method returns. This parameter cannot be NULL.
strUserName
A string that will contain the user name when the method returns. This version of the method is only available for MFC and ATL based projects that define the CString object.
strPassword
A string that will contain the user password when the method returns. This version of the method is only available for MFC and ATL based projects that define the CString object.

Return Value

If the user credentials for the client session are available, the return value is non-zero. If the client ID does not specify a valid client session, or the client has not requested authentication, this method will return zero.

Remarks

The GetClientCredentials method is used to obtain the username and password that was provided by the client when it requested authentication. Typically this method is used in an event handler to validate the credentials provided by the client. If the credentials are considered valid, the event handler would then call the AuthenticateClient method to specify that the session has been authenticated.

If the default event handler is used, the OnAuthenticate method will be invoked with the user credentials passed to the handler as arguments.

Requirements

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

See Also

AuthenticateClient, RequireAuthentication, OnAuthenticate, HTTPCLIENTCREDENTIALS