3
我需要使用Spring服務器安全性需要接受請求的用戶憑證創建一個jQuery.POST。從jQuery到Spring引導的MVC MVC需要用戶憑證
谷歌搜索後,我沒有找到一個「可能的解決方案」。
這是似乎離真正的解決方案最近的解決方案(不起作用)。
$.ajax({ type: 'post', url: urlprova, data: JSON.stringily(respostas), dataType: 'json', contentType: 'application/json', success: function(response) { console.log(response); }, xhrFields: { withCredentials: true }, error: function(error) { console.log('ERROR:', error); } });
我是如何修復該代碼添加的用戶憑據與Spring MVC的安全工作。
Spring Security配置爲使用HTTP基本?如果是這樣,試試這個:http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax – 2014-11-21 15:09:48
這是一個好主意,但問題是,用戶名和密碼沒有在實際的html頁面中(它們在前一個,登錄頁面中)。你知道我能再次得到他們嗎?謝謝 – 2014-11-21 15:14:38