git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@18153 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5f1ace792e
commit
9d274dda8f
|
@ -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,34 +43,105 @@ 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;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue