在我的程序(基于jldap)中,我试图通过将userAccountControl值设置为512在AD中启用用户.
用户使用以下属性创建:
objectClass=user
cn=username
name=username
userAccountControl=512
userPassword={BASE64}
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}"));
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);