return retVal;
}
@Override
public IAuthenticationResult isAuthenticate(String userid, String domain, String password) {
IAuthenticationResult ar = new AuthenticationResult(IAuthenticationResult.SUCCESS);
try {
ar = checkUserExcluded(userid);
if(ar.isSuccess()) {
ar = checkUserNotIncluded(userid);
if(ar.isSuccess()) {
String[] args = { userid, password };
UserAuthenticate instance = new UserAuthenticate();
String result = instance.launch(args);
// success groups = [group1, group2]
if(result.startsWith("success")) {
result = result.trim();
result = result.replace("success groups =", "");
result = result.replace("[", "");
result = result.replace("]", "");
result = result.replace(" ", "");
String[] groups = result.split(",");
if(groups != null) {
userGroupsCache.put(userid, groups);
}
else {
userGroupsCache.remove(userid);
}
}
// failure pam_authenticate failed: Authentication failure
else {
ar.setFailure();
result = result.replace("failure pam", "pam");
ar.setReason(result);
}
}
}
}
catch(Exception e) {
ar.setFailure();
ar.setException(e);
}
return ar;
}