我正在尝试使用 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