You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/06/16 13:38:40 UTC

[2/3] airavata git commit: MigrationManager: allow connecting to secure Airavata

MigrationManager: allow connecting to secure Airavata


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

Branch: refs/heads/develop
Commit: 225b09c1ffa570cf9d8f7f895cbd4e2059c14976
Parents: 0429d37
Author: Marcus Christie <ma...@apache.org>
Authored: Fri Jun 16 09:34:06 2017 -0400
Committer: Marcus Christie <ma...@apache.org>
Committed: Fri Jun 16 09:34:06 2017 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/airavata/MigrationManager.java | 9 ++++++++-
 .../user-profile-migration.properties.template              | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/225b09c1/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
index b8baeaf..524c024 100644
--- a/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
@@ -56,6 +56,7 @@ public class MigrationManager {
     private int profileServiceServerPort = 8962;
     private String airavataServiceServerHost = "localhost";
     private int airavataServiceServerPort = 8930;
+    private boolean airavataServiceSecure = false;
     private Map<String,String> roleConversionMap = createDefaultRoleConversionMap();
     private String gatewayId = "gateway-id";
     private String wso2ISAdminUsername = "username";
@@ -89,6 +90,7 @@ public class MigrationManager {
     private final static String WSO2IS_GATEWAY_PROVIDER_ROLENAME = "wso2is.gateway-provider.rolename";
     private final static String AIRAVATA_SERVICE_HOST = "airavata.service.host";
     private final static String AIRAVATA_SERVICE_PORT = "airavata.service.port";
+    private final static String AIRAVATA_SERVICE_SECURE = "airavata.service.secure";
     private final static String PROFILE_SERVICE_HOST = "profile.service.host";
     private final static String PROFILE_SERVICE_PORT = "profile.service.port";
     private final static String KEYCLOAK_ADMIN_USERNAME = "keycloak.admin.username";
@@ -202,6 +204,10 @@ public class MigrationManager {
         return AiravataClientFactory.createAiravataClient(airavataServiceServerHost, airavataServiceServerPort);
     }
 
+    private Airavata.Client getAiravataSecureClient() throws AiravataClientException {
+        return AiravataClientFactory.createAiravataSecureClient(airavataServiceServerHost, airavataServiceServerPort, keycloakTrustStorePath, keycloakTrustStorePassword, 10000);
+    }
+
     private IamAdminServices.Client getIamAdminServicesClient() throws IamAdminServicesException {
         return ProfileServiceClientFactory.createIamAdminServiceClient(profileServiceServerHost, profileServiceServerPort);
     }
@@ -218,7 +224,7 @@ public class MigrationManager {
     private boolean migrateGatewayProfileToAiravata() throws TException {
 
         TenantProfileService.Client tenantProfileServiceClient = getTenantProfileServiceClient();
-        Airavata.Client airavataClient = getAiravataClient();
+        Airavata.Client airavataClient = airavataServiceSecure ? getAiravataSecureClient() : getAiravataClient();
         IamAdminServices.Client iamAdminServicesClient = getIamAdminServicesClient();
 
         // Get Gateway from Airavata API
@@ -318,6 +324,7 @@ public class MigrationManager {
             this.wso2ISAdminPassword = properties.getProperty(WSO2IS_ADMIN_PASSWORD, this.wso2ISAdminPassword);
             this.airavataServiceServerHost = properties.getProperty(AIRAVATA_SERVICE_HOST, this.airavataServiceServerHost);
             this.airavataServiceServerPort = Integer.valueOf(properties.getProperty(AIRAVATA_SERVICE_PORT, Integer.toString(this.airavataServiceServerPort)));
+            this.airavataServiceSecure = Boolean.valueOf(properties.getProperty(AIRAVATA_SERVICE_SECURE, "false"));
             this.profileServiceServerHost = properties.getProperty(PROFILE_SERVICE_HOST, this.profileServiceServerHost);
             this.profileServiceServerPort = Integer.valueOf(properties.getProperty(PROFILE_SERVICE_PORT, Integer.toString(this.profileServiceServerPort)));
             this.keycloakServiceURL = properties.getProperty(KEYCLOAK_SERVICE_URL, this.keycloakServiceURL);

http://git-wip-us.apache.org/repos/asf/airavata/blob/225b09c1/modules/user-profile-migration/user-profile-migration.properties.template
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/user-profile-migration.properties.template b/modules/user-profile-migration/user-profile-migration.properties.template
index aeacef5..86e664c 100644
--- a/modules/user-profile-migration/user-profile-migration.properties.template
+++ b/modules/user-profile-migration/user-profile-migration.properties.template
@@ -19,6 +19,7 @@ wso2is.gateway-provider.rolename = gateway-provider
 # Airavata Service settings
 airavata.service.host = localhost
 airavata.service.port = 8930
+airavata.service.secure = false
 
 # Profile Service settings
 profile.service.host = localhost