Package org.apache.airavata.credential.store.credential.impl.ssh

Examples of org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential


                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) {
View Full Code Here


        Credential credential = getCredentialReader().getCredential(getRequestData().getGatewayId(),
                getRequestData().getTokenId());

        if (credential instanceof SSHCredential) {
            SSHCredential credential1 = (SSHCredential) credential;
            this.publicKeyFile = writeFileToDisk(credential1.getPublicKey());
            this.privateKeyFile = writeFileToDisk(credential1.getPrivateKey());
            this.passPhrase = credential1.getPassphrase();
            System.out.println(this.publicKeyFile);
            System.out.println(this.privateKeyFile);
            System.out.println(this.passPhrase);
            this.getRequestData().setRequestUser(credential1.getPortalUserName());
            return credential1;
        } else {
            log.info("Could not find SSH credentials for token - " + getRequestData().getTokenId() + " and "
                    + "gateway id - " + getRequestData().getGatewayId());
        }
View Full Code Here

        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);
        this.getRequestData().setRequestUser(sshUserName);
        return new SSHCredential(sshPrivateKey.getBytes(), sshPublicKey.getBytes(), sshPrivateKeyPass, requestData.getGatewayId(), sshUserName);
    }
View Full Code Here

  @Override
  public boolean isCredentialExist(String gatewayId, String tokenId)
      throws RegException {
    try {
      credentialReader = new CredentialReaderImpl(getDBConnector());
      SSHCredential credential = (SSHCredential) credentialReader.getCredential(gatewayId, tokenId);
        if (credential!=null) {
          return true;
        }
    } catch (ApplicationSettingsException e1) {
      return false;
View Full Code Here

  @Override
  public String getCredentialPublicKey(String gatewayId, String tokenId)
      throws RegException {
    try {
      credentialReader = new CredentialReaderImpl(getDBConnector());
      SSHCredential credential = (SSHCredential) credentialReader.getCredential(gatewayId, tokenId);
        if (credential!=null) {
          return new String(credential.getPublicKey());
        }
    }catch (ApplicationSettingsException e1) {
      return null;
    }
    catch(CredentialStoreException e) {
View Full Code Here

  public String createCredential(String gatewayId, String tokenId,
      String username) throws RegException {
      try {
        credentialWriter = new SSHCredentialWriter(getDBConnector());
          credentialGenerator = new SSHCredentialGenerator();
          SSHCredential credential = credentialGenerator.generateCredential(tokenId);
        if (credential!=null) {
          credential.setGateway(gatewayId);
          credential.setToken(tokenId);
          credential.setPortalUserName(username);
            credentialWriter.writeCredentials(credential);
            return new String(credential.getPublicKey());
        }
      }catch (ApplicationSettingsException e1) {
      return null;
    }
      catch (CredentialStoreException e) {
View Full Code Here

  @Override
  public boolean isCredentialExist(String gatewayId, String tokenId)
      throws RegException {
    try {
      credentialReader = new CredentialReaderImpl(getDBConnector());
      SSHCredential credential = (SSHCredential) credentialReader.getCredential(gatewayId, tokenId);
        if (credential!=null) {
          return true;
        }
    } catch (ApplicationSettingsException e1) {
      return false;
View Full Code Here

  @Override
  public String getCredentialPublicKey(String gatewayId, String tokenId)
      throws RegException {
    try {
      credentialReader = new CredentialReaderImpl(getDBConnector());
      SSHCredential credential = (SSHCredential) credentialReader.getCredential(gatewayId, tokenId);
        if (credential!=null) {
          return new String(credential.getPublicKey());
        }
    }catch (ApplicationSettingsException e1) {
      return null;
    }
    catch(CredentialStoreException e) {
View Full Code Here

  public String createCredential(String gatewayId, String tokenId,
      String username) throws RegException {
      try {
        credentialWriter = new SSHCredentialWriter(getDBConnector());
          credentialGenerator = new SSHCredentialGenerator();
          SSHCredential credential = credentialGenerator.generateCredential(tokenId);
        if (credential!=null) {
          credential.setGateway(gatewayId);
          credential.setToken(tokenId);
          credential.setPortalUserName(username);
            credentialWriter.writeCredentials(credential);
            return new String(credential.getPublicKey());
        }
      }catch (ApplicationSettingsException e1) {
      return null;
    }
      catch (CredentialStoreException e) {
View Full Code Here

    }

    public void writeCredentials(Credential credential) throws CredentialStoreException {

        SSHCredential sshCredential = (SSHCredential) credential;
        Connection connection = null;

        try {
            connection = dbUtil.getConnection();
            // First delete existing credentials
            credentialsDAO.deleteCredentials(sshCredential.getGateway(), sshCredential.getToken(), connection);
            // Add the new certificate
            credentialsDAO.addCredentials(sshCredential.getGateway(), credential, connection);

            if (!connection.getAutoCommit()) {
                connection.commit();
            }
View Full Code Here

TOP

Related Classes of org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential

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.