HOWTO do CSRF protection in Struts2 application for AJAX requests

后端 未结 2 1385
北荒
北荒 2021-01-15 16:28

I have a struts2 webapp in which I need to implement CSRF protection. For statis forms it is pretty straight forward. I just need to activate the tokenSession i

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 17:05

    Can't you generate a Token and use it as parameter in the ajax call ?

    For the subsequent AJAX calls, you can use a per-user Token,

    not necessarily a per-request Token,

    as explained in this SO answer: Do I need a CSRF token for jQuery .ajax()?

提交回复
热议问题