VOMS-API

From Gcube Wiki
Revision as of 13:01, 6 February 2009 by Andrea.turli (Talk | contribs) (Usage Examples)

Jump to: navigation, search

The VOMS-API library

The library offers a number of facilities for interacting with VOMS server. [Read More]

Sample usage

The VOMS-API SA ships also a voms-api-test-suite where it is possible to use two sample classes:

  • VOMSTest
  • CredTest

These two classes are, respectively, a usage example of VOMSAdminImpl class and CredentialsManagerImpl.

VOMSAdminImpl

This class provides a subset of VOMS operations. We can manage VOMS users, groups and roles. Some operations are overloaded in order to simplify management of the users with a proxy certificate provided by gCube SimpleCA.

This utility can be instantiate in three different ways: by default VOMSAdminImpl will use host credentials contained in /etc/grid-security/hostpubliccert.pem and /etc/grid-security/hostprivatekey.pem.

Alternatively a user can specify his own credentials:

  • a user can specify CLIENT creds by indicating the triple (CLIENT_CERT, CLIENT_KEY, CLIENT_PWD) or
  • a user can specify CLIENT creds by indicating a CLIENT_PROXY, that's a proxy certificate of the pem cerficates.

If the user choose to instantiate a VOMSAdminImpl object specifying client credentials, this will overwrite the host certificate set by default.


Usage Examples

//construct a new VOMSAdminImpl using the default settings.
 
// Lists VO name
try { 
     VOMSAdminImpl vomsAdmin = new VOMSAdminImpl();
     System.out.println("VO: " + vomsAdmin.getVO());
} catch (Exception e) {
     e.printStackTrace();
}
 
// Lists VOMS groups
String[] groups = vomsAdmin.listGroups();
for (int i = 0; i < groups.length; i++) {
     System.out.println("\t" + groups[i]);
}
...

CredentialsManagerImpl

This class provides a method to retrieve user's credentials. It manages communication with MyProxyCA server to generate simple credentials for the username provided and some operations are overloaded in order to simplify management of the users with a proxy certificate provided by gCube SimpleCA.