use of org.apache.airavata.gfac.bes.utils.MyProxyLogon in project airavata by apache.
the class X509SecurityContext method getDefaultCredentials.
/**
* Gets the default proxy certificate.
* @return Default my proxy credentials.
* @throws GFacException If an error occurred while retrieving credentials.
* @throws org.apache.airavata.common.exception.ApplicationSettingsException
*/
public X509Credential getDefaultCredentials() throws GFacException, ApplicationSettingsException {
MyProxyLogon logon = new MyProxyLogon();
logon.setValidator(dcValidator);
logon.setHost(getRequestData().getMyProxyServerUrl());
logon.setPort(getRequestData().getMyProxyPort());
logon.setUsername(getRequestData().getMyProxyUserName());
logon.setPassphrase(getRequestData().getMyProxyPassword().toCharArray());
logon.setLifetime(getRequestData().getMyProxyLifeTime());
try {
logon.connect();
logon.logon();
logon.getCredentials();
logon.disconnect();
PrivateKey pk = logon.getPrivateKey();
return new KeyAndCertCredential(pk, new X509Certificate[] { logon.getCertificate() });
} catch (Exception e) {
throw new GFacException("An error occurred while retrieving default security credentials.", e);
}
}
Aggregations