Package com.sshtools.j2ssh.authentication

Examples of com.sshtools.j2ssh.authentication.PasswordAuthenticationClient


            sshClient.connect(properties, new HostKeyVerificationImpl() );

            log.debug( "Connect Successful." );

            // Initialize the authentication data.
            PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
            pwd.setUsername(username);
            pwd.setPassword(password);

            // Authenticate
            int result = sshClient.authenticate(pwd);
            if( result != AuthenticationProtocolState.COMPLETE )
            {
View Full Code Here


        {
            ssh.connect(properties,
                        new SftpVerification(Settings.sshHostKeyVerificationFile));
        }

        PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
        pwd.setUsername(user);
        pwd.setPassword(pass);

        int result = ssh.authenticate(pwd);

        if(result == AuthenticationProtocolState.COMPLETE)
        {
View Full Code Here

            int result = -1;

            if(keyfile == null)
            {
                //ssh.connect(host);
                PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
                pwd.setUsername(user);
                pwd.setPassword(pass);

                result = ssh.authenticate(pwd);
            }
            else
            {
View Full Code Here

      // Make a client connection
      SshClient ssh = new SshClient();
      // Connect to the hos
      ssh.connect(hostname);
      // Create a password authentication instance
      PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      // Get the users name
      System.out.print("Username? ");
      String username = reader.readLine();
      pwd.setUsername(username);
      // Get the password
      System.out.print("Password? ");
      String password = reader.readLine();
      pwd.setPassword(password);
      // Try the authentication
      int result = ssh.authenticate(pwd);
      // Evaluate the result
      if (result == AuthenticationProtocolState.COMPLETE) {
        ForwardingClient forwarding = ssh.getForwardingClient();
View Full Code Here

      properties.setHost(hostname);
      properties.setPrefPublicKey("ssh-dss");
      // Connect to the host
      ssh.connect(properties);
      // Create a password authentication instance
      PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      // Get the users name
      System.out.print("Username? ");
      // Read the password
      String username = reader.readLine();
      pwd.setUsername(username);
      // Get the password
      System.out.print("Password? ");
      String password = reader.readLine();
      pwd.setPassword(password);
      // Try the authentication
      int result = ssh.authenticate(pwd);
      // Evaluate the result
      if (result == AuthenticationProtocolState.COMPLETE) {
        // The connection is authenticated we can now do some real work!
View Full Code Here

      // Make a client connection
      SshClient ssh = new SshClient();
      // Connect to the host
      ssh.connect(hostname);
      // Create a password authentication instance
      PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      // Get the users name
      System.out.print("Username? ");
      String username = reader.readLine();
      pwd.setUsername(username);
      // Get the password
      System.out.print("Password? ");
      String password = reader.readLine();
      pwd.setPassword(password);
      // Try the authentication
      int result = ssh.authenticate(pwd);
      // Evaluate the result
      if (result == AuthenticationProtocolState.COMPLETE) {
        // The connection is authenticated we can now do some real work!
View Full Code Here

        ssh.connect(server,new IgnoreHostKeyVerification());
      else
            ssh.connect(server,portSSH,new IgnoreHostKeyVerification());
      //System.out.println("Con3"); 
          // Create a password authentication instance
          PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      //System.out.println("Con4"); 
          pwd.setUsername(user);
          pwd.setPassword(password);
      //System.out.println("Con5"); 
          // Try the authentication
          int result = ssh.authenticate(pwd);
      //System.out.println("Con6 result:"+result); 
      // Evaluate the result
View Full Code Here

        ssh.connect(server_,new IgnoreHostKeyVerification());
      else
            ssh.connect(server_,portSSH,new IgnoreHostKeyVerification());
      //System.out.println("Con3"); 
          // Create a password authentication instance
          PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      //System.out.println("Con4"); 
          pwd.setUsername(user);
          pwd.setPassword(password);
      //System.out.println("Con5"); 
          // Try the authentication
          int result = ssh.authenticate(pwd);
      //System.out.println("Con6 result:"+result); 
      // Evaluate the result
View Full Code Here

      //ssh.connect(properties, new ConsoleKnownHostsKeyVerification());
      ssh.connect(properties,new IgnoreHostKeyVerification());
     

      // Create a password authentication instance
      PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();

      pwd.setUsername(userName);
      pwd.setPassword(passwd);

      // Try the authentication
      int result = ssh.authenticate(pwd);

      // Evaluate the result
View Full Code Here

        setTask(TASK_ERROR,new String[]{m_errorPrefix+"connect: "+e.getMessage() });
        m_locked = false;
        return m_open;
      }
      // Create a password authentication instance
      PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
      // Set the users name
      pwd.setUsername(m_details.getUsername());
      // Set the password
      pwd.setPassword(m_details.getPassword());

      // Try the authentication
      int result = AuthenticationProtocolState.FAILED;
      try{
        result = m_ssh.authenticate(pwd);
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.authentication.PasswordAuthenticationClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.