【发布时间】:2012-12-14 00:53:19
【问题描述】:
我正在尝试使用 Spring LDAPTemplate 控制 OpenLDAP。
在 LDAP 中,我有组和用户组织单位。我正在尝试通过组关联将新用户绑定到 LDAP。 (通用用户帐户)所以当我尝试绑定新用户时,我还将gidNumber attiribute 放入属性对象中。但我收到这样的错误:
[LDAP: error code 65 - attribute 'gidNumber' not allowed]; nested exception is javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - attribute 'gidNumber' not allowed]; remaining name 'ou=staff'
这是我迄今为止尝试过的:
DistinguishedName dn = new DistinguishedName();
dn.add("ou", "staff");
Attributes attributes = new BasicAttributes();
attributes.put("objectClass", "inetOrgPerson");
attributes.put("uid", username);
attributes.put("givenName", name);
attributes.put("gidNumber", gidNumber.toString());
attributes.put("sn", surname);
attributes.put("cn", name + " " + surname);
attributes.put("userPassword", password);
ldapTemplate.bind(dn, null, attributes);
这是我的架构:
+--> dc=ibu,dc=edu,dc=tr (5)
---> cn=admin
+--> ou=group (1)
| ---> cn=Academic
---> ou=guest
+--> ou=staff (2)
| ---> cn=John Clark
---> ou=student
【问题讨论】:
标签: spring ldap jndi spring-ldap