Commit aab10b08 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

don't allow to request for reset link for LDAP users

parent 6960311f
......@@ -747,6 +747,9 @@ public class UserRestImpl extends BaseRestImpl {
if (user.getEmail() == null || user.getEmail().equals("")) {
throw new QueryException("User does not have email address defined");
}
if (user.isConnectedToLdap()) {
throw new QueryException("User authentication is provided over LDAP");
}
if (getConfigurationService().getConfigurationValue(ConfigurationElementType.MINERVA_ROOT).trim().isEmpty()) {
throw new InvalidStateException("Cannot create token - minerva root url is not defined");
......
......@@ -461,6 +461,20 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
}
@Test
public void requestResetPasswordForLdapUser() throws Exception {
configureServerForResetPasswordRequest();
User user = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
user.setConnectedToLdap(true);
userService.updateUser(user);
RequestBuilder grantRequest = post("/users/" + BUILT_IN_TEST_ADMIN_LOGIN + ":requestResetPassword");
mockMvc.perform(grantRequest)
.andExpect(status().isBadRequest());
}
@Test
public void requestResetPasswordWhenMinervaRootNotConfigured() throws Exception {
configureServerForResetPasswordRequest();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment