MigrationManager: populate claims map for adding user profile
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3ed78805 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3ed78805 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3ed78805 Branch: refs/heads/develop Commit: 3ed7880517499b29856efdb25d6d0e63b11a2494 Parents: ae2e0e6 Author: Marcus Christie <[email protected]> Authored: Fri Jun 16 10:53:04 2017 -0400 Committer: Marcus Christie <[email protected]> Committed: Fri Jun 16 10:53:04 2017 -0400 ---------------------------------------------------------------------- .../src/main/java/org/apache/airavata/MigrationManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/3ed78805/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 5168cb9..067cdd1 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 @@ -22,6 +22,7 @@ package org.apache.airavata; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.Constants; import org.apache.airavata.model.credential.store.PasswordCredential; import org.apache.airavata.model.error.AiravataClientException; import org.apache.airavata.model.security.AuthzToken; @@ -295,7 +296,12 @@ public class MigrationManager { airavataUserProfile.setLastAccessTime(new Date().getTime()); airavataUserProfile.setValidUntil(-1); airavataUserProfile.setState(Status.ACTIVE); - //TODO: fix authtzToken, for now we are using empty token + //TODO: fix authtzToken, for now we are using empty token, but need to properly populate claims map + AuthzToken authzToken = new AuthzToken("dummy_token"); + Map<String,String> claimsMap = new HashMap<>(); + claimsMap.put(Constants.USER_NAME, ISProfile.getUserName()); + claimsMap.put(Constants.GATEWAY_ID, ISProfile.getGatewayID()); + authzToken.setClaimsMap(claimsMap); client.addUserProfile(authzToken, airavataUserProfile); } return false;
