I have a Spring MVC REST service, with Spring Security (3.2.5.RELEASE) enabled. When I turn on @EnableWebMvcSecurity, a login form is automatically generated for me at http:
(1) Include the CSRF token within all your AJAX requests.
$(function () { var token = $('#logoutform>input').val(); var header = $('#logoutform>input').attr('name'); $(document).ajaxSend(function(e, xhr, options) { xhr.setRequestHeader('X-CSRF-TOKEN', token); }); });
(2) Simple request .