Package org.apache.airavata.gfac.context.security

Examples of org.apache.airavata.gfac.context.security.SSHSecurityContext


      if (this.configuration.getAmazonSecurityContext() != null) {
        jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
            this.configuration.getAmazonSecurityContext());
      }
    } else if (registeredHost.getType() instanceof SSHHostType) {
      SSHSecurityContext context = new SSHSecurityContext();
      context.setUsername(configurationProperties.getProperty(Constants.SSH_USER_NAME));
      context.setPrivateKeyLoc(configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY));
      context.setKeyPass(configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS));
      jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, context);

    }
  }
View Full Code Here


      if (this.configuration.getAmazonSecurityContext() != null) {
        jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
            this.configuration.getAmazonSecurityContext());
      }
    } else if (registeredHost.getType() instanceof SSHHostType) {
      SSHSecurityContext context = new SSHSecurityContext();
      context.setUsername(configurationProperties.getProperty(Constants.SSH_USER_NAME));
      context.setPrivateKeyLoc(configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY));
      context.setKeyPass(configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS));
      jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, context);

    }
  }
View Full Code Here

          }
          jobExecutionContext.setInMessageContext(inputNew);
  }

    private static String stageInputFiles(JobExecutionContext context, String paramValue) throws IOException, GFacException {
        SSHSecurityContext securityContext = (SSHSecurityContext)context.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
        Cluster pbsCluster = securityContext.getPbsCluster();
        ApplicationDeploymentDescriptionType app = context.getApplicationContext().getApplicationDeploymentDescription().getType();
        int i = paramValue.lastIndexOf(File.separator);
        String substring = paramValue.substring(i + 1);
        try {
            String targetFile = app.getInputDataDirectory()+ File.separator + substring;
View Full Code Here

            String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
            String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
            String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
            String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
            String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
            if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
                AuthenticationInfo authenticationInfo = null;
                // we give higher preference to the password over keypair ssh authentication
                if (sshPassword != null) {
                    authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
                } else {
                    authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
                }
                ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());

                Cluster pbsCluster = null;
                try {
                    String installedParentPath = ((HpcApplicationDeploymentType)
                            jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
                    pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
                            (CommonUtils.getPBSJobManager(installedParentPath)));
                } catch (SSHApiException e) {
                    e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                }
                sshSecurityContext.setPbsCluster(pbsCluster);
                sshSecurityContext.setUsername(sshUserName);
            } else {
                sshSecurityContext = new SSHSecurityContext();
                sshSecurityContext.setUsername(sshUserName);
                sshSecurityContext.setPrivateKeyLoc(sshPrivateKey);
                sshSecurityContext.setKeyPass(sshPrivateKeyPass);
            }
            jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
    }
View Full Code Here

        } catch (SSHApiException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }


        SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
        sshSecurityContext.setPbsCluster(pbsCluster);
        sshSecurityContext.setUsername(userName);
        return sshSecurityContext;
    }
View Full Code Here

        jobExecutionContext.setOutMessageContext(outMessage);

    }

  private SSHSecurityContext getSecurityContext() {
    SSHSecurityContext context = new SSHSecurityContext();
        context.setUsername("lginnali");
        context.setPrivateKeyLoc("~/.ssh/id_dsa");
        context.setKeyPass("i want to be free");
    return context;
  }
View Full Code Here

            String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
            String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
            String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
            String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
            String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
            if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
                AuthenticationInfo authenticationInfo = null;
                // we give higher preference to the password over keypair ssh authentication
                if (sshPassword != null) {
                    authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
                } else {
                    authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
                }
                ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());

                Cluster pbsCluster = null;
                try {
                    pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
                            (((HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath()));
                } catch (SSHApiException e) {
                    e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                }
                sshSecurityContext.setPbsCluster(pbsCluster);
                sshSecurityContext.setUsername(sshUserName);
            } else {
                sshSecurityContext = new SSHSecurityContext();
                sshSecurityContext.setUsername(sshUserName);
                sshSecurityContext.setPrivateKeyLoc(sshPrivateKey);
                sshSecurityContext.setKeyPass(sshPrivateKeyPass);
            }
            jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.gfac.context.security.SSHSecurityContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.