Skip to content
Snippets Groups Projects
Commit 1dc258d7 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

fixes for scp login

parent 0d4e75da
Branches
Tags
No related merge requests found
...@@ -176,8 +176,8 @@ public class HaaSClient { ...@@ -176,8 +176,8 @@ public class HaaSClient {
try (ScpClient scpClient = getScpClient(ft)) { try (ScpClient scpClient = getScpClient(ft)) {
for (String fileName : getFileTransfer().listChangedFilesForJob(jobId, getSessionID())) { for (String fileName : getFileTransfer().listChangedFilesForJob(jobId, getSessionID())) {
fileName=fileName.replaceAll("/", "");
Path rFile = workDirectory.resolve(fileName); Path rFile = workDirectory.resolve(fileName);
System.out.println("Downloading file: " + fileName);
scpClient.download(ft.getSharedBasepath() + "//" + fileName, rFile); scpClient.download(ft.getSharedBasepath() + "//" + fileName, rFile);
} }
} }
......
...@@ -2,7 +2,7 @@ package cz.it4i.fiji.haas_java_client; ...@@ -2,7 +2,7 @@ package cz.it4i.fiji.haas_java_client;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.Collections; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -18,7 +18,7 @@ public class TestHaaSJavaClient { ...@@ -18,7 +18,7 @@ public class TestHaaSJavaClient {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("inputParam", "someStringParam"); params.put("inputParam", "someStringParam");
HaaSClient client = new HaaSClient(Paths.get("/home/koz01/aaa")); HaaSClient client = new HaaSClient(Paths.get("/home/koz01/aaa"));
long jobId = client.start(Collections.emptyList(), "TestOutRedirect", 1, params.entrySet()); long jobId = client.start(Arrays.asList(Paths.get("/home/koz01/aaa/vecmath.jar")), "TestOutRedirect", 1, params.entrySet());
JobInfo info; JobInfo info;
do { do {
try { try {
......
...@@ -35,7 +35,12 @@ class ByteIdentity implements Identity{ ...@@ -35,7 +35,12 @@ class ByteIdentity implements Identity{
@Override @Override
public String getAlgName() { public String getAlgName() {
return null; if(keyPair.getKeyType() == KeyPair.RSA) {
return "ssh-rsa";
} else if(keyPair.getKeyType() == KeyPair.DSA) {
return "ssh-dsa";
}
throw new UnsupportedOperationException("Key type:" + keyPair.getKeyType() + " not supported.");
} }
@Override @Override
......
package cz.it4i.fiji.scpclient; package cz.it4i.fiji.scpclient;
import com.jcraft.jsch.Identity; import com.jcraft.jsch.Identity;
import com.jcraft.jsch.IdentityRepository; import com.jcraft.jsch.IdentityRepository;
import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSch;
...@@ -30,9 +29,11 @@ class IdentityFile implements Identity{ ...@@ -30,9 +29,11 @@ class IdentityFile implements Identity{
/** /**
* Decrypts this identity with the specified pass-phrase. * Decrypts this identity with the specified pass-phrase.
* @param passphrase the pass-phrase for this identity. *
* @return <tt>true</tt> if the decryption is succeeded * @param passphrase
* or this identity is not cyphered. * the pass-phrase for this identity.
* @return <tt>true</tt> if the decryption is succeeded or this identity is not
* cyphered.
*/ */
public boolean setPassphrase(byte[] passphrase) throws JSchException { public boolean setPassphrase(byte[] passphrase) throws JSchException {
return kpair.decrypt(passphrase); return kpair.decrypt(passphrase);
...@@ -40,6 +41,7 @@ class IdentityFile implements Identity{ ...@@ -40,6 +41,7 @@ class IdentityFile implements Identity{
/** /**
* Returns the public-key blob. * Returns the public-key blob.
*
* @return the public-key blob * @return the public-key blob
*/ */
public byte[] getPublicKeyBlob() { public byte[] getPublicKeyBlob() {
...@@ -48,7 +50,9 @@ class IdentityFile implements Identity{ ...@@ -48,7 +50,9 @@ class IdentityFile implements Identity{
/** /**
* Signs on data with this identity, and returns the result. * Signs on data with this identity, and returns the result.
* @param data data to be signed *
* @param data
* data to be signed
* @return the signature * @return the signature
*/ */
public byte[] getSignature(byte[] data) { public byte[] getSignature(byte[] data) {
...@@ -65,15 +69,21 @@ class IdentityFile implements Identity{ ...@@ -65,15 +69,21 @@ class IdentityFile implements Identity{
/** /**
* Returns the name of the key algorithm. * Returns the name of the key algorithm.
*
* @return "ssh-rsa" or "ssh-dss" * @return "ssh-rsa" or "ssh-dss"
*/ */
public String getAlgName() { public String getAlgName() {
return new String("ssh-rsa"); if (kpair.getKeyType() == KeyPair.RSA) {
return "ssh-rsa";
} else if (kpair.getKeyType() == KeyPair.DSA) {
return "ssh-dsa";
}
throw new UnsupportedOperationException("Key type:" + kpair.getKeyType() + " not supported.");
} }
/** /**
* Returns the name of this identity. * Returns the name of this identity. It will be useful to identify this object
* It will be useful to identify this object in the {@link IdentityRepository}. * in the {@link IdentityRepository}.
*/ */
public String getName() { public String getName() {
return identity; return identity;
...@@ -81,6 +91,7 @@ class IdentityFile implements Identity{ ...@@ -81,6 +91,7 @@ class IdentityFile implements Identity{
/** /**
* Returns <tt>true</tt> if this identity is cyphered. * Returns <tt>true</tt> if this identity is cyphered.
*
* @return <tt>true</tt> if this identity is cyphered. * @return <tt>true</tt> if this identity is cyphered.
*/ */
public boolean isEncrypted() { public boolean isEncrypted() {
...@@ -97,6 +108,7 @@ class IdentityFile implements Identity{ ...@@ -97,6 +108,7 @@ class IdentityFile implements Identity{
/** /**
* Returns an instance of {@link KeyPair} used in this {@link Identity}. * Returns an instance of {@link KeyPair} used in this {@link Identity}.
*
* @return an instance of {@link KeyPair} used in this {@link Identity}. * @return an instance of {@link KeyPair} used in this {@link Identity}.
*/ */
public KeyPair getKeyPair() { public KeyPair getKeyPair() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment