Package org.globus.gsi

Examples of org.globus.gsi.GlobusCredential


            return "";
        }

        StringBuilder sb = new StringBuilder();

        GlobusCredential globusCred =
            ((GlobusGSSCredentialImpl)credential).getGlobusCredential();
        appendProxyInfo(sb, globusCred);

        VOMSAttribute vomsAttr =
            getAttributes(globusCred.getCertificateChain());
        if (vomsAttr == null) {
            sb.append("VOMS extension not found");
            sb.append(LF);
        } else {
            appendVomsInfo(sb, vomsAttr);
View Full Code Here


        this.certificateValidity = validity;
    }

    public GSSCredential getVOMSProxy(GSSCredential myproxyCred)
        throws Exception {
        GlobusCredential globusCred = null;
        if (myproxyCred instanceof GlobusGSSCredentialImpl) {
            globusCred =
                ((GlobusGSSCredentialImpl)myproxyCred).getGlobusCredential();
        }
        if (globusCred == null) {
            return null;
        }

        if (this.trustCaDir != null) {
            System.setProperty( "CADIR", this.trustCaDir );
        }

        int vomsProxyType = decideVomsProxyType( globusCred.getProxyType() );

        VOMSServerInfo info = getVOMSServerInfo();
        VOMSProxyInit proxyInit = VOMSProxyInit.instance( globusCred );
        proxyInit.setProxyType(vomsProxyType);
        proxyInit.setProxyOutputFile(null);
        proxyInit.setProxyLifetime( this.certificateValidity );
        proxyInit.addVomsServer( info );
        GlobusCredential tmpCred = null;
        try {
            List<VOMSRequestOptions> options = getVOMSRequestOptions();
            log.debug("getVomsProxy");
            tmpCred = proxyInit.getVomsProxy( options );
        } catch (VOMSException e) {
View Full Code Here

        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

        init();
       
        String proxyLocation = 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);
            proxyLocation = "/tmp/x509up_u" + uid + UUID.randomUUID().toString();
            log.debug("proxy location: " + proxyLocation);
            File proxyfile = new File(proxyLocation);
            if (!proxyfile.exists()) {
                String dirpath = proxyLocation.substring(0, proxyLocation.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);
                    }
                }

                if (!proxyfile.createNewFile()) {
                    log.error("Unable to create proxy file. File - " + proxyfile.getAbsolutePath());
                } else {
                    log.debug("new proxy file " + proxyLocation + " is created. File - " + proxyfile.getAbsolutePath());
                }
            }
            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

                X509Certificate[] certificates = new X509Certificate[1];
                certificates[0] = certificateCredential.getCertificate();

                //TODO suspecting about the certificate chain .... need to sort that out
                GlobusCredential newCredential = new GlobusCredential(certificateCredential.getPrivateKey(),
                        certificates);

                return new GlobusGSSCredentialImpl(newCredential,
                        GSSCredential.INITIATE_AND_ACCEPT);
            } else {
View Full Code Here

        if ( log.isDebugEnabled() ) {
            log.debug("Cert File: " + myproxyClientCert);
            log.debug("Key File:  " + myproxyClientKey);
        }
        try {
            GlobusCredential clientCred =
                new GlobusCredential(myproxyClientCert, myproxyClientKey);
            this.credential =
                new GlobusGSSCredentialImpl(clientCred,
                                            GSSCredential.INITIATE_AND_ACCEPT);
        } catch (GSSException e) {
            log.error(e);
View Full Code Here

   * @throws GlobusCredentialException if no proxy found
   */
  public boolean proxyExpired()
  {
    try {
      long t = new GlobusCredential(CoGProperties.getDefault().getProxyFile()).getTimeLeft();
      return (t == 0) ? true : false
    } catch (GlobusCredentialException e) {
      return true;
    }
  }
View Full Code Here

        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;
            // 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()) {
                String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
                File dir = new File(dirpath);
                if (!dir.exists()) {
                    if (dir.mkdirs()) {
                        log.info("new directory " + dirpath + " is created.");
                    } else {
                        log.error("error in creating directory " + dirpath);
                    }
                }
                proxyfile.createNewFile();
                log.info("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

    private static String getURIString(SRBAccount srbAccount) {
        return "srb://" + srbAccount.getHost() + ":" + srbAccount.getPort();
    }

    public static void main(String[] args) throws FileSystemException, GlobusCredentialException, GSSException {
    GlobusCredential gCert = GlobusCredential.getDefaultCredential();
        GlobusGSSCredentialImpl cert = new GlobusGSSCredentialImpl(gCert, GSSCredential.INITIATE_AND_ACCEPT);
        SRBAccount srbAccount = new SRBAccount("srb.ivec.org",
                            5544,
                            cert);
        srbAccount.setDefaultStorageResource("srb.ivec.org");
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.