A CSRF token is a unique, unpredictable value generated for each user session to protect against cross-site request forgery.
A CSRF token helps prevent unauthorized commands from being transmitted from a user that the web application trusts. In a Java web application, CSRF tokens are often included in forms and verified on submission to ensure the request came from the authenticated user. For example, in a Spring Boot application, the CSRF token is embedded in the HTML form, and the server checks the token's validity when the form is submitted.
Additional Notes
How would you explain a CSRF token in an interview?