Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
aab10b08
Commit
aab10b08
authored
Jun 19, 2020
by
Piotr Gawron
Browse files
don't allow to request for reset link for LDAP users
parent
6960311f
Changes
2
Hide whitespace changes
Inline
Side-by-side
rest-api/src/main/java/lcsb/mapviewer/api/users/UserRestImpl.java
View file @
aab10b08
...
...
@@ -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"
);
...
...
web/src/test/java/lcsb/mapviewer/web/UserControllerIntegrationTest.java
View file @
aab10b08
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment