Spring 3.1 MVC, Spring Security 3.1 - CSRF token

前端 未结 3 1965
抹茶落季
抹茶落季 2020-12-30 02:10

At the moment I am searching for a possibility to include CRSF tokens in Spring MVC and Spring Security forms. What is the easiest solution that covers both (Spring Security

3条回答
  •  無奈伤痛
    2020-12-30 02:45

    Spring 3.1 introduced a new interface named RequestDataValueProcessor. Using this interface you can easily (and automatically - without any changes to your JSP or controllers!) register CSRF tokens to HTTP forms. You can see a detailed example in here, it also refers to the sample code on github (so you can just take it from there and use it in your application).

提交回复
热议问题