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:
Jacobo Aragunde Pérez 2009-12-18 15:04:58 +01:00 committed by Javier Moran Rua
parent 3698d95656
commit 6a63178833

View file

@ -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(),