Package org.globus.gsi

Examples of org.globus.gsi.GlobusCredential


        init();
       
        String proxyloc = null;
        MyProxy myproxy = new MyProxy(hostname, port);
        GSSCredential proxy = myproxy.get(username, password, lifetime);
        GlobusCredential globusCred = null;
        if (proxy instanceof GlobusGSSCredentialImpl) {
            globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();
            log.debug("got proxy from myproxy for " + username + " with " + lifetime + " lifetime.");
            String uid = username;
            // uid = XpolaUtil.getSysUserid();
            log.debug("uid: " + uid);
            proxyloc = "/tmp/x509up_u" + uid + UUID.randomUUID().toString();
            log.debug("proxy location: " + proxyloc);
            File proxyfile = new File(proxyloc);
            if (!proxyfile.exists()) {
                String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
                File dir = new File(dirpath);
                if (!dir.exists()) {
                    if (dir.mkdirs()) {
                        log.debug("new directory " + dirpath + " is created.");
                    } else {
                        log.error("error in creating directory " + dirpath);
                    }
                }
                proxyfile.createNewFile();
                log.debug("new proxy file " + proxyloc + " is created.");
            }
            FileOutputStream fout = null;
            try {
                fout = new FileOutputStream(proxyfile);
                globusCred.save(fout);
            } finally {
                if (fout != null) {
                    fout.close();
                }
            }
View Full Code Here


    public GlobusCredential getGlobusCredential() throws Exception{
    init();
    String proxyloc = null;
    MyProxy myproxy = new MyProxy(hostname, port);
    GSSCredential proxy = myproxy.get(username, password, lifetime);
    GlobusCredential globusCred = null;
    if (proxy instanceof GlobusGSSCredentialImpl) {
      globusCred = ((GlobusGSSCredentialImpl) proxy)
          .getGlobusCredential();
      log.debug("got proxy from myproxy for " + username + " with "
          + lifetime + " lifetime.");
View Full Code Here

    try {
    if (gssCredential == null || gssCredential.getRemainingLifetime() < 15 * 60) {
        if (hostcertsKeyFile != null && !user) {
          init();
          FileInputStream fis = new FileInputStream(hostcertsKeyFile);
          GlobusCredential globusCred = new GlobusCredential(fis);
          this.gssCredential = new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);

        } else {
          this.gssCredential = getDefaultProxy();
        }
View Full Code Here

  public GSSCredential getGssCredential(String hostcertsKeyFile, String trustedcertsKeyFile) throws XRegistryClientException {
    try {
      if (gssCredential == null || gssCredential.getRemainingLifetime() < 15 * 60) {
        loadCertificate(trustedcertsKeyFile);
        FileInputStream fis = new FileInputStream(hostcertsKeyFile);
        GlobusCredential globusCred = new GlobusCredential(fis);
        this.gssCredential = new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
      }
    } catch (FileNotFoundException e) {
      throw new XRegistryClientException(e.getLocalizedMessage(),e);
    } catch (GlobusCredentialException e) {
View Full Code Here

      String proxyloc = null;
      MyProxy myproxy = new MyProxy(myproxyHostname, myproxyPortNumber);
      int lifeHours = myproxyLifeTime * SECS_PER_HOUR;
      GSSCredential proxy = myproxy.get(myproxyUserName, myproxyPassword, lifeHours);

      GlobusCredential globusCred = null;
      if (proxy instanceof GlobusGSSCredentialImpl) {
        globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();
        String uid = myproxyUserName;
        if (proxyloc == null) {
          System.out.println("uid: " + uid);
          proxyloc = "/tmp/x509up_u" + uid;
        }
        File proxyfile = new File(proxyloc);
        System.out.println("proxy location: " + proxyfile.getAbsolutePath());
        if (proxyfile.exists() == false) {
          String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
          File dir = new File(dirpath);
          if (dir.exists() == false) {
            dir.mkdirs();
            System.out.println("new directory " + dirpath + " is created.");
          }
          proxyfile.createNewFile();
          System.out.println("new proxy file " + proxyloc + " is created.");
        }
        FileOutputStream fout = new FileOutputStream(proxyfile);
        globusCred.save(fout);
        fout.close();
        String osName = System.getProperty("os.name");
        if (!osName.contains("Windows")) {
          Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
        }
View Full Code Here

      MyProxy myproxy = new MyProxy(myproxyHostname, myproxyPortNumber);
      int lifeHours = myproxyLifeTime * SECS_PER_HOUR;
      GSSCredential proxy = myproxy.get(myproxyUserName, myproxyPassword,
          lifeHours);

      GlobusCredential globusCred = null;
      if (proxy instanceof GlobusGSSCredentialImpl) {
        globusCred = ((GlobusGSSCredentialImpl) proxy)
            .getGlobusCredential();
        System.out.println("got proxy from myproxy for "
            + myproxyUserName + " with " + myproxyLifeTime
            + " lifetime.");
        String uid = myproxyUserName;
        if (proxyloc == null) {
          System.out.println("uid: " + uid);
          proxyloc = "/tmp/x509up_u" + uid;
        }
        File proxyfile = new File(proxyloc);
        System.out.println("proxy location: " + proxyfile.getAbsolutePath());
        if (proxyfile.exists() == false) {
          String dirpath = proxyloc.substring(0, proxyloc
              .lastIndexOf('/'));
          File dir = new File(dirpath);
          if (dir.exists() == false) {
            dir.mkdirs();
            System.out.println("new directory " + dirpath
                + " is created.");
          }
          proxyfile.createNewFile();
          System.out.println("new proxy file " + proxyloc
              + " is created.");
        }
        FileOutputStream fout = new FileOutputStream(proxyfile);
        globusCred.save(fout);
        fout.close();
        String osName = System.getProperty("os.name");
        if (!osName.contains("Windows")) {
        Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
        }
View Full Code Here

          try {
            init() ;
              String proxyloc = null;
              MyProxy myproxy = new MyProxy(hostname, port);
              GSSCredential proxy = myproxy.get(username, password, lifetime);
              GlobusCredential globusCred = null;
              if (proxy instanceof GlobusGSSCredentialImpl) {
                  globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();
                  log.info("got proxy from myproxy for " + username + " with " + lifetime + " lifetime.");
                  String uid=username;
                  if (proxyloc == null) {
                //              uid = XpolaUtil.getSysUserid();
                log.info("uid: " + uid);
                proxyloc = "/tmp/x509up_u" + uid + UUID.randomUUID().toString();
                  }
                  log.info("proxy location: " + proxyloc);
                  File proxyfile = new File(proxyloc);
                  if (proxyfile.exists() == false) {
                      String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
                      File dir = new File(dirpath);
                      if (dir.exists() == false) {
                          dir.mkdirs();
                          log.info("new directory " + dirpath + " is created.");
                      }
                      proxyfile.createNewFile();
                      log.info("new proxy file " + proxyloc + " is created.");
                  }
                  FileOutputStream fout = new FileOutputStream(proxyfile);
                  globusCred.save(fout);
                  fout.close();
                  Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
                  log.info("Proxy file renewed to " + proxyloc + " for the user "
                          + username + " with " + lifetime + " lifetime.");
View Full Code Here

    public static GSSCredential createCredentials() throws GfacException {
        try {
            // load the x509 proxy. if not found, quit.
            String proxyPath = System.getProperty("X509_USER_PROXY");
            GlobusCredential globusCred;
            GSSCredential gssCred;

            // if delegated proxy is used, then the proxy path is denoted by the
            // env variable X509_USER_PROXY
            if (proxyPath != null && !"".equals(proxyPath)) {
                globusCred = new GlobusCredential(proxyPath);
            } else {
                globusCred = GlobusCredential.getDefaultCredential();
            }
            globusCred.verify();
            gssCred = getGSSCredential(globusCred);

            return gssCred;
        } catch (GlobusCredentialException e) {
            throw new GfacException(e,FaultCode.InvaliedConfig);
View Full Code Here

    Workflow xBayaWorkflow = null;
    ExpBldrWorkflow expBldrWorkflow = new ExpBldrWorkflow();
    GSSCredential cred = null;
        try {
      FileInputStream fis = new FileInputStream(context.getProperties().getProperty("ssl.hostcertsKeyFile"));
      GlobusCredential globusCred = new GlobusCredential(fis);
      cred = new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
    } catch (Exception e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
View Full Code Here

      String workflowId = request.getParameter(WORKFLOW_ID);
        try {
      ApplicationGlobalContext context = new ApplicationGlobalContext();
     
        FileInputStream fis = new FileInputStream(context.getCredentials().getHostcertsKeyFile());
              GlobusCredential globusCred = new GlobusCredential(fis);
              context.setGssCredential(new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT));
        XBayaWorkflowUtil xRegistryUtil = new XBayaWorkflowUtil();
        this.workflow =  xRegistryUtil.getWorkflowFromRegistry(workflowId, context);
       
   
View Full Code Here

TOP

Related Classes of org.globus.gsi.GlobusCredential

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.