简体   繁体   English

用于Rich Ajax应用程序的CSRF令牌生成

[英]CSRF Token Generation for Rich Ajax application

My application is fetching the back end data using Ajax calls 90% of the times. 我的应用程序使用Ajax调用90%的时间来获取后端数据。 I would need to implement CSRF prevention for all these calls. 我将需要对所有这些调用实施CSRF预防。 So i need to pass the tokens with each calls. 因此,我需要在每次调用时传递令牌。 Where do i generate the tokens? 我在哪里生成令牌? in client side or server side? 在客户端还是服务器端? if i create the tokens in JavaScript, how do i validate the same in java? 如果我用JavaScript创建令牌,如何在Java中验证令牌? Or is there any better way to do this? 还是有更好的方法来做到这一点? I am using prototype js for Ajax calls and java struts 1.3 back end 我正在使用原型js进行Ajax调用和java struts 1.3后端

I tried using the struts tokens, but it wont work since no forms associated with the struts actions. 我尝试使用struts令牌,但是由于没有任何形式与struts动作相关联,因此无法使用。

请参考OWASP CSRF参考。这将澄清您的所有疑问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM