Skip to content
Snippets Groups Projects
Commit 747fd616 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

hashed passwords are not stored in local db when creating user from LDAP connection

parent e1e932c0
No related branches found
No related tags found
2 merge requests!541version 12.1.3 into master,!526hashed passwords are not stored in local db when creating user from LDAP connection
Pipeline #7859 passed
......@@ -537,7 +537,9 @@ public class UserService implements IUserService {
if (user == null) {
user = new User();
user.setLogin(login);
user.setCryptedPassword(passwordEncoder.encode(password));
// this password will disable local logins (it should be a hash for valid
// logins)
user.setCryptedPassword("");
user.setName(ldapUserData.getFirstName());
user.setSurname(ldapUserData.getLastName());
user.setEmail(ldapUserData.getEmail());
......
......@@ -72,8 +72,13 @@ public class UserServiceTest extends ServiceTestFunctions {
assertNotNull("User from LDAP wasn't authenticated", userService.login(login, passwd));
User user = userService.getUserByLogin(login);
assertTrue("LDAP user password should be empty",
user.getCryptedPassword() == null || user.getCryptedPassword().isEmpty());
assertNotNull("After authentication from LDAP user is not present in the system", user);
assertTrue(user.isConnectedToLdap());
assertNotNull("User from LDAP couldn't be authenticate for the second time", userService.login(login, passwd));
} catch (Exception e) {
e.printStackTrace();
throw e;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment