airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Added authentication info
Date Tue, 07 Jul 2015 19:39:06 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 25a389537 -> 23466997d


Added authentication info


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/23466997
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/23466997
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/23466997

Branch: refs/heads/master
Commit: 23466997d451f2e862a8cc5fa3db055e5b2128af
Parents: 25a3895
Author: Shameera Rathanyaka <shameerainfo@gmail.com>
Authored: Tue Jul 7 15:38:59 2015 -0400
Committer: Shameera Rathanyaka <shameerainfo@gmail.com>
Committed: Tue Jul 7 15:38:59 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/airavata/gfac/impl/Factory.java  | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/23466997/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
index a2bebc3..d00155d 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
@@ -29,6 +29,7 @@ import org.apache.airavata.gfac.core.GFacEngine;
 import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.JobManagerConfiguration;
 import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
+import org.apache.airavata.gfac.core.authentication.SSHKeyAuthentication;
 import org.apache.airavata.gfac.core.cluster.RemoteCluster;
 import org.apache.airavata.gfac.core.cluster.ServerInfo;
 import org.apache.airavata.gfac.core.config.DataTransferTaskConfig;
@@ -188,6 +189,7 @@ public abstract class Factory {
 			for (JobSubmissionInterface jobSubmissionInterface : jobSubmissionInterfaces) {
 				if (jobSubmissionInterface.getJobSubmissionProtocol() == cRP.getPreferredJobSubmissionProtocol())
{
 					jsInterface = jobSubmissionInterface;
+					break;
 				}
 			}
 			if (jsInterface == null) {
@@ -209,13 +211,22 @@ public abstract class Factory {
 			}
 
 			JobManagerConfiguration jobManagerConfiguration = getJobManagerConfiguration(resourceJobManager);
-			AuthenticationInfo authenticationInfo = null;
-			remoteCluster = new HPCRemoteCluster(serverInfo, jobManagerConfiguration, null);
+			AuthenticationInfo authenticationInfo = getSSHKeyAuthentication();
+			remoteCluster = new HPCRemoteCluster(serverInfo, jobManagerConfiguration, authenticationInfo);
 			remoteClusterMap.put(key, remoteCluster);
 		}
 		return remoteCluster;
 	}
 
+	private static SSHKeyAuthentication getSSHKeyAuthentication() throws ApplicationSettingsException
{
+		String username = ServerSettings.getSetting("ssh.user");
+		String privateKeyFilePath = ServerSettings.getSetting("private.ssh.key");
+		String publicKeyFilePath = ServerSettings.getSetting("public.ssh.key");
+		String passphrase = ServerSettings.getSetting("ssh.keypass");
+		return new SSHKeyAuthentication(username, privateKeyFilePath,
+				publicKeyFilePath, passphrase);
+	}
+
 	public static JobSubmissionTask getJobSubmissionTask(JobSubmissionProtocol jobSubmissionProtocol)
throws
 			GFacException {
 		if (jobSubmissionTask == null) {


Mime
View raw message