try {
subject.login(new UsernamePasswordToken(username, password.toCharArray(), remember));
//
Response resp = stage.invoke();
if (remember && rememberMeSupported) {
RememberMeUtil.forgetIdentity();
RememberMeUtil.rememberSerialized();
}
return resp;
} catch (AuthenticationException e) {
List<ControlParameter> parameters = request.getHandler().getParameters();
for (ControlParameter parameter : parameters) {
if (parameter instanceof ContextualParameter) {
if (AuthenticationException.class.isAssignableFrom(parameter.getType())) {
request.getContextualArguments().put((ContextualParameter)parameter, e);
Response resp = stage.invoke();
if (remember) {
RememberMeUtil.forgetIdentity();
}
return resp;
}