return false;
}
String citizenName = session.getCitizen();
Citizen citizen = null;
if (citizenName != null) {
citizen = realm.getCitizen(citizenName);
}
if (citizen != null && citizen.getRealm().equals(realm)) {
return true;
} else {
HttpServletRequest request = context.getRequest();
String clientIp = request.getRemoteAddr();
context.log().info("client ip: "+clientIp);
Citizen[] searchResult = realm.searchCitizenByVariable("ctz.ip", clientIp);
if (searchResult != null && searchResult.length > 0) {
context.setCitizen(searchResult[0]);
context.log().info("web: ipauthentication ok");
if (context.getOriginalPathinfo().equals(loginPath)) {
throw new RedirectException(context.getSession().getId(), forwardPath);
}
return true;
}
String username = request.getParameter("webauth.username");
String password = request.getParameter("webauth.password");
context.getSession().removeAttribute("webauth.failedUser");
if (username != null && password != null && username.length() > 0) {
citizen = realm.getCitizen(username);
context.log().info("username: '"+username+"' citizen: "+citizen);
if (citizen != null && citizen.verifyCredentials(password)) {
context.setCitizen(citizen);
context.log().info("web: authentication ok");
if (context.getOriginalPathinfo().equals(loginPath)) {
throw new RedirectException(context.getSession().getId(), forwardPath);