airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r1482919 - in /airavata/trunk/modules: gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
Date Wed, 15 May 2013 15:50:27 GMT
Author: amilaj
Date: Wed May 15 15:50:27 2013
New Revision: 1482919

URL: http://svn.apache.org/r1482919
Log:
Added code to initialize credential reader only if security context is present.

Modified:
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java?rev=1482919&r1=1482918&r2=1482919&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
Wed May 15 15:50:27 2013
@@ -62,7 +62,7 @@ public class GSISecurityContext extends 
         myProxyManager = new MyProxyManager(configuration);
     }
 
-    public GSISecurityContext(Properties configuration) throws GFacException {
+    public GSISecurityContext(Properties configuration) {
 
         myProxyManager = new MyProxyManager(configuration);
     }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java?rev=1482919&r1=1482918&r2=1482919&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
Wed May 15 15:50:27 2013
@@ -79,6 +79,7 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.URIParameterType;
 import org.apache.airavata.schemas.gfac.UnicoreHostType;
 import org.apache.airavata.schemas.wec.ContextHeaderDocument;
+import org.apache.airavata.schemas.wec.SecurityContextDocument;
 import org.apache.airavata.workflow.model.exceptions.WorkflowException;
 import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable;
@@ -376,20 +377,48 @@ public class EmbeddedGFacInvoker impleme
         return true;
     }
 
+    private SecurityContextDocument.SecurityContext.CredentialManagementService getCredentialManagementService(
+            JobExecutionContext jobExecutionContext) {
+
+        if (jobExecutionContext.getContextHeader() != null) {
+
+            SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
+                    = jobExecutionContext.getContextHeader().getSecurityContext().getCredentialManagementService();
+
+           if (credentialManagementService != null) {
+               return credentialManagementService;
+           }
+        }
+
+        return null;
+    }
+
 	private void addSecurityContext(HostDescription registeredHost, Properties configurationProperties,
 			JobExecutionContext jobExecutionContext) {
 		if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof
UnicoreHostType) {
 
-            String tokenId
-                    = jobExecutionContext.getContextHeader().getSecurityContext().
-                    getCredentialManagementService().getTokenId();
-            String gatewayUser = jobExecutionContext.getContextHeader().getSecurityContext().
-                    getCredentialManagementService().getPortalUser();
+            SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
+                    = getCredentialManagementService(jobExecutionContext);
 
-            String gatewayId = jobExecutionContext.getGFacConfiguration().getAiravataAPI().getGateway();
+            GSISecurityContext context;
+
+            if (credentialManagementService != null) {
+                String tokenId
+                        = jobExecutionContext.getContextHeader().getSecurityContext().
+                        getCredentialManagementService().getTokenId();
+                String gatewayUser = jobExecutionContext.getContextHeader().getSecurityContext().
+                        getCredentialManagementService().getPortalUser();
+
+                String gatewayId = jobExecutionContext.getGFacConfiguration().getAiravataAPI().getGateway();
+
+                context = new GSISecurityContext(configurationProperties, tokenId, gatewayId,
+                        gatewayUser);
+
+            } else {
+
+                context = new GSISecurityContext(configurationProperties);
+            }
 
-			GSISecurityContext context = new GSISecurityContext(configurationProperties, tokenId,
gatewayId,
-                    gatewayUser);
 
 			jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, context);
 



Mime
View raw message