just minor code fix
This commit is contained in:
parent
5195cf71a7
commit
a95c931c11
|
@ -14,7 +14,7 @@ import javax.servlet.http.HttpServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.gcube.common.encryption.StringEncrypter;
|
||||
import org.gcube.common.encryption.encrypter.StringEncrypter;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
|
@ -44,6 +44,7 @@ public class LDAPExportService extends HttpServlet {
|
|||
private String principal;
|
||||
private String ldapPassword;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void init() {
|
||||
portalName = PortalContext.getPortalInstanceName();
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ public class LDAPSync implements Runnable {
|
|||
private static final String DEFAULT_GID_NUMBER = "1000";
|
||||
|
||||
private static final String SSH_PUBLIC_KEY_ATTR = "SSH-public-key";
|
||||
private static LiferayGroupManager GM;
|
||||
|
||||
private String ldapUrl;
|
||||
private String filter;
|
||||
|
@ -55,7 +54,6 @@ public class LDAPSync implements Runnable {
|
|||
this.filter = filter;
|
||||
this.principal = principal;
|
||||
this.pwd = pwd;
|
||||
GM = new LiferayGroupManager();
|
||||
_log.info("Starting LDAPSync over " + ldapUrl);
|
||||
}
|
||||
|
||||
|
@ -93,14 +91,14 @@ public class LDAPSync implements Runnable {
|
|||
_log.debug("Reading Portal Organizations ...");
|
||||
GCubeGroup rootVO = getRootVO();
|
||||
|
||||
_log.debug("Initializing LDAP exporter ...");
|
||||
|
||||
_log.debug("Initializing LDAP exporter ... ldapUrl="+ldapUrl);
|
||||
Properties env = new Properties();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
|
||||
env.put(Context.PROVIDER_URL, ldapUrl);
|
||||
env.put(Context.SECURITY_PRINCIPAL, principal);
|
||||
env.put(Context.SECURITY_CREDENTIALS, pwd);
|
||||
|
||||
|
||||
_log.debug("Initializing LDAP exporter ... principal="+principal);
|
||||
try {
|
||||
DirContext ctx = new InitialDirContext(env);
|
||||
_log.debug("Initiating LDAP Sync ...");
|
||||
|
@ -299,24 +297,7 @@ public class LDAPSync implements Runnable {
|
|||
else
|
||||
_log.warn("LDAP Users Sync cycle skipped this time");
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param ctx
|
||||
* @param subContext
|
||||
* @throws NamingException
|
||||
*/
|
||||
private void createOrganizationalUnit(DirContext ctx, String subContext) throws NamingException {
|
||||
Attributes attributes = new BasicAttributes();
|
||||
Attribute objectClass = new BasicAttribute("objectClass");
|
||||
objectClass.add("organizationalUnit");
|
||||
attributes.put(objectClass);
|
||||
|
||||
Attribute description = new BasicAttribute("description");
|
||||
description.add("Liferay Organization");
|
||||
attributes.put(description);
|
||||
ctx.createSubcontext(subContext, attributes);
|
||||
_log.info("Added " + subContext);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param ctx
|
||||
|
@ -362,9 +343,6 @@ public class LDAPSync implements Runnable {
|
|||
ctx.createSubcontext(subContext, attributes);
|
||||
}
|
||||
|
||||
private String getOrgSubContext(String orgName) {
|
||||
return "ou="+orgName+",dc=d4science,dc=org";
|
||||
}
|
||||
|
||||
private String getGroupContext(String groupName) {
|
||||
return "cn="+groupName+","+GROUPS_OU;
|
||||
|
|
Reference in New Issue