Interface CsrfTokenRepository

All Known Implementing Classes:
SessionCsrfTokenRepository, SpringCsrfTokenRepository

public interface CsrfTokenRepository
Generates CSRF tokens.

Note that the tokens should be generated in safe way - that means they should not be guessable.

  • Method Details

    • generateToken

      CsrfToken generateToken()
      Returns:
      a newly generated CSRF token
    • saveToken

      void saveToken(CsrfToken token)
      Saves the CsrfToken using the HttpServletRequest and HttpServletResponse. If the CsrfToken is null, it is the same as deleting it.
      Parameters:
      token - the CsrfToken to save or null to delete
    • loadToken

      CsrfToken loadToken()
      Loads the expected CsrfToken from the HttpServletRequest
      Returns:
      the CsrfToken or null if none exists