[ 
https://issues.apache.org/jira/browse/SSHD-1252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17508648#comment-17508648
 ] 

George commented on SSHD-1252:
------------------------------

Hello [~lgoldstein] , first of all, thanks a lot for your message. For the 
below code, I get the number of prompts 1, although it should be 3. From what I 
can tell the server is setting this, is there a way I can override? Thanks a 
lot for your help. 

 

 

 
{code:java}
SshClient client = SshClient.setUpDefaultClient();

client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));

client.start();

client.setUserInteraction(new UserInteraction() {
@Override
public boolean isInteractionAllowed(ClientSession session) {
return true;
}

@Override
public String[] interactive(ClientSession session, String name, String 
instruction, String lang, String[] prompt, boolean[] echo) {
for (int i = 0; i < prompt.length; i++) {
System.out.println("++++++++++++++++++++++++");
System.out.println(prompt[i]);
System.out.println("+++++-+++++++++++++++++++");
}
return new String[] {"foobar"};
}

@Override
public String getUpdatedPassword(ClientSession session, String prompt, String 
lang) {
return null;
}
});
ClientSession session = client.connect("username"), "host", port)
.verify(50, TimeUnit.SECONDS).getSession();

session.auth().verify(50L, TimeUnit.SECONDS);

channel = 
session.createChannel(org.apache.sshd.client.channel.ChannelExec.CHANNEL_SHELL);

channel.open().verify(20L, TimeUnit.SECONDS);{code}

> Better support / documentation for other auth methods
> -----------------------------------------------------
>
>                 Key: SSHD-1252
>                 URL: https://issues.apache.org/jira/browse/SSHD-1252
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 2.7.0
>            Reporter: George
>            Priority: Major
>
> Hello,
>  
>  I am trying to use SSHD to connect to a server that requires 3 inputs, but, 
> in the documentation I only see how to connect using password. I guess for my 
> scenario I would have to use 
> UserAuthKeyboardInteractive but its not clear to me how to use it (there are 
> no mentions of it anywhere). Could you please provide an example / docs ? 
> Thanks!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to