Logo Search packages:      
Sourcecode: jenkins-trilead-ssh2 version File versions  Download package

synchronized boolean com::trilead::ssh2::Connection::authenticateWithPassword ( String  user,
String  password 
) throws IOException [inline]

After a successful connect, one has to authenticate oneself. This method sends username and password to the server.

If the authentication phase is complete, true will be returned. If the server does not accept the request (or if further authentication steps are needed), false is returned and one can retry either by using this or any other authentication method (use the getRemainingAuthMethods method to get a list of the remaining possible methods).

Note: if this method fails, then please double-check that it is actually offered by the server (use getRemainingAuthMethods().

Often, password authentication is disabled, but users are not aware of it. Many servers only offer "publickey" and "keyboard-interactive". However, even though "keyboard-interactive" *feels* like password authentication (e.g., when using the putty or openssh clients) it is *not* the same mechanism.

Parameters:
user
password
Returns:
if the connection is now authenticated.
Exceptions:
IOException

Definition at line 294 of file Connection.java.

      {
            if (tm == null)
                  throw new IllegalStateException("Connection is not established!");

            if (authenticated)
                  throw new IllegalStateException("Connection is already authenticated!");

            if (am == null)
                  am = new AuthenticationManager(tm);

            if (cm == null)
                  cm = new ChannelManager(tm);

            if (user == null)
                  throw new IllegalArgumentException("user argument is null");

            if (password == null)
                  throw new IllegalArgumentException("password argument is null");

            authenticated = am.authenticatePassword(user, password);

            return authenticated;
      }

Generated by  Doxygen 1.6.0   Back to index