ComponentPro UltimateSftp

      Authenticate with Kerberos

      Language Filter: AllSend comments on this topic to ComponentPro

      This example demonstrates how to use the GSSAPI Kerberos authentication mechanism if the server supports it.

      With single sign-on

      // Create a new class instance. 
      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect("myserver");
      
          // Initialize GSSAPI for Kerberos single sign-on 
          SecureShellGssApiCredentials credentials = new SecureShellGssApiCredentials();
          credentials.SetMechanisms(SecureShellGssApiMechanisms.KerberosV5);
      
          // Log in using Kerberos single sign-on 
          client.Authenticate(credentials);
      
          // ...
      }
      

      With username/password/domain

      // Create a new class instance. 
      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect("myserver");
      
          // Initialize GSSAPI for Kerberos single sign-on 
          SecureShellGssApiCredentials credentials = new SecureShellGssApiCredentials(authUsername, authApiPassword, authDomain);
          credentials.SetMechanisms(SecureShellGssApiMechanisms.KerberosV5);
      
          // Log in using Kerberos 
          client.Authenticate(credentials);
      
          // ...
      }