我試圖用Spring LDAPTemplate來控制OpenLDAP。Spring LdapTemplate - 屬性'gidNumber'不允許異常
在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
感謝您的回覆;但現在我得到另一個異常:'LDAP:錯誤代碼65 - 沒有提供結構對象類' – talha06