当前位置: 首页>>代码示例>>Java>>正文


Java GlobusCredential类代码示例

本文整理汇总了Java中org.globus.gsi.GlobusCredential的典型用法代码示例。如果您正苦于以下问题:Java GlobusCredential类的具体用法?Java GlobusCredential怎么用?Java GlobusCredential使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GlobusCredential类属于org.globus.gsi包,在下文中一共展示了GlobusCredential类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeProxy

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
private void writeProxy(GlobusCredential proxy, File f) throws GeneralSecurityException {
    try {
        OutputStream fw = openStream(f);
        if (!SHARED_PROXIES) {
            f.deleteOnExit();
        }
        try {
            proxy.save(fw);
        }
        finally {
            fw.close();
        }
    }
    catch (Exception e) {
        throw new GeneralSecurityException("Failed to save proxy certificate", e);
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:18,代码来源:AutoCA.java

示例2: delegateGridCredential

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public String delegateGridCredential(GlobusCredential globusCredential,
		List<String> hostIdentityList)
		throws AuthenticationConfigurationException {

	String[] hostIdentities = new String[hostIdentityList.size()];
	hostIdentityList.toArray(hostIdentities);
	AllowedParties allowedParties = new AllowedParties();
	allowedParties.setGridIdentity(hostIdentities);
	IdentityDelegationPolicy identityDelegationPolicy = new IdentityDelegationPolicy();
	identityDelegationPolicy.setAllowedParties(allowedParties);
	ProxyLifetime issueCredentialsCDSLifeTime = new ProxyLifetime();
	int delegationLifetimeHours = this.credentialDelegationServiceInformation
			.getDelegationLifetimeHours();
	issueCredentialsCDSLifeTime.setHours(delegationLifetimeHours);
	int delegationLifetimeMinutes = this.credentialDelegationServiceInformation
			.getDelegationLifetimeMinutes();
	issueCredentialsCDSLifeTime.setMinutes(delegationLifetimeMinutes);
	issueCredentialsCDSLifeTime.setSeconds(delegationLifetimeMinutes);

	DelegationUserClient client = getDelegationUserClient(globusCredential);
	DelegatedCredentialReference delegatedCredentialReference = delegationCredentialReference(
			identityDelegationPolicy, issueCredentialsCDSLifeTime, client);
	String serializedDelegatedCredentialReference = getSerializedCredentialRef(delegatedCredentialReference);
	return serializedDelegatedCredentialReference;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:GridCredentialDelegatorImpl.java

示例3: FederatedQueryEngine

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
/**
 * Creates a new federated query engine instance.
 * 
 * @param credential
 *      The globus credential to be used when making queries against data services (may be null)
 * @param executionParameters
 *      The query execution parameters (may be null)
 * @param workExecutor
 *      The executor instance which will handle scheduling and execution of query processing tasks
 * @param modelLocator
 *      The domain model locator which will be used in operations where query processing
 *      requires information from a service's domain model
 */
public FederatedQueryEngine(GlobusCredential credential, QueryExecutionParameters executionParameters, 
    ExecutorService workExecutor, DomainModelLocator modelLocator) {
    this.credential = credential;
    if (executionParameters == null) {
        this.executionParameters = FQPConstants.DEFAULT_QUERY_EXECUTION_PARAMETERS;
    } else {
        this.executionParameters = executionParameters;
    }
    if (workExecutor == null) {
        LOG.debug("Creating threaded work executor with " + DEFAULT_POOL_SIZE + " threads");
        this.workExecutor = Executors.newFixedThreadPool(DEFAULT_POOL_SIZE);
    } else {
        this.workExecutor = workExecutor;
    }
    if (modelLocator != null) {
        this.domainModelLocator = modelLocator;
    } else {
        this.domainModelLocator = new DefaultDomainModelLocator();
    }
    this.dcqlConverter = new DCQLConverter(this.domainModelLocator);
    this.statusListeners = new LinkedList<FQPProcessingStatusListener>();
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:36,代码来源:FederatedQueryEngine.java

示例4: handleCredentialSelection

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public void handleCredentialSelection() {
    int maxPathLength = 0;
    long lifetimeSeconds = 0;
    try {
        GlobusCredential cred = getProxy().getSelectedCredential().getCredential();
        X509Certificate[] certs = cred.getCertificateChain();
        maxPathLength = getDelegationPathLength(certs[0]);
        lifetimeSeconds = cred.getTimeLeft() - SECONDS_OFFSET;
    } catch (Exception e) {
        FaultUtil.logFault(log, e);
    }
    if (maxPathLength < 0) {
        maxPathLength = 0;
    }
    delegatedCredentialPathLength.removeAllItems();
    for (int i = 0; i <= maxPathLength; i++) {
        delegatedCredentialPathLength.addItem(new Integer(i));
    }
    if (maxPathLength >= 1) {
        delegatedCredentialPathLength.setSelectedIndex(1);
    }

    getDelegationLifetime().setLifetime(lifetimeSeconds);
    getIssuedCredentialLifetime().setLifetime(lifetimeSeconds - SECONDS_OFFSET);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:DelegateProxyWindowStep1.java

示例5: runStep

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
@Override
public void runStep() throws Throwable {
    GlobusCredential proxy = null;
    if (credential != null) {
        proxy = credential.getCredential();
    }
    LocalAdministrationClient client = new LocalAdministrationClient(this.serviceURL, proxy);

    // find users
    LocalUserFilter filter = new LocalUserFilter();
    filter.setUserId(this.application.getUserId());
    filter.setStatus(LocalUserStatus.Pending);
    List<LocalUser> users = client.findUsers(filter);
    assertNotNull(users);
    assertTrue(users.size() > 0);

    // find user
    LocalUser user = findUser(users);
    assertNotNull(user);

    // accept application
    user.setStatus(LocalUserStatus.Active);
    client.updateUser(user);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:DorianApproveRegistrationStep.java

示例6: addGridGrouper

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public void addGridGrouper(final String uri, final GlobusCredential cred) {
	Runner runner = new Runner() {
		public void execute() {
			try {
				GridGrouper grouper = new GridGrouper(uri, cred);
				rootNode.addGridGrouper(grouper);
			} catch (Exception e) {
				ErrorDialog.showError(e);
				FaultUtil.logFault(log, e);
			}
		}
	};
	try {
		GridApplication.getContext().executeInBackground(runner);
	} catch (Exception t) {
		t.getMessage();
	}

}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:20,代码来源:GridGrouperTree.java

示例7: getLocalCredential

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public static GlobusCredential getLocalCredential(String currentProxyFile) throws Exception 
{
	GlobusCredential credential = null;
	if(currentProxyFile!=null)
	{
		credential = ProxyUtil.loadProxy(currentProxyFile);			
	}
	else
	{
		credential = ProxyUtil.getDefaultProxy();
	}
	if(credential == null)
	{
		throw new Exception("Unable to get the local credential. \nPlease creat a valid proxy in the default location \nor give a path to the proxy file.");
	}
	return credential;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:TavernaWorkflowServiceClient.java

示例8: createCredentialFromFile

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
/** Load Globus Crendentials (= Grid Proxy) */ 
public GlobusCredentialWrapper createCredentialFromFile(String path)
        throws Exception
{
    try
    {
        GlobusCredentialWrapper cred=new GlobusCredentialWrapper(this,new GlobusCredential(path));
        // Update Path!
        cred.setProxyFile(path); 
        updateGlobusModelProxyfilepath(path); 
        
        return cred; 
    }
    catch (GlobusCredentialException e)
    {
        throw new AuthenticationException(e.getMessage(),e); 
    }
}
 
开发者ID:NLeSC,项目名称:vbrowser,代码行数:19,代码来源:GlobusCredentialProvider.java

示例9: replaceKeyValues

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public static void replaceKeyValues(IdentifiersNAServiceClient client,
		GlobusCredential creds, URI identifier, String keyName, 
		String[] keyValues ) 
	throws 
		InvalidIdentifierFault, 
		NamingAuthorityConfigurationFault, 
		NamingAuthoritySecurityFault, 
		InvalidIdentifierValuesFault, 
		RemoteException {
	
   	setProxy(client, creds);
   	
	KeyNameValues[] newKeyValues = new KeyNameValues[1];
   	newKeyValues[0] = new KeyNameValues();
   	newKeyValues[0].setKeyName(keyName);
   	newKeyValues[0].setKeyValues(new KeyValues(keyValues));

  		client.replaceKeyValues(identifier, new IdentifierValues(newKeyValues));
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:20,代码来源:IdentifiersTestUtil.java

示例10: setDelegatedCredential

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public void setDelegatedCredential(DelegatedCredentialReference delegatedCredentialReference) throws RemoteException, gov.nih.nci.cagrid.workflow.service.impl.stubs.types.CannotSetCredential {
	
	try {
		
		GlobusCredential delegatedCredential = 
			validateAndRetrieveDelegatedCredential(delegatedCredentialReference);
        
		//Save the delegated credential in a custom location.
		String proxyPath = this.getTempDir() + File.separator + "delegatedProxy";
		LOG.info("ProxyPath : " + proxyPath);
		ProxyUtil.saveProxy(delegatedCredential, proxyPath);
		
		//Sets the TWS_USER_PROXY variable that indicates a user has delegated his proxy.
		this.setTWS_USER_PROXY(proxyPath);
	} catch (Exception e) {
		e.printStackTrace();
		throw new RemoteException("Error: Failed to setup the Delegated Credential on the Server.");
	}
			
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:21,代码来源:TavernaWorkflowServiceImplResource.java

示例11: proxyExpired

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
/**
 * Check for expired proxy.
 * 
 * @return true if expired proxy
 * 
 */
public boolean proxyExpired() {
    try {
        long t = new GlobusCredential(CoGProperties.getDefault().getProxyFile()).getTimeLeft();
        return (t == 0) ? true : false;
    } catch (GlobusCredentialException e) {
        return true;
    }
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:15,代码来源:ProxyTool.java

示例12: initializeCredentials

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
public static GSSCredential initializeCredentials(boolean personal, String hostcert,
		String hostkey) throws GlobusCredentialException, GSSException {
	if (!personal) {
		return new GlobusGSSCredentialImpl(new GlobusCredential(hostcert != null ? hostcert
				: "/etc/grid-security/hostcert.pem", hostkey != null ? hostkey
				: "/etc/grid-security/hostkey.pem"), GSSCredential.INITIATE_AND_ACCEPT);
	}
	else {
		return new GlobusGSSCredentialImpl(GlobusCredential.getDefaultCredential(),
				GSSCredential.INITIATE_AND_ACCEPT);
	}
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:13,代码来源:GSSService.java

示例13: createAll

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
private X509Certificate createAll(int index) throws GeneralSecurityException, IOException {
    logger.info("Generating CA key pair");
    KeyPair ca = CertUtil.generateKeyPair(CA_CERT_ALGORITHM, CA_CERT_BITS);
    OpenSSLKey caKey = new BouncyCastleOpenSSLKey(ca.getPrivate());
    logger.info("Self-signing CA certificate");
    X509Certificate caCert = genCert(ca.getPrivate(), ca.getPublic(), CA_CERT_DN, CA_CERT_DN, null);
    
    logger.info("Generating user key pair");
    KeyPair user = CertUtil.generateKeyPair(CA_CERT_ALGORITHM, CA_CERT_BITS);
    OpenSSLKey userKey = new BouncyCastleOpenSSLKey(user.getPrivate());
    logger.info("Signing user certificate");
    X509Certificate userCert = genCert(ca.getPrivate(), user.getPublic(), USER_CERT_DN, CA_CERT_DN,
        createExtensions(ca.getPublic(), user.getPublic()));
    logger.info("Generating proxy certificate");
    GlobusCredential proxy = makeProxy(user, userCert);
    
    try {
        logger.info("Writing keys, certificates, and proxy");
        writeKey(caKey, makeFile(CA_KEY_NAME_PREFIX, index));
        writeCert(caCert, makeFile(CA_CRT_NAME_PREFIX, index));
        writeKey(userKey, makeFile(USER_KEY_NAME_PREFIX, index));
        writeCert(userCert, makeFile(USER_CRT_NAME_PREFIX, index));
        writeProxy(proxy, makeFile(PROXY_NAME_PREFIX, index));
        copySigningPolicy(index);
    }
    catch (GeneralSecurityException e) {
        deleteAll(index);
        throw e;
    }
    return cert;
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:32,代码来源:AutoCA.java

示例14: makeProxy

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
private GlobusCredential makeProxy(KeyPair kp, X509Certificate issuerCert) throws GeneralSecurityException {
    BouncyCastleCertProcessingFactory factory = BouncyCastleCertProcessingFactory.getDefault();
    KeyPair newKeyPair = CertUtil.generateKeyPair(CA_CERT_ALGORITHM, CA_CERT_BITS);
    
    return factory.createCredential(new X509Certificate[] { issuerCert },
            kp.getPrivate(), CA_CERT_BITS, (int) (CA_CERT_LIFETIME / 1000), GSIConstants.DELEGATION_FULL,
            (X509ExtensionSet) null);
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:9,代码来源:AutoCA.java

示例15: generateNewCredential

import org.globus.gsi.GlobusCredential; //导入依赖的package包/类
private GlobusCredential generateNewCredential(Key key) throws GlobusCredentialException,
        InvalidSecurityContextException, GeneralSecurityException {
    GlobusCredential src = GlobusCredential.getDefaultCredential();
    if (src == null) {
        throw new InvalidSecurityContextException("No default credential found");
    }

    // If only the security stuff in [email protected] would be
    // separable from the WS crap
    BouncyCastleCertProcessingFactory factory =
                BouncyCastleCertProcessingFactory.getDefault();
    int delegType = (key.delegationType == Delegation.FULL_DELEGATION ?
                GSIConstants.DELEGATION_FULL : GSIConstants.DELEGATION_LIMITED);

    KeyPair newKeyPair = CertUtil.generateKeyPair("RSA", src.getStrength());

    X509Certificate[] srcChain = src.getCertificateChain();
    X509Certificate newCert = null;

    try {
        newCert = factory.createProxyCertificate(srcChain[0],
                                    src.getPrivateKey(),
                                    newKeyPair.getPublic(), -1,
                                    key.delegationType == Delegation.FULL_DELEGATION ?
                                            GSIConstants.DELEGATION_FULL
                                            : GSIConstants.DELEGATION_LIMITED,
                                    (X509ExtensionSet) null, null);
    }
    catch (GeneralSecurityException e) {
        throw new InvalidSecurityContextException("Delegation failed", e);
    }

    X509Certificate[] newChain = new X509Certificate[srcChain.length + 1];
    newChain[0] = newCert;
    System.arraycopy(srcChain, 0, newChain, 1, srcChain.length);

    return new GlobusCredential(newKeyPair.getPrivate(), newChain);
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:39,代码来源:ProxyForwardingManager.java


注:本文中的org.globus.gsi.GlobusCredential类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。