【发布时间】:2011-08-23 08:04:42
【问题描述】:
在我的程序(基于 jldap)中,我尝试通过将 userAccountControl 值设置为 512 来启用 AD 中的用户。 使用以下属性创建的用户:
objectClass=user
cn=username
name=username
userAccountControl=512
userPassword={BASE64}<base64 encoded password>
sAMAccountName=username
distinguishedName=username,CN=Users,DC=company,DC=com
但我得到了例外:
LDAPException: Unwilling To Perform (53) Unwilling To Perform
LDAPException: Server Message: 0000052D: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0
可能有人可以告诉我我在哪里犯了错误?也许我忘记了一些必需的属性?
编辑:
我的代码(很简单,我认为其中没有错误):
LDAPConnection connection;
LDAPMessageQueue messageQueue;
...
LDAPAttributeSet attributes = new LDAPAttributeSet();
attributes.add(new LDAPAttribute("objectClass", "user"));
attributes.add(new LDAPAttribute("cn", "username"));
attributes.add(new LDAPAttribute("name", "username"));
attributes.add(new LDAPAttribute("userAccountControl", "512"));
attributes.add(new LDAPAttribute("userPassword", "{BASE64}<base64 encoded password>"));
attributes.add(new LDAPAttribute("sAMAccountName", "username"));
attributes.add(new LDAPAttribute("distinguishedName", "username,CN=Users,DC=company,DC=com"));
LDAPEntry entry = new LDAPEntry("CN=username,CN=Users,DC=company,DC=com", attributes);
connection.add(entry);
【问题讨论】:
-
请显示一些代码作为您如何设置这些值。可能有错误。
-
我不认为,代码中的错误,因为我可以创建禁用用户,但是当我尝试启用用户时,我收到异常。
标签: java active-directory ldap