Metodo IFtpAuthenticationProvider::AuthenticateUser

Verifica se un nome utente e una password sono validi.

Sintassi

AuthenticateUser( 
   LPWSTR pszSessionId, 
   LPWSTR pszSiteName, 
   LPWSTR pszUserName, 
   LPWSTR pszPassword, 
   LPWSTR * ppszCanonicalUserName, 
   long * pfAuthenticated 
) 

Parametri

Termine Definizione
pszSessionId Puntatore a una stringa contenente l'ID sessione.
pszSiteName Puntatore a una stringa contenente il nome del sito.
pszUserName Puntatore a una stringa contenente il nome utente.
pszPassword Puntatore a una stringa contenente la password.
ppszCanonicalUserName Puntatore a una stringa che conterrà il nome canonico dell'utente.
pfAuthenticated Puntatore a un numero intero lungo che conterrà true se l'utente è autenticato; in caso contrario, false.

Valore restituito

Oggetto HRESULT. I valori possibili includono, ma non sono limitati a, quelli indicati nella tabella seguente.

Valore Descrizione
S_OK Indica che l'operazione è riuscita.

Commenti

Il parametro può essere usato per canonizzare i nomi utente. Il ppszCanonicalUserName formato canonico suggerito è dominio\utente perché le versioni precedenti dei server FTP IIS richiedono che il nome utente sia nel formato dominio\utente.

Un provider basato su autenticazione di Windows non può essere implementato con questo metodo perché tale forma di autenticazione non consente la restituzione dei token utente.

Esempio

Nell'esempio di codice seguente viene illustrato come usare l'interfaccia IFtpAuthenticationProvider per creare un modulo di autenticazione personalizzato per il servizio FTP che implementa i controlli dei nomi utente.

public: 
   STDMETHOD(AuthenticateUser)(LPWSTR pszSessionId, 
      LPWSTR pszSiteName, 
      LPWSTR pszUserName, 
      LPWSTR pszPassword, 
      LPWSTR * ppszCanonicalUserName, 
      long * pfAuthenticated) 
      { 
      // Note: You would add your own custom logic here. 
      *ppszCanonicalUserName = pszUserName; 
 
      CString strUserName = L"MyUser"; 
      CString strPassword = L"MyPassword"; 
 
      // Verify that the user name and password are valid. 
      // In this example, the user name is case-insensitive 
      // and the password is case-sensitive. 
      if ((strUserName.CompareNoCase(pszUserName)==0) && 
          (strPassword.Compare(pszPassword)==0)) 
      { 
         *pfAuthenticated = TRUE; 
      } 
      else 
      { 
         *pfAuthenticated = FALSE; 
   } 
      return S_OK; 
   } 

Requisiti

Tipo Descrizione
Client - IIS 7.5 in Windows 7
- IIS 8.0 in Windows 8
- IIS 10.0 in Windows 10
Server - IIS 7.5 in Windows Server 2008 R2
- IIS 8.0 in Windows Server 2012
- IIS 8.5 in Windows Server 2012 R2
- IIS 10.0 in Windows Server 2016
Prodotto - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
Riferimento ftpext.tlb

Vedere anche

Interfaccia IFtpAuthenticationProvider