1

i am trying to create an active User in Windows Active Directory by ldap in java.

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 ?

4

2 回答 2

1

这将有助于回答您的问题Thread: Operation Not Supported Exception in JNDI/Active Directory以及How to add an active user account to Active Directory

于 2013-02-24T14:25:52.360 回答
1

对我来说,问题是密码相关性。使用弱密码时,会显示相同的消息。验证 AD 上定义的规则是什么。

于 2016-07-01T14:48:49.140 回答