I am trying the following ajax call to login to spring
$.ajax({
url: "http://localhost:8080/context/j_spring_security_check",
data: { j_username: 'user_name' , j_password: 'user_pass' },
type: "POST",
beforeSend: function (xhr) {
xhr.setRequestHeader("X-Ajax-call", "true");
},
success: function(result) {
// ..
},
error: function(XMLHttpRequest, textStatus, errorThrown){
$("#ajax_login_error_" ).html("Bad user/password") ;
return false;
}
});
This is doesn't work, because the username and password are not passed to the UsernamePasswordAuthenticationFilter. When I debug the request they are both null. In other cases when I login, I can see my user name and password in this filter.