Rena Tsantouli 2009-08-28 14:10:06 +00:00
parent b2e03278d6
commit a28692650e
1 changed files with 10 additions and 6 deletions

View File

@ -2,8 +2,10 @@ package org.gcube.application.framework.core.util;
import java.io.File; import java.io.File;
import org.gcube.vomanagement.vomsAdmin.impl.VOMSAdminImpl; import org.gcube.vomanagement.vomsapi.CredentialsManager;
import org.gcube.vomanagement.vomsClient.impl.CredentialsManagerImpl; import org.gcube.vomanagement.vomsapi.VOMSAdmin;
import org.gcube.vomanagement.vomsapi.impl.VOMSAPIConfiguration;
import org.gcube.vomanagement.vomsapi.impl.VOMSAPIFactory;
import org.gridforum.jgss.ExtendedGSSCredential; import org.gridforum.jgss.ExtendedGSSCredential;
/** /**
@ -19,20 +21,22 @@ public class UserCredential {
*/ */
public static ExtendedGSSCredential getCredential(String username, String DLname) public static ExtendedGSSCredential getCredential(String username, String DLname)
{ {
CredentialsManagerImpl man = null; CredentialsManager man = null;
try { try {
String sharedDir = Settings.getInstance().getProperty("sharedDir"); String sharedDir = Settings.getInstance().getProperty("sharedDir");
System.out.println("file " + sharedDir + "/vomsAPI.properties exists: "+ new File(sharedDir + "/vomsAPI.properties").exists()); System.out.println("file " + sharedDir + "/vomsAPI.properties exists: "+ new File(sharedDir + "/vomsAPI.properties").exists());
// man = new CredentialsManagerImpl(sharedDir + "/vomsAPI.properties"); // man = new CredentialsManagerImpl(sharedDir + "/vomsAPI.properties");
VOMSAdminImpl vomsAdm = new VOMSAdminImpl(sharedDir + "/vomsAPI.properties");
man = new CredentialsManagerImpl(vomsAdm); VOMSAPIFactory factory = new VOMSAPIFactory(new VOMSAPIConfiguration(new File(sharedDir + "/vomsAPI.properties")));
VOMSAdmin vomsAdm = factory.getVOMSAdmin();
man = factory.getCredentialsManager();
} catch (Exception e1) { } catch (Exception e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
ExtendedGSSCredential cred = null; ExtendedGSSCredential cred = null;
try { try {
//TODO: put a real password there... //TODO: put a real password there...
cred = man.getCredentials(username, "", DLname); cred = man.getAttributedCredentials(username, "", DLname);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }