我正在開發 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...");
}?????
}?????);
我不知道為什么郵政電話不起作用
uj5u.com熱心網友回復:
GET 上的 200 和 POST 上的 403 告訴我您仍然啟用了 CSRF。
在 Java 配置中默認啟用 CSRF 保護。如果需要,我們仍然可以禁用它:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable();
}
參考:https ://www.baeldung.com/spring-security-csrf#1-java-configuration
我不建議禁用它。您可以查看https://docs.spring.io/spring-security/reference/5.6.0-RC1/reactive/exploits/csrf.html#webflux-csrf-configure-custom-repository
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/425720.html
標籤:javascript 弹簧靴 天蓝色 弹簧MVC 单点登录
