Java:通过 LDAP 在 Active Directory 中创建用户时出现错误代码 53
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15052601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java: error code 53 when creating user in Active Directory by Ldap
提问by Acdc RocknRoll
i am trying to create an active User in Windows Active Directory by ldap in java.
我正在尝试通过 java 中的 ldap 在 Windows Active Directory 中创建一个活动用户。
my creation method is:
我的创作方法是:
private Attributes createUserAttributes(String userName, String firstName, String lastName, String password) {
Attributes container = new BasicAttributes();
Attribute objClasses = new BasicAttribute("objectClass");
Attribute userPassword = new BasicAttribute("userPassword", password);
Attribute sAMAccountName = new BasicAttribute("SAMAccountName", userName);
Attribute userPrincipialAttribute = new BasicAttribute("userPrincipalName", userName + "@" + DOMAIN_NAME);
Attribute firstNameAttribute = new BasicAttribute("givenName", firstName);
Attribute secondNameAttribute = new BasicAttribute("sn", lastName);
Attribute activatedAccount = new BasicAttribute("userAccountControl", "512");
objClasses.add("user");
// Add these to the container
container.put(objClasses);
container.put(userPassword);
container.put(sAMAccountName);
container.put(userPrincipialAttribute);
container.put(firstNameAttribute);
container.put(secondNameAttribute);
container.put(activatedAccount);
return container;
}
Unfornutately i get the following error:
不幸的是,我收到以下错误:
Exception in thread "main" javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000052D: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0
Has anyone ideas ?
有任何想法吗?
回答by Sorceror
This will help answer your problem Thread: Operation Not Supported Exception in JNDI/Active Directoryalso How to add an active user account to Active Directory.
这将有助于回答您的问题主题:不支持的操作异常的JNDI / Active Directory中还如何活跃用户帐户添加到Active Directory。
回答by Renato Herebia
The problem for me was the password relevance. With a weak password, the same message was shown. Verify what are the rules defined on AD.
我的问题是密码的相关性。使用弱密码时,会显示相同的消息。验证在 AD 上定义的规则是什么。