Contents
see Listmultipart/form-data 경우
?${_csrf.parameterName}=${_csrf.token}
일반 form
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
sec:form 의 경우 생략 (다만 로그인 및 로그아웃은 일반 폼으로 지정해야하는 이상한버그)
ajax
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>
var token = $("meta[name='_csrf']").attr("content");
var header = $("meta[name='_csrf_header']").attr("content");
$.ajax({
type : "POST",
url : '<c:url value="${checkLoginAjax}" />',
data : {
userId : userId
},
beforeSend: function(xhr) {
// here it is
xhr.setRequestHeader(header, token);
},
dataType : "json",
success : function(d){
}
});
사용예시
spring
| No | 작성일 | Title |
|---|---|---|
| 164 | 2015. 02. 24. | [ spring ] properties 동적으로 사용하기 (context:property-placeholder 및 util:properties) |
| 149 | 2015. 02. 16. | [ Spring Security ] 스프링 시큐리티 미세 접근 제한 |
| 148 | 2015. 02. 13. | [ Spring ] @Valid 어노테이션에 쉽게 매핑하기 |
| 145 | 2015. 01. 26. | [ Spring ] Transaction Isolation [ 트랜젝션 격리 ] 관리 |
| 109 | 2014. 12. 23. | [ spring ] transaction propagation [ 트랜젝션 전파 ] 관리 |
| 103 | 2014. 10. 29. | [ spring ] 스프링에서 스케줄링(Schedule) 등록하는 방법 |
| 44 | 2014. 09. 29. | [ spring security ] 스프링 시큐리티 xml 설정 |
| 43 | 2014. 09. 29. | [ spring security ] 스프링 시큐어리티 access 옵션 |
| 40 | 2014. 09. 29. | [ mybatis ] 마이바티스 map 이나 bean 을 이용하지 않고 2개이상 파라메터 전달하기 |
| 39 | 2014. 09. 26. | [ spring ] view(jsp) 에서 htmlEscape 사용하기 |