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

Merge branch '601-hashed-password' into 'devel_12.1.x'

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

See merge request !526
parents e1e932c0 747fd616
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 #7860 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