开发者

Add atribute to a existing user in LDAP with JAVA

开发者 https://www.devze.com 2023-03-30 06:10 出处:网络
i\'m trying to modify a existing user and add a attribute to him. I\'m using the following code: Attributes attrs1 = new BasicAttributes(true);

i'm trying to modify a existing user and add a attribute to him. I'm using the following code:

Attributes attrs1 = new BasicAttributes(true);
attrs1.put("proxyHash", generateProxyHash(account, "123456"));
ldapContext.modifyAttributes(username, DirContext.ADD_ATTRIBUTE,attrs1);

But i've received an exception t开发者_开发知识库hat says 'the attribute proxyHash is not allowed'

Thansks


Joao Carlos found solution himself:
The user I was trying to change was in a different schema, this schema haven't the attribute specified. After this fix the code works.


Unless the entry username has the objectClass extensibleObject or the objectClass that requires or allows the proxyHash attribute the directory server must reject the attempt to add proxyHash to the entry.

0

精彩评论

暂无评论...
验证码 换一张
取 消