use of com.helger.jsch.session.DefaultSessionFactory in project ph-web by phax.
the class ConnectionTest method getKeyboardInteractiveAuthenticatingSessionFactory.
private ISessionFactory getKeyboardInteractiveAuthenticatingSessionFactory(final String password) {
final DefaultSessionFactory defaultSessionFactory = new DefaultSessionFactory(username, hostname, port);
defaultSessionFactory.setConfig("PreferredAuthentications", "keyboard-interactive");
defaultSessionFactory.setUserInfo(new MockUserInfo(password));
return defaultSessionFactory;
}
use of com.helger.jsch.session.DefaultSessionFactory in project ph-web by phax.
the class AbstractScpTestBase method initializeClass.
@BeforeClass
public static void initializeClass() {
try (final InputStream inputStream = ClassLoader.getSystemResourceAsStream("configuration.properties")) {
Assume.assumeNotNull(inputStream);
s_aProperties = new NonBlockingProperties();
s_aProperties.load(inputStream);
} catch (final IOException e) {
LOGGER.warn("cant find properties file (tests will be skipped): " + e.getMessage());
s_aProperties = null;
return;
}
final String knownHosts = s_aProperties.getProperty("ssh.knownHosts");
final String privateKey = s_aProperties.getProperty("ssh.privateKey");
s_sScpPath = s_aProperties.getProperty("scp.out.test.scpPath");
s_sFileSystemPath = s_aProperties.getProperty("scp.out.test.filesystemPath");
final String username = s_aProperties.getProperty("scp.out.test.username");
final String hostname = "localhost";
final int port = Integer.parseInt(s_aProperties.getProperty("scp.out.test.port"));
final DefaultSessionFactory defaultSessionFactory = new DefaultSessionFactory(username, hostname, port);
try {
defaultSessionFactory.setKnownHosts(knownHosts);
defaultSessionFactory.setIdentityFromPrivateKey(privateKey);
} catch (final JSchException e) {
Assume.assumeNoException(e);
}
s_aSessionFactory = defaultSessionFactory;
}
use of com.helger.jsch.session.DefaultSessionFactory in project ph-web by phax.
the class TunnelConnectionTest method initializeClass.
@BeforeClass
public static void initializeClass() {
try (final InputStream inputStream = ClassLoader.getSystemResourceAsStream("configuration.properties")) {
Assume.assumeNotNull(inputStream);
properties = new NonBlockingProperties();
properties.load(inputStream);
} catch (final IOException e) {
LOGGER.warn("cant find properties file (tests will be skipped)", e);
properties = null;
return;
}
final String knownHosts = properties.getProperty("ssh.knownHosts");
final String privateKey = properties.getProperty("ssh.privateKey");
final String username = properties.getProperty("scp.out.test.username");
final String hostname = "localhost";
final int port = Integer.parseInt(properties.getProperty("scp.out.test.port"));
final DefaultSessionFactory defaultSessionFactory = new DefaultSessionFactory(username, hostname, port);
try {
defaultSessionFactory.setKnownHosts(knownHosts);
defaultSessionFactory.setIdentityFromPrivateKey(privateKey);
} catch (final JSchException e) {
LOGGER.error("Failed to configure default session, skipping tests", e);
Assume.assumeNoException(e);
}
sessionFactory = defaultSessionFactory;
}
use of com.helger.jsch.session.DefaultSessionFactory in project ph-web by phax.
the class ConnectionTest method _getPasswordAuthenticatingSessionFactory.
private ISessionFactory _getPasswordAuthenticatingSessionFactory(final String password) {
final DefaultSessionFactory defaultSessionFactory = new DefaultSessionFactory(username, hostname, port);
defaultSessionFactory.setConfig("PreferredAuthentications", "password");
defaultSessionFactory.setPassword(password);
return defaultSessionFactory;
}
use of com.helger.jsch.session.DefaultSessionFactory in project ph-web by phax.
the class CommandRunnerTest method initializeClass.
@BeforeClass
public static void initializeClass() {
try (final InputStream inputStream = ClassLoader.getSystemResourceAsStream("configuration.properties")) {
Assume.assumeNotNull(inputStream);
properties = new NonBlockingProperties();
properties.load(inputStream);
} catch (final IOException e) {
LOGGER.warn("cant find properties file (tests will be skipped)", e);
properties = null;
return;
}
final String knownHosts = properties.getProperty("ssh.knownHosts");
final String privateKey = properties.getProperty("ssh.privateKey");
final String username = properties.getProperty("scp.out.test.username");
final String hostname = "localhost";
final int port = Integer.parseInt(properties.getProperty("scp.out.test.port"));
final DefaultSessionFactory defaultSessionFactory = new DefaultSessionFactory(username, hostname, port);
try {
defaultSessionFactory.setKnownHosts(knownHosts);
defaultSessionFactory.setIdentityFromPrivateKey(privateKey);
} catch (final JSchException e) {
Assume.assumeNoException(e);
}
sessionFactory = defaultSessionFactory;
}
Aggregations