XSRF (CSRF) Protection - Synchronizer Token Pattern

 

Introduction

This is the most popular implementation to prevent Cross-site Request Forgery (CSRF), and it makes use of a challenge token that is associated with a particular user which is used as a hidden value in every state changing form which is present on the web application.

How?

This token, called a CSRF Token or a Synchronizer Token, works as follows: