airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r1431663 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/ airavata-client/src/main/resources/ airavata-client/src/test/resources/ commons/utils/src/main/java/org/apache/airavata/common/utils/ distribut...
Date Thu, 10 Jan 2013 21:30:47 GMT
Author: amilaj
Date: Thu Jan 10 21:30:47 2013
New Revision: 1431663

URL: http://svn.apache.org/viewvc?rev=1431663&view=rev
Log:
Fixing AIRAVATA-719. Enabling client to work over HTTPS

Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
    airavata/trunk/modules/airavata-client/src/main/resources/airavata-client.properties
    airavata/trunk/modules/airavata-client/src/test/resources/airavata-client.properties
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ClientSettings.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java
    airavata/trunk/modules/distribution/airavata-client/src/main/resources/conf/airavata-client.properties
    airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/conf/airavata-client.properties
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-client.properties
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/resources/airavata-client.properties

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
(original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
Thu Jan 10 21:30:47 2013
@@ -26,6 +26,7 @@ import java.net.URI;
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.impl.PasswordCallBackImpl;
+import org.apache.airavata.common.utils.SecurityUtil;
 import org.apache.airavata.registry.api.PasswordCallback;
 
 public class AiravataAPIFactory {
@@ -41,6 +42,14 @@ public class AiravataAPIFactory {
 	public static AiravataAPI getAPI(URI registryURL, String gateway, String username, PasswordCallback
callback) throws AiravataAPIInvocationException{
         return getAPI(registryURL, gateway, username, username, callback);
     }
+
+    public static AiravataAPI getAPI(URI registryURL, String gateway, String username, PasswordCallback
callback,
+                                     String trustStoreFilePath, String trustStorePassword)
+            throws AiravataAPIInvocationException{
+
+        SecurityUtil.setTrustStoreParameters(trustStoreFilePath, trustStorePassword);
+        return getAPI(registryURL, gateway, username, username, callback);
+    }
     
     public static AiravataAPI getAPI(URI registryURL, String gateway, String username, String
alternateUsername, PasswordCallback callback) throws AiravataAPIInvocationException{
         try {

Modified: airavata/trunk/modules/airavata-client/src/main/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/resources/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/resources/airavata-client.properties (original)
+++ airavata/trunk/modules/airavata-client/src/main/resources/airavata-client.properties Thu
Jan 10 21:30:47 2013
@@ -53,6 +53,9 @@ xbaya.registry.user=admin
 xbaya.registry.url=http://localhost:8080/airavata-registry/api
 xbaya.default.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #user defined registry accessor classes
 #class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
 #class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry

Modified: airavata/trunk/modules/airavata-client/src/test/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/test/resources/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/test/resources/airavata-client.properties (original)
+++ airavata/trunk/modules/airavata-client/src/test/resources/airavata-client.properties Thu
Jan 10 21:30:47 2013
@@ -47,6 +47,9 @@ default.registry.user=admin
 default.registry.password=admin
 default.registry.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
Thu Jan 10 21:30:47 2013
@@ -39,6 +39,10 @@ public abstract class ApplicationSetting
 	private static Properties properties = new Properties();
     private static Exception propertyLoadException;
 
+
+    protected static final String TRUST_STORE_PATH="trust.store";
+    protected static final String TRUST_STORE_PASSWORD="trust.store.password";
+
     private final static Logger logger = LoggerFactory.getLogger(ApplicationSettings.class);
 
     static{
@@ -112,4 +116,16 @@ public abstract class ApplicationSetting
     	validateSuccessfulPropertyFileLoad();
     	return properties.containsKey(key);
     }
+
+    public static String getTrustStorePath() throws ApplicationSettingsException {
+        return getSetting(TRUST_STORE_PATH);
+    }
+
+    public static String getTrustStorePassword() throws ApplicationSettingsException {
+        return getSetting(TRUST_STORE_PASSWORD);
+    }
+
+    public static void initializeTrustStore() throws ApplicationSettingsException {
+        SecurityUtil.setTrustStoreParameters(getTrustStorePath(), getTrustStorePassword());
+    }
 }

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ClientSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ClientSettings.java?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ClientSettings.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ClientSettings.java
Thu Jan 10 21:30:47 2013
@@ -21,6 +21,8 @@
 
 package org.apache.airavata.common.utils;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+
 public class ClientSettings extends ApplicationSettings {
 
 }

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java
Thu Jan 10 21:30:47 2013
@@ -1,5 +1,8 @@
 package org.apache.airavata.common.utils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
@@ -10,6 +13,8 @@ public class SecurityUtil {
 
     public static final String PASSWORD_HASH_METHOD_PLAINTEXT = "PLAINTEXT";
 
+    private static final Logger logger = LoggerFactory.getLogger(SecurityUtil.class);
+
     /**
      * Creates a hash of given string with the given hash algorithm.
      * @param stringToDigest The string to digest.
@@ -27,4 +32,18 @@ public class SecurityUtil {
         MessageDigest messageDigest = MessageDigest.getInstance(digestingAlgorithm);
         return new String(messageDigest.digest(stringToDigest.getBytes()));
     }
+
+    /**
+     * Sets the truststore for application. Useful when communicating over HTTPS.
+     * @param trustStoreFilePath Where trust store is located.
+     * @param trustStorePassword The trust store password.
+     */
+    public static void setTrustStoreParameters(String trustStoreFilePath, String trustStorePassword)
{
+
+        logger.info("Setting Java trust store to " + trustStoreFilePath);
+
+        System.setProperty("javax.net.ssl.trustStrore", trustStoreFilePath);
+        System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
+
+    }
 }

Modified: airavata/trunk/modules/distribution/airavata-client/src/main/resources/conf/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/airavata-client/src/main/resources/conf/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/airavata-client/src/main/resources/conf/airavata-client.properties
(original)
+++ airavata/trunk/modules/distribution/airavata-client/src/main/resources/conf/airavata-client.properties
Thu Jan 10 21:30:47 2013
@@ -53,6 +53,9 @@ xbaya.registry.user=admin
 xbaya.registry.url=http://localhost:8080/airavata-registry/api
 xbaya.default.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #user defined registry accessor classes
 #class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
 #class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry

Modified: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/conf/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/conf/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/conf/airavata-client.properties
(original)
+++ airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/conf/airavata-client.properties
Thu Jan 10 21:30:47 2013
@@ -53,6 +53,9 @@ xbaya.registry.user=admin
 xbaya.registry.url=http://localhost:8080/airavata-registry/api
 xbaya.default.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #user defined registry accessor classes
 #class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
 #class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties
Thu Jan 10 21:30:47 2013
@@ -48,6 +48,9 @@ default.registry.password=admin
 default.registry.password.hash.method=SHA
 default.registry.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

Modified: airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-client.properties
(original)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-client.properties
Thu Jan 10 21:30:47 2013
@@ -48,6 +48,9 @@ default.registry.password=admin
 default.registry.password.hash.method=SHA
 default.registry.gateway=default
 
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
Thu Jan 10 21:30:47 2013
@@ -187,6 +187,12 @@ public class RegistryWindow {
             e.printStackTrace();
         }
 
+        try {
+            ClientSettings.initializeTrustStore();
+        } catch (ApplicationSettingsException e) {
+            throw new RuntimeException("An error occurred while initializing client configurations");
+        }
+
         this.passwordTextField.setText(engine.getConfiguration().getRegistryPassphrase());
         XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
         XBayaLabel gatewayLabel = new XBayaLabel("Gateway", this.gatewayTextField);

Modified: airavata/trunk/modules/xbaya-gui/src/main/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/resources/airavata-client.properties?rev=1431663&r1=1431662&r2=1431663&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/resources/airavata-client.properties (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/resources/airavata-client.properties Thu Jan
10 21:30:47 2013
@@ -53,6 +53,10 @@ xbaya.registry.user=admin
 xbaya.registry.url=http://localhost:8080/airavata-registry/api
 xbaya.default.gateway=default
 
+
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
 #user defined registry accessor classes
 #class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
 #class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry



Mime
View raw message