if (getCredentialReader() == null) {
setCredentialReader(GFacUtils.getCredentialReader());
}
Credential credential = getCredentialReader().getCredential(getRequestData().getGatewayId(),
getRequestData().getTokenId());
if (credential != null) {
if (credential instanceof CertificateCredential) {
log.info("Successfully found credentials for token id - " + getRequestData().getTokenId() +
" gateway id - " + getRequestData().getGatewayId());
CertificateCredential certificateCredential = (CertificateCredential) credential;
X509Certificate[] certificates = certificateCredential.getCertificates();
X509Credential newCredential = new X509Credential(certificateCredential.getPrivateKey(), certificates);
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(newCredential, GSSCredential.INITIATE_AND_ACCEPT);
System.out.print(cred.export(ExtendedGSSCredential.IMPEXP_OPAQUE));
return cred;
//return new GlobusGSSCredentialImpl(newCredential,
// GSSCredential.INITIATE_AND_ACCEPT);
} else {
log.info("Credential type is not CertificateCredential. Cannot create mapping globus credentials. " +
"Credential type - " + credential.getClass().getName());
}
} else {
log.info("Could not find credentials for token - " + getRequestData().getTokenId() + " and "
+ "gateway id - " + getRequestData().getGatewayId());
}