Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 87608D716 for ; Wed, 15 May 2013 15:50:48 +0000 (UTC) Received: (qmail 1372 invoked by uid 500); 15 May 2013 15:50:48 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 1324 invoked by uid 500); 15 May 2013 15:50:48 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 1317 invoked by uid 99); 15 May 2013 15:50:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 May 2013 15:50:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 May 2013 15:50:47 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 693FD2388847; Wed, 15 May 2013 15:50:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@airavata.apache.org From: amilaj@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130515155027.693FD2388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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);