Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement CSRF protection in PlayFramework 2.1.x (Scala)?

I need to implement a protection against CSRF attack in a Play 2.1.x (Scala) application. I saw that there is a filter play.filters.csrf.CSRFFilter but could not find enough documentation on using it. Other modules (eg https://github.com/orefalo/play2-authenticitytoken) appear to be obsolete / not maintained.

Do I need to create those measures manually?

like image 264
Marco Avatar asked Aug 29 '13 09:08

Marco


1 Answers

The article Marco quoted is handy, but I prefer to apply a global CSRF filter to all my forms as it seems cleaner and involves less code.

See here: http://www.playframework.com/documentation/2.2.x/ScalaCsrf

like image 195
dbau Avatar answered Sep 23 '22 13:09

dbau