use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class RegisterUS3Application method registerApplicationDeployment.
public static void registerApplicationDeployment() {
try {
System.out.println("#### Registering Application Deployments on Stampede #### \n");
// Register Stampede
String ultascanStamplede = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, stampedeResourceId, "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
System.out.println("Ultrascan on stampede deployment Id " + ultascanStamplede);
String ultascanTrestles = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, trestlesResourceId, "/home/us3/trestles/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
System.out.println("Ultrascan on trestles deployment Id " + ultascanTrestles);
String ultascanLonestar = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, lonestarResourceId, "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
System.out.println("Ultrascan on lonestar deployment Id " + ultascanLonestar);
String ultascanAlamo = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, alamoResourceId, "/home/us3/bin/us_mpi_analysis.sh", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
System.out.println("Ultrascan on alamo deployment Id " + ultascanAlamo);
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class MigrationManager method migrateUserProfilesToAiravata.
/* Method used to migrate User profiles to Airavata DB by making a call to User profile thrift Service */
private boolean migrateUserProfilesToAiravata(List<UserProfileDAO> ISProfileList) throws TException, ApplicationSettingsException {
System.out.println("Initiating migration to Airavata internal DB ...");
UserProfileService.Client client = ProfileServiceClientFactory.createUserProfileServiceClient(profileServiceServerHost, profileServiceServerPort);
UserProfile airavataUserProfile = new UserProfile();
// Here are the data associations...
for (UserProfileDAO ISProfile : ISProfileList) {
airavataUserProfile.setAiravataInternalUserId(ISProfile.getUserName() + "@" + ISProfile.getGatewayID());
airavataUserProfile.setFirstName(ISProfile.getFirstName());
airavataUserProfile.setLastName(ISProfile.getLastName());
airavataUserProfile.setUserId(ISProfile.getUserName());
airavataUserProfile.setGatewayId(ISProfile.getGatewayID());
List<String> emails = new ArrayList<String>();
emails.add(ISProfile.getEmail());
airavataUserProfile.setEmails(emails);
airavataUserProfile.setHomeOrganization(ISProfile.getOrganization());
airavataUserProfile.setPhones(ISProfile.getPhones());
airavataUserProfile.setCountry(ISProfile.getCountry());
airavataUserProfile.setCreationTime(new Date().getTime());
airavataUserProfile.setLastAccessTime(new Date().getTime());
airavataUserProfile.setValidUntil(-1);
airavataUserProfile.setState(Status.ACTIVE);
// 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;
}
Aggregations