Skip to content

Instantly share code, notes, and snippets.

@liwh
Created December 6, 2010 08:09
Show Gist options
  • Save liwh/730007 to your computer and use it in GitHub Desktop.
Save liwh/730007 to your computer and use it in GitHub Desktop.
the Authenticity Token in rails

在rails中,当我们请求页面的时候,rails会生成一个随机的authenticity_token保存在session中,当我们向服务器发出post ,put ,delete请求的时候,它就会验证session中存储的值,如果匹配,则继续流程。
这主要是为了防止Cross Site Request Forgery攻击。阻止用户进行非表单提交的操作。。具体见:rails-authenticity-token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment