[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
AW: [geclipse-dev] Token creation
|
Hi Romain,
In principle it is very simple to create a token with g-Eclipse:
IAuthenticationTokenDescription desc = new VomsProxyDescription();
AuthTokenRequest request = new AuthTokenRequest( desc, "This is me", "I need a VOMS proxy" );
IAuthenticationToken token = AbstractAuthTokenProvider.staticRequestToken( request );
Assuming you are not in headless mode and the UI is available this will open the token wizard in VOMS mode asking the user to specify a certificate, key and passphrase. You could also encode default VO, certificate and key in your VomsProxyDescription:
IAuthenticationTokenDescription desc = new VomsProxyDescription(
new IVirtualOrganization[] { myvo },
mycert,
mykey
);
If you would like to directly create a VOMS proxy without UI interaction (i.e. you already know your VO, certificate and key) you should do something like this:
VomsProxyDescription desc = VomsProxyDescription(
new IVirtualOrganization[] { myvo },
mycert,
mykey
);
AuthenticationTokenManager manager = AuthenticationTokenManager.getManager();
VomsProxy proxy = ( VomsProxy ) manager.createToken( desc );
If you create the token with the manager it will cache this token for you and manage the tokens lifecycle. The token can afterwards be retrieved with
VomsProxy proxy = ( VomsProxy ) manager.findToken( desc );
If you do not need the token management capabilities of g-Eclipse you could simply do something like:
VomsProxyDescription desc = VomsProxyDescription(
new IVirtualOrganization[] { myvo },
mycert,
mykey
);
VomsProxy proxy = ( VomsProxy ) desc.createToken();
Depending on the method you are chosing you may have to validate and to activate your token after the creation:
if ( ! proxy.isValid() ) {
proxy.validate( null );
}
if ( ! proxy.isActive() ) {
proxy.setActive( true, null );
}
You can find a lot of useful code examples in the following classes:
eu.geclipse.core.auth.CoreAuthTokenProvider
eu.geclipse.ui.UIAuthTokenProvider
Hope that helps,
Mathias
Dr. Mathias Stümpert
Project Coordinator
g-Eclipse Project (IST-034327)
Karlsruhe Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)
Hermann-von-Helmholtz-Platz 1
76344 Eggenstein-Leopoldshafen
Phone: +49 7247 828610
Fax: +49 7247 824972
Email: mathias.stuempert@xxxxxxxxxx
-----Ursprüngliche Nachricht-----
Von: geclipse-dev-bounces@xxxxxxxxxxx [mailto:geclipse-dev-bounces@xxxxxxxxxxx] Im Auftrag von reuillon
Gesendet: Mittwoch, 14. Mai 2008 10:54
An: Developer mailing list
Betreff: [geclipse-dev] Token creation
Hi all,
I'd like to write a code creating a token from a voms certificate using
geclipse classes. I think I should use the AuthenticationTokenManager
but I cannot get through with it. May you point at me source codes that
will help me?
Thanks,
Rom
_______________________________________________
geclipse-dev mailing list
geclipse-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/geclipse-dev