/** * The authentication result is written to a request attribute called "loginResult". * * <p>Its value is "true" if login succeeded and "false" if not. Note that a successful login does * not ensure that that authorisation will succeed. * * <p>If rendering a login page based on authentication and authorisation you should also look at * the "authReason" attribute set by the LoginResponseHandler which gives the reason for an * authorisation failure * * @param resource * @param request * @return */ @Override public Object authenticate(Resource resource, Request request) { String userName = request.getParams().get(userNameParam); String pwd = request.getParams().get(passwordParam); Object o = resource.authenticate(userName, pwd); // set a request attribute that can be used when rendering if (o == null) { log.trace("Form authentication failed"); request.getAttributes().put("loginResult", Boolean.FALSE); } else { log.trace("Form authentication succeeded"); request.getAttributes().put("loginResult", Boolean.TRUE); } return o; }