return _login(username, password, true, false);
}
private Subject _login(String username, String password, boolean checkRoles, boolean remote) throws LoginException {
if (password == null) {
throw new LoginException("No password was given");
}
// Use the JAAS modules to perform the auth.
_checkAuthentication(username, password);
// User is authenticated!
Subject subject = getSubjectByName(username);
if (subject != null) {//regular JDBC user
if (!subject.getFactive()) {
throw new LoginException("User account has been disabled.");
}
if (checkRoles) {
// fetch the roles
int rolesNumber = subject.getRoles().size();
if (rolesNumber == 0) {
if (systemManager.isLoginWithoutRolesEnabled()) {
if (log.isInfoEnabled()) {
log.info("Letting in user [" + subject.getName() + "] without any assigned roles.");
}
} else {
throw new LoginException("There are no preconfigured roles for user [" + subject.getName()
+ "]");
}
}
}
} else {