Rena Tsantouli 2010-01-29 10:18:12 +00:00
parent 5f1ace792e
commit 9d274dda8f
1 changed files with 88 additions and 12 deletions

View File

@ -7,6 +7,11 @@ import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.gcube.application.framework.core.util.UserCredential;
import org.gcube.vomanagement.vomsapi.ExtendedVOMSAdmin;
import org.gcube.vomanagement.vomsapi.VOMSAdmin;
import org.gridforum.jgss.ExtendedGSSCredential;
@ -38,33 +43,104 @@ public class LDAPAuthenticationModule {
loginContext = new LoginContext(contextName, new JaasCallbackHandler(username, password));
} catch (SecurityException e) {
e.printStackTrace();
throw new Exception("key4", e);
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
System.out.println("Getting credential from VOMS");
if (cred == null) {
System.out.println("The credential does NOT exist");
throw new Exception("key4", e);
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
} catch (LoginException e) {
e.printStackTrace();
throw new Exception("key4", e);
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
System.out.println("Getting credential from VOMS");
if (cred == null) {
System.out.println("The credential does NOT exist");
throw new Exception("key4", e);
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
}
// Attempt login
try {
loginContext.login();
} catch (FailedLoginException e) {
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
// throw new Exception("key4", e);
e.printStackTrace();
return false;
if (cred == null) {
e.printStackTrace();
System.out.println("The credential is NULL!!!!!!!!!!!!");
return false;
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
} catch (AccountExpiredException e) {
//throw new Exception("key1");
e.printStackTrace();
return false;
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
// throw new Exception("key4", e);
if (cred == null) {
e.printStackTrace();
System.out.println("The credential is NULL!!!!!!!!!!!!");
return false;
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
} catch (CredentialExpiredException e) {
// throw new Exception("key2", e);
e.printStackTrace();
return false;
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
// throw new Exception("key4", e);
if (cred == null) {
e.printStackTrace();
System.out.println("The credential is NULL!!!!!!!!!!!!");
return false;
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
} catch (Exception e) {
// throw new Exception("key3", e);
return false;
// Check user's credential
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
// throw new Exception("key4", e);
if (cred == null) {
e.printStackTrace();
System.out.println("The credential is NULL!!!!!!!!!!!!");
return false;
} else {
System.out.println("The credential is OK!!!!!!!!!!!!");
return true;
}
}
System.out.println("ASL returning value true");
return true;
// Check user's credential
// ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
//
// System.out.println("Getting credential from VOMS");
// if (cred == null) {
// System.out.println("The credential does NOT exist");
// return false;
// } else {
// System.out.println("The credential is OK!!!!!!!!!!!!");
// return true;
// }
}