Examples of SSHSecurityContext


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

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

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

          }
          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

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

            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

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

        } 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

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

        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

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

            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

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

        try {
            GSISecurityContext securityContext = (GSISecurityContext) monitorID.getJobExecutionContext().getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
            if(securityContext != null) {
                cluster = (PBSCluster) securityContext.getPbsCluster();
            }else {
                SSHSecurityContext sshSecurityContext = (SSHSecurityContext) monitorID.getJobExecutionContext().getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
                cluster = (PBSCluster)sshSecurityContext.getPbsCluster();
            }

            // we just use cluster configuration from the incoming request and construct a new cluster because for monitoring
            // we are using our own credentials and not using one users account to do everything.
            authenticationInfo = authInfo;
View Full Code Here

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

        HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
        if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
                || registeredHost.getType() instanceof GsisshHostType) {
            logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
        } else if (registeredHost.getType() instanceof SSHHostType) {
            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
            String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
            RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
            requestData.setTokenId(credentialStoreToken);

            ServerInfo serverInfo = new ServerInfo(null, registeredHost.getType().getHostAddress());

            Cluster pbsCluster = null;
            try {
                TokenizedSSHAuthInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(requestData);
                String installedParentPath = "/";
                if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
                    installedParentPath = ((HpcApplicationDeploymentType)
                            jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
                }
                SSHCredential credentials = tokenizedSSHAuthInfo.getCredentials();// this is just a call to get and set credentials in to this object,data will be used
                serverInfo.setUserName(credentials.getPortalUserName());

                // inside the pbsCluser object
                pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,
                        CommonUtils.getPBSJobManager(installedParentPath));
            } catch (Exception e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            sshSecurityContext.setPbsCluster(pbsCluster);
            jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
        }
    }
View Full Code Here

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

        }
        // Server info
        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);

        Cluster pbsCluster = null;
        SSHSecurityContext sshSecurityContext = null;

            JobManagerConfiguration pbsJobManager = CommonUtils.getPBSJobManager(app.getInstalledParentPath());
            pbsCluster = new PBSCluster(serverInfo, authenticationInfo, pbsJobManager);


            sshSecurityContext = new SSHSecurityContext();
            sshSecurityContext.setPbsCluster(pbsCluster);
            sshSecurityContext.setUsername(userName);
            sshSecurityContext.setKeyPass(passPhrase);
            sshSecurityContext.setPrivateKeyLoc(privateKeyPath);
             return sshSecurityContext;
        } catch (SSHApiException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }
        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.