Multiple choice technology security

Which method among the below could be used as a defense against Cross Site Request Forgery?

  1. encryptHiddenField(java.lang.String value)

  2. addCSRFToken(final java.lang.String href)

  3. verifySecureComm(javax.servlet.http.HttpServletRequest request)

  4. setSafeContentType(javax.servlet.http.HttpServletResponse response)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Preventing Cross Site Request Forgery requires associating requests with a unique, unpredictable, and user-specific token. The addCSRFToken method appends this token to URLs, verifying that the request originated from the authenticated user rather than an external site.