ldap添加用户别名
如果添加用户时添加了别名属性(别名可以有多个),就会报错,若不添加别名属性用户可以添加成功,别名属性我是这样添加的attrs.put("iplanet-am-user-alias-list", "XXXXXXXXX");求大神指点。
Attributes attrs = new BasicAttributes(true);
Attribute objclass = new BasicAttribute("objectclass");
objclass.add("top");
objclass.add("person");
objclass.add("organizationalPerson");
objclass.add("inetorgperson");
objclass.add("inetadmin");
objclass.add("inetuser");
attrs.put(objclass);
attrs.put("cn", name);
attrs.put("sn", name.substring(0, 1));
attrs.put("uid", uid);
attrs.put("userPassword", pwd);
attrs.put("inetUserStatus", "Active");
attrs.put("iplanet-am-user-alias-list", "XXXXXXXXX");
异常:
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - Object Class Violation]; remaining name 'uid=aaaaa,ou=People,dc=bb,dc=cc,dc=dd'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3118)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3033)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2840)
at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1478)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:273)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:190)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:179)
at javax.naming.directory.InitialDirContext.modifyAttributes(InitialDirContext.java:167)
at cn.edu.lzu.portal.ldap.ConnectLDAP.infoModify(ConnectLDAP.java:200)
at cn.edu.lzu.portal.ldap.ConnectLDAP.main(ConnectLDAP.java:233)
补充:Java , Web 开发