Interface CsrfTokenRepository
-
- All Known Implementing Classes:
CookieCsrfTokenRepository,HttpSessionCsrfTokenRepository,LazyCsrfTokenRepository
public interface CsrfTokenRepositoryAn API to allow changing the method in which the expectedCsrfTokenis 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 CsrfTokengenerateToken(javax.servlet.http.HttpServletRequest request)Generates aCsrfTokenCsrfTokenloadToken(javax.servlet.http.HttpServletRequest request)Loads the expectedCsrfTokenfrom theHttpServletRequestvoidsaveToken(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- theHttpServletRequestto use- Returns:
- the
CsrfTokenthat was generated. Cannot be null.
-
saveToken
void saveToken(CsrfToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Saves theCsrfTokenusing theHttpServletRequestandHttpServletResponse. If theCsrfTokenis null, it is the same as deleting it.- Parameters:
token- theCsrfTokento save or null to deleterequest- theHttpServletRequestto useresponse- theHttpServletResponseto use
-
-