I am getting the above error and my property file contains below configurations.
spring.ldap.urls=ldap://xxx.xxx.xxx.xx:389
spring.ldap.base=DC=xxxxxx,DC=int
[email protected]
spring.ldap.password=password
spring.ldap.authentication=simple
spring.ldap.baseEnvironment.referral=follow
I am getting this error when passing the data to the AD server through the postman. Here is the JSON body. { "username": "testad", "password": "password", "email": "[email protected]" }
Here is my service class,
public void addUser(User user) {
DirContextAdapter context = new DirContextAdapter();
context.setAttributeValues("objectclass", new String[] {"top", "person", "organizationalPerson", "user"});
context.setAttributeValue("sAMAccountName", user.getUsername());
context.setAttributeValue("userPrincipalName", user.getUsername() + "@xxxx.int");
context.setAttributeValue("mail", user.getEmail());
context.setAttributeValue("unicodePwd", "\"" + user.getPassword() + "\"");
context.setAttributeValue("userAccountControl", Integer.toString(512)); // Normal user
ldapTemplate.bind("cn=" + user.getUsername() + ",ou=users,dc=xxxx,dc=int", context, null);
}