I do have a custom FailureHandler that extends SimpleUrlAuthenticationFailureHandler to go to custom failure urls. This does not work in Spring Security 3.0.3 but it does work in 3.0.2.
Code:
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
String failureUrlParam = StringUtil.cleanseUrlString(request.getParameter("failureUrl"));
String successUrlParam = StringUtil.cleanseUrlString(request.getParameter("successUrl"));
String failureUrl = StringUtils.trimToNull(failureUrlParam);
if (failureUrl == null) {
failureUrl = StringUtils.trimToNull(defaultFailureUrl);
}
if (failureUrl != null) {
if (StringUtils.isNotEmpty(successUrlParam)) {
if (!failureUrl.contains("?")) {
failureUrl += "?successUrl=" + successUrlParam;
} else {
failureUrl += "&successUrl=" + successUrlParam;
}
}
getRedirectStrategy().sendRedirect(request, response, failureUrl);
} else {
super.onAuthenticationFailure(request, response, exception);
}
}
Also, it would certainly be helpful if these fields were made protected in SimpleUrlAuthenticationFailureHandler for those, like me, that need to extend the functionality.
Code:
private String defaultFailureUrl;
private boolean forwardToDestination = false;