Yesod 1.2 CSRF protection

痞子三分冷 提交于 2020-08-07 10:31:53

问题


I'm confused about Yesod's CSRF protection, and how Yesod's forms work in general. It's my understanding that Yesod's form system uses a "token" which is passed into the HTML realization of the form as a hidden field. When the form is processed, the token is compared to one stored (or at least recreated) on the server. I'd like to track that down, because the CSRF protection is being triggered spuriously in my development environment, and I'd like to change my environment so the forms work the same in development as in production.

So what does Yesod's CSRF token "depend on"?


回答1:


The token is stored in the user session. You can get access to it via:

fmap reqToken getRequest


来源:https://stackoverflow.com/questions/23200348/yesod-1-2-csrf-protection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!