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 ?