Browse Source

Add support for keyboard-interactive authentication to SSH tasks.

Submitted by:	Atsuhiko Yamanaka


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278433 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
5e6be92049
2 changed files with 18 additions and 2 deletions
  1. +2
    -0
      WHATSNEW
  2. +16
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHUserInfo.java

+ 2
- 0
WHATSNEW View File

@@ -239,6 +239,8 @@ Other changes:
* Try to make subprojects of custom Project subclasses instances of the
same type. Bugzilla report 17901.

* <ssh> and <scp> support keyboard-interactive authentication now.

Changes from Ant 1.6.4 to Ant 1.6.5
===================================



+ 16
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHUserInfo.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2004 The Apache Software Foundation
* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,11 @@
package org.apache.tools.ant.taskdefs.optional.ssh;

import com.jcraft.jsch.UserInfo;
import com.jcraft.jsch.UIKeyboardInteractive;

/**
*/
public class SSHUserInfo implements UserInfo {
public class SSHUserInfo implements UserInfo, UIKeyboardInteractive {

private String name;
private String password = null;
@@ -167,5 +168,18 @@ public class SSHUserInfo implements UserInfo {
public void showMessage(String message) {
//log(message, Project.MSG_DEBUG);
}
public String[] promptKeyboardInteractive(String destination,
String name,
String instruction,
String[] prompt,
boolean[] echo) {
if (prompt.length != 1 || echo[0] != false || this.password == null) {
return null;
}
String[] response=new String[1];
response[0]=this.password;
return response;
}

}

Loading…
Cancel
Save