답변 감사합니다.
csrf 기능들을 구현을 해봤는데 여기서 제가 개발자 도구에서 쿠키값을 마음대로 바꿨을 때 제 예상대로라면 403 에러가 발생해야하는데 405 에러가 발생을 하더라고요
405 에러가 나는 이유랑 해결 방법 좀 부탁드립니다 ㅠ
//SecurityConfig.java
http.csrf().csrfTokenRepository(new CookieCsrfTokenRepository());
//rootLayout.html
<meta name="_csrf" th:content="${_csrf.token}"/>
<meta name="_csrf_header" th:content="${_csrf.headerName}">
//global.js
$(document).ready(function (){
$.ajaxSetup(
{
global: true,
beforeSend: function (xhr){
const header = $("meta[name='_csrf_header']").attr("content");
const token = $("meta[name='_csrf']").attr("content");
xhr.setRequestHeader(header, token)
}
});
});