[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
AW: [geclipse-dev] Certificate class problem
|
Hi Romain,
> Is there a way of bypassing it?
Even though the EUGridPMACertificateLoader is internal you are able to
use it with the following code:
import eu.geclipse.core.ExtensionManager;
import eu.geclipse.core.Extensions;
import eu.geclipse.core.auth.ICaCertificateLoader;
[...]
final String EUGRIDPMA_NAME = "European Policy Management Authority for
Grid Authentication";
ExtensionManager manager = new ExtensionManager();
List< IConfigurationElement > elements =
manager.getConfigurationElements(
Extensions.CA_CERT_LOADER_POINT,
Extensions.CA_CERT_LOADER_ELEMENT
);
ICaCertificateLoader loader = null;
for ( IConfigurationElement element : elements ) {
String name = element.getAttribute(
Extensions.CA_CERT_LOADER_NAME_ATTRIBUTE );
if ( EUGRIDPMA_NAME.equals( name ) ) {
loader = ( ICaCertificateLoader ) element.createExecutableExtension(
Extensions.CA_CERT_LOADER_CLASS_ATTRIBUTE );
break;
}
}
ICaCertificate[] certs = null;
If ( loader != null ) {
URI[] uris = loader.getPredefinedRemoteLocations();
if ( ( uris != null ) && ( uris.length > 0 ) ) {
String[] certnames = loader.getCertificateList( uris[ 0 ], null );
if ( certnames != null ) {
certs = new ICaCertificate[ certnames.length ];
for ( int i = 0 ; i < certnames.length ; i++ ) {
certs[ i ] = loader.getCertificate( uris[ 0 ], certnames[ i ],
null );
}
}
}
}
As always this code is untested and at least the EUGRIDPMA_NAME.equals(
name ) is a bit of a hack since the name is or course not a unique ID.
We may think about defining a unique ID field for the ca cert extension
point in the future. Nevertheless this code should in principle work, so
please have a try with it.
> Sorry to bother. Once, I will be finished I will publish the code as a
> tutorial, if you are interested.
Sounds good to me, we would of course highly appreciate this!
Cheers, Mathias