[英]Azure Single Sign on post request giving 403 forbidden error
我正在開發 jsp-springboot 應用程序,我已經使用 azure 實現了 sso,它按預期工作。 我已經配置
azure.activedirectory.tenant-id
azure.activedirectory.client-id
azure.activedirectory.client-secret
此外,我還添加了重定向 url 在 application.properties 中,除了這些更改之外,我沒有添加任何配置類,我也能夠成功登錄 ajax GET調用正在返回 200 響應代碼,但對於POST調用給出403禁止錯誤
獲取通話樣本
$.ajax({
type: 'GET',
url: "/getvalue/"+productId,
contentType: "text/plain",
dataType: 'json',
success: function (data) {
console.log("Success");
},
error: function (e) {
console.log("There was an error with your request...");
}
});
和郵局電話
$.ajax({
type: 'POST',
url: "/saveValue",
data:JSON.stringify(valueObj),
contentType: "application/json",
success: function (data) {
console.log("success: ");
},
error: function (e) {
console.log("There was an error with your request...");
}
});
我不知道為什么郵政電話不起作用
GET 上的 200 和 POST 上的 403 告訴我您仍然啟用了 CSRF。
CSRF 保護在 Java 配置中默認啟用。 如果需要,我們仍然可以禁用它:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable();
}
參考: https://www.baeldung.com/spring-security-csrf#1-java-configuration
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.