in deploy-runner-agent/src/main/java/jetbrains/buildServer/deployer/agent/ssh/SSHSessionProvider.java [199:213]
private Session initSessionKeyFile(String username, String password, File keyFile, JSch jsch) throws JSchException {
try {
if (StringUtil.isNotEmpty(password)) {
myLog.debug("Adding password");
jsch.addIdentity(keyFile.getCanonicalPath(), password);
} else {
jsch.addIdentity(keyFile.getCanonicalPath());
}
final Session session = jsch.getSession(username, myHost, myPort);
session.setConfig("PreferredAuthentications", "publickey");
return session;
} catch (IOException e) {
throw new JSchException("Failed to use key file", e);
}
}