ItEr39S10CUAltaUsuario: prevent the login service to show a HTTP 403 error when a user without roles logs in.
Now the message 'incorrect login' is shown instead.
This commit is contained in:
parent
3698d95656
commit
6a63178833
1 changed files with 6 additions and 0 deletions
|
|
@ -73,6 +73,12 @@ public class DBUserDetailsService implements UserDetailsService {
|
|||
allRoles.addAll(eachProfile.getRoles());
|
||||
}
|
||||
|
||||
if(allRoles.isEmpty()) {
|
||||
//that user doesn't have any roles, so we forbid his login
|
||||
throw new UsernameNotFoundException(_("User with login name " +
|
||||
"'{0}': access forbidden", loginName));
|
||||
}
|
||||
|
||||
return new org.springframework.security.userdetails.User(
|
||||
user.getLoginName(),
|
||||
user.getPassword(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue