Repository: airavata
Updated Branches:
  refs/heads/master 8cfe4f9ea -> 42bc8defb


Fixed AIRAVATA-1465 to read user information. 

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

Branch: refs/heads/master
Commit: 42bc8defb0bd9c6f25af25b1f2e9d5f41ede1bc4
Parents: 8cfe4f9
Author: raminder <[email protected]>
Authored: Fri Oct 10 15:17:02 2014 -0400
Committer: raminder <[email protected]>
Committed: Fri Oct 10 15:17:02 2014 -0400

----------------------------------------------------------------------
 .../airavata/gfac/gsissh/util/GFACGSISSHUtils.java      | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/42bc8def/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
 
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 997f47e..0cdbbd1 100644
--- 
a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ 
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -28,11 +28,15 @@ import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.MappingFactory;
+import org.apache.airavata.credential.store.credential.Credential;
+import 
org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.Constants;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.RequestData;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
 import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
 import org.apache.airavata.gfac.gsissh.security.TokenizedMyProxyAuthInfo;
 import org.apache.airavata.gsi.ssh.api.Cluster;
@@ -80,6 +84,12 @@ public class GFACGSISSHUtils {
             GSISecurityContext context = null;
             try {
                 TokenizedMyProxyAuthInfo tokenizedMyProxyAuthInfo = new 
TokenizedMyProxyAuthInfo(requestData);
+                CredentialReader credentialReader = 
GFacUtils.getCredentialReader();
+                if(credentialReader != null){
+                       CertificateCredential credential = 
(CertificateCredential)credentialReader.getCredential(ServerSettings.getDefaultUserGateway(),
 credentialStoreToken);
+                               
requestData.setMyProxyUserName(credential.getCommunityUser().getUserName());
+                }
+                               
                 GsisshHostType gsisshHostType = (GsisshHostType) 
registeredHost.getType();
                 String key = requestData.getMyProxyUserName() + 
registeredHost.getType().getHostAddress() +
                         gsisshHostType.getPort();
@@ -105,7 +115,7 @@ public class GFACGSISSHUtils {
                                 recreate = true; // we make the pbsCluster to 
create again if there is any exception druing connection
                             }
                             logger.info("Re-using the same connection used 
with the connection string:" + key);
-                            context = new 
GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData, 
pbsCluster);
+                          context = new GSISecurityContext(credentialReader, 
requestData, pbsCluster);
                         }
                     } else {
                         recreate = true;

Reply via email to