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

synchronized boolean com::trilead::ssh2::Connection::authenticateWithKeyboardInteractive ( String  user,
String[]  submethods,
InteractiveCallback  cb 
) throws IOException [inline]

After a successful connect, one has to authenticate oneself. This method is based on "keyboard-interactive", specified in draft-ietf-secsh-auth-kbdinteract-XX. Basically, you have to define a callback object which will be feeded with challenges generated by the server. Answers are then sent back to the server. It is possible that the callback will be called several times during the invocation of this method (e.g., if the server replies to the callback's answer(s) with another challenge...)

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: some SSH servers advertise "keyboard-interactive", however, any interactive request will be denied (without having sent any challenge to the client).

userA String holding the username.
submethodsAn array of submethod names, see draft-ietf-secsh-auth-kbdinteract-XX. May be null to indicate an empty list.
cbAn InteractiveCallback which will be used to determine the responses to the questions asked by the server.
whether the connection is now authenticated.

Definition at line 244 of file Connection.java.

            if (cb == null)
                  throw new IllegalArgumentException("Callback may not ne NULL!");

            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");

            authenticated = am.authenticateInteractive(user, submethods, cb);

            return authenticated;

Generated by  Doxygen 1.6.0   Back to index