从JAVA在OpenDJ(LDAP)中创建新的对象类
我必须从JavaJNDI在LDAP服务器中创建一个自定义对象类。对象类应该有3个带值的字段:名称、OID、描述。到目前为止 我只设法定义了环境从JAVA在OpenDJ(LDAP)中创建新的对象类,java,ldap,Java,Ldap,我必须从JavaJNDI在LDAP服务器中创建一个自定义对象类。对象类应该有3个带值的字段:名称、OID、描述。到目前为止 我只设法定义了环境 Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); properties.put(Context.PROVIDER_URL, ldapU
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
properties.put(Context.PROVIDER_URL, ldapUrl);
properties.put(Context.REFERRAL, "ignore");
properties.put(Context.SECURITY_PRINCIPAL, dirManagerUser);
properties.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = new InitialDirContext(properties);
//NEW CUSTOM OBJECT CREATION SHOULD GO HERE
ctx.close();
我找到了一个解决方案:
BasicAttribute attribute = new BasicAttribute("objectClasses");
attribute.add(parameters);
attributes.put(attribute);
context.modifyAttributes("cn=schema",DirContext.ADD_ATTRIBUTE, attributes);
context.close();
为什么来自Java?你可以用行政手段。你只需要做一次。在不需要的时候编写代码是没有意义的。这不是由我来决定的。这是一项既定的任务。