[
https://issues.apache.org/jira/browse/SSHD-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16970870#comment-16970870
]
Lyor Goldstein commented on SSHD-955:
-------------------------------------
Seems like a reasonable request for a new feature - I will add it to the next
release. For the time being, the fastest way to work around this is to register
your own {{UserInteraction}} and implements its {{interactive}} method to
detect a prompt other than {{"password"}}:
{code:java}
class MyUserInteraction implements UserInteraction {
@Override
public String[] interactive(ClientSession session, String name, String
instruction, String lang, String[] prompt, boolean[] echo) {
int num = GenericUtils.length(prompt);
if ((num == 1) && prompt[0].contains("whatever")) {
return new String[] {....the password value...}
}
... else ... ?
}
}
SshClient client = ...setup initial client...
client.setUserInteraction(new MyUserInteraction());
{code}
> API to over-ride "password" key-phrase in prompt for a session
> --------------------------------------------------------------
>
> Key: SSHD-955
> URL: https://issues.apache.org/jira/browse/SSHD-955
> Project: MINA SSHD
> Issue Type: New Feature
> Reporter: Yuefeng
> Assignee: Lyor Goldstein
> Priority: Minor
>
> mina ssh expects "password" in the prompt. In UserAuthKeyboardInteractive,
> {code:java}
> protected boolean useCurrentPassword(String password, String name, String
> instruction, String lang, String[] prompt, boolean[] echo) {
> int num = GenericUtils.length(prompt);
> if (num == 1 && password != null && !echo[0]) {
> String value = GenericUtils.trimToEmpty(prompt[0]).toLowerCase();
> int passPos = value.lastIndexOf("password");
> if (passPos < 0) {
> return false;
> } else {
> int sepPos = value.lastIndexOf(58);
> return sepPos > passPos;
> }
> } else {
> return false;
> }
> }{code}
>
> but the password prompt does not always contain "password". On Cisco device,
> the prompt is configurable with
> {code:java}
> aaa authentication password-prompt passcode
> {code}
> As the result of this config, when logging into the box, the prompt is
> "passcode".
> Is there a way to over-ride key-phrase "password" in prompt, for a ssh
> session?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]