Interface CsrfTokenRepository
-
- All Known Implementing Classes:
CookieCsrfTokenRepository
,HttpSessionCsrfTokenRepository
,LazyCsrfTokenRepository
public interface CsrfTokenRepository
An API to allow changing the method in which the expectedCsrfToken
is associated to theHttpServletRequest
. For example, it may be stored inHttpSession
.- Since:
- 3.2
- See Also:
HttpSessionCsrfTokenRepository
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CsrfToken
generateToken(javax.servlet.http.HttpServletRequest request)
Generates aCsrfToken
CsrfToken
loadToken(javax.servlet.http.HttpServletRequest request)
Loads the expectedCsrfToken
from theHttpServletRequest
void
saveToken(CsrfToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
-
-
Method Detail
-
generateToken
CsrfToken generateToken(javax.servlet.http.HttpServletRequest request)
Generates aCsrfToken
- Parameters:
request
- theHttpServletRequest
to use- Returns:
- the
CsrfToken
that was generated. Cannot be null.
-
saveToken
void saveToken(CsrfToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Saves theCsrfToken
using theHttpServletRequest
andHttpServletResponse
. If theCsrfToken
is null, it is the same as deleting it.- Parameters:
token
- theCsrfToken
to save or null to deleterequest
- theHttpServletRequest
to useresponse
- theHttpServletResponse
to use
-
-