You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2013/03/26 03:52:16 UTC

svn commit: r1460957 - in /airavata/sandbox/grid-tools/gsi-myproxy-client: ./ src/main/java/org/apache/airavata/security/myproxy/

Author: smarru
Date: Tue Mar 26 02:52:16 2013
New Revision: 1460957

URL: http://svn.apache.org/r1460957
Log:
Updating test client to released version of jglobus 2.0.5

Modified:
    airavata/sandbox/grid-tools/gsi-myproxy-client/pom.xml
    airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/CertificateManager.java
    airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyCredentials.java
    airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyLogon.java

Modified: airavata/sandbox/grid-tools/gsi-myproxy-client/pom.xml
URL: http://svn.apache.org/viewvc/airavata/sandbox/grid-tools/gsi-myproxy-client/pom.xml?rev=1460957&r1=1460956&r2=1460957&view=diff
==============================================================================
Binary files - no diff available.

Modified: airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/CertificateManager.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/CertificateManager.java?rev=1460957&r1=1460956&r2=1460957&view=diff
==============================================================================
--- airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/CertificateManager.java (original)
+++ airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/CertificateManager.java Tue Mar 26 02:52:16 2013
@@ -27,7 +27,7 @@ import java.security.cert.X509Certificat
 import java.util.ArrayList;
 import java.util.List;
 
-import org.globus.gsi.CertUtil;
+import org.globus.gsi.util.CertificateLoadUtil;
 import org.globus.util.ClassLoaderUtils;
 
 public class CertificateManager {
@@ -72,8 +72,7 @@ public class CertificateManager {
         while (true) {
             X509Certificate certificate;
             try {
-                certificate = CertUtil.loadCertificate(stream);
-                // certificate = CertificateLoadUtil.loadCertificate(stream); //**
+                certificate = CertificateLoadUtil.loadCertificate(stream);
             } catch (GeneralSecurityException e) {
                 String message = "Certificates are invalid";
                 throw new RuntimeException(message, e);

Modified: airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyCredentials.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyCredentials.java?rev=1460957&r1=1460956&r2=1460957&view=diff
==============================================================================
--- airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyCredentials.java (original)
+++ airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyCredentials.java Tue Mar 26 02:52:16 2013
@@ -25,12 +25,14 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.Serializable;
+import java.security.KeyStore;
 import java.security.cert.X509Certificate;
 
 import org.apache.log4j.Logger;
-import org.globus.gsi.GlobusCredential;
-import org.globus.gsi.TrustedCertificates;
+import org.globus.gsi.X509Credential;
 import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
+import org.globus.gsi.provider.GlobusProvider;
+import org.globus.gsi.provider.KeyStoreParametersFactory;
 import org.globus.myproxy.MyProxy;
 import org.ietf.jgss.GSSCredential;
 
@@ -75,10 +77,8 @@ public class MyProxyCredentials implemen
         try {
             if (hostcertsKeyFile != null && !user) {
                 fis = new FileInputStream(hostcertsKeyFile);
-                // X509Credential globusCred = new X509Credential(fis); //**
-                GlobusCredential globusCred = new GlobusCredential(fis);
-                this.gssCredential = new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
-
+                X509Credential x509Cred = new X509Credential(fis);
+                this.gssCredential = new GlobusGSSCredentialImpl(x509Cred, GSSCredential.INITIATE_AND_ACCEPT);
             } else {
                 this.gssCredential = getDefaultProxy();
             }
@@ -112,17 +112,21 @@ public class MyProxyCredentials implemen
     private void init() {
         if (trustedCertsFile != null) {
             if (new File(trustedCertsFile).isDirectory()) {
-                TrustedCertificates certificates = TrustedCertificates.load(trustedCertsFile);
-                TrustedCertificates.setDefaultTrustedCertificates(certificates);
-            } else {
+    			try {
+            	KeyStore trustStore = KeyStore.getInstance(
+    					GlobusProvider.KEYSTORE_TYPE,
+    					GlobusProvider.PROVIDER_NAME);
+    			trustStore.load(KeyStoreParametersFactory
+    					.createTrustStoreParameters(trustedCertsFile + "/*.0"));
                 this.trustedCertificates = CertificateManager.getTrustedCertificate(trustedCertsFile);
-
-                TrustedCertificates certificatesArray = new TrustedCertificates(this.trustedCertificates);
-                TrustedCertificates.setDefaultTrustedCertificates(certificatesArray);
-            }
+    			} catch (Exception e) {
+    				e.printStackTrace(); 
+    			}
+                }
         }
     }
 
+    
     public GSSCredential renewProxy() throws Exception {
         init();
 
@@ -133,10 +137,10 @@ public class MyProxyCredentials implemen
             int lifeHours = myproxyLifeTime * SECS_PER_HOUR;
             GSSCredential proxy = myproxy.get(myproxyUserName, myproxyPassword, lifeHours);
 
-            GlobusCredential globusCred = null; // **
+            X509Credential globusCred = null; // **
             // X509Credential globusCred = null; //**
             if (proxy instanceof GlobusGSSCredentialImpl) {
-                globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();// **
+                globusCred = ((GlobusGSSCredentialImpl) proxy).getX509Credential();// **
                 // globusCred = ((GlobusGSSCredentialImpl) proxy).getX509Credential();//**
                 log.info("got proxy from myproxy for " + myproxyUserName + " with " + myproxyLifeTime + " lifetime.");
                 String uid = myproxyUserName;

Modified: airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyLogon.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyLogon.java?rev=1460957&r1=1460956&r2=1460957&view=diff
==============================================================================
--- airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyLogon.java (original)
+++ airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/MyProxyLogon.java Tue Mar 26 02:52:16 2013
@@ -21,9 +21,7 @@
 
 package org.apache.airavata.security.myproxy;
 
-import java.io.File;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.Properties;
 
 import org.apache.log4j.Logger;
@@ -35,7 +33,6 @@ public class MyProxyLogon {
     /**
 	 * 
 	 */
-    private static final long serialVersionUID = -2270092298283648553L;
     public static final String MYPROXYCLIENT_PROPERTY = "airavata-myproxy-client.properties";
     private Properties properties;
     protected GSSCredential gssCredential;
@@ -91,23 +88,13 @@ public class MyProxyLogon {
     /**
      * Load the configration file
      * 
-     * @throws GfacException
+     * @throws Exception
      */
     private void loadConfiguration() throws Exception {
         try {
             if (properties == null) {
                 ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-                File webinfDir = null;
-                URL propertyFile = classLoader.getResource(MYPROXYCLIENT_PROPERTY);
-
-                if (propertyFile != null) {
-                    File tempFile = new File(propertyFile.getFile());
-                    if (tempFile.exists()) {
-                        webinfDir = tempFile.getParentFile().getParentFile();
-                    }
-                } else {
-                    throw new Exception(" Not able to locate " + MYPROXYCLIENT_PROPERTY);
-                }
+ 
                 InputStream propertyStream = classLoader.getResourceAsStream(MYPROXYCLIENT_PROPERTY);
                 properties = new Properties();
                 if (credentials == null) {