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.LoginContext;
|
||||||
import javax.security.auth.login.LoginException;
|
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));
|
loginContext = new LoginContext(contextName, new JaasCallbackHandler(username, password));
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
e.printStackTrace();
|
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) {
|
} catch (LoginException e) {
|
||||||
e.printStackTrace();
|
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
|
// Attempt login
|
||||||
try {
|
try {
|
||||||
loginContext.login();
|
loginContext.login();
|
||||||
} catch (FailedLoginException e) {
|
} catch (FailedLoginException e) {
|
||||||
|
// Check user's credential
|
||||||
|
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
|
||||||
|
|
||||||
// throw new Exception("key4", e);
|
// throw new Exception("key4", e);
|
||||||
e.printStackTrace();
|
if (cred == null) {
|
||||||
return false;
|
e.printStackTrace();
|
||||||
|
System.out.println("The credential is NULL!!!!!!!!!!!!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
System.out.println("The credential is OK!!!!!!!!!!!!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} catch (AccountExpiredException e) {
|
} catch (AccountExpiredException e) {
|
||||||
//throw new Exception("key1");
|
// Check user's credential
|
||||||
e.printStackTrace();
|
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
|
||||||
return false;
|
|
||||||
|
// 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) {
|
} catch (CredentialExpiredException e) {
|
||||||
// throw new Exception("key2", e);
|
// Check user's credential
|
||||||
e.printStackTrace();
|
ExtendedGSSCredential cred = UserCredential.getPlainCredential(username, password);
|
||||||
return false;
|
|
||||||
|
// 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) {
|
} catch (Exception e) {
|
||||||
// throw new Exception("key3", e);
|
// Check user's credential
|
||||||
return false;
|
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");
|
System.out.println("ASL returning value true");
|
||||||
return 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