Class LazyCsrfTokenRepository
- java.lang.Object
-
- org.springframework.security.web.csrf.LazyCsrfTokenRepository
-
- All Implemented Interfaces:
CsrfTokenRepository
@Deprecated public final class LazyCsrfTokenRepository extends java.lang.Object implements CsrfTokenRepository
Deprecated.ACsrfTokenRepository
that delays saving newCsrfToken
until the attributes of theCsrfToken
that were generated are accessed.- Since:
- 4.1
-
-
Constructor Summary
Constructors Constructor Description LazyCsrfTokenRepository(CsrfTokenRepository delegate)
Deprecated.Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CsrfToken
generateToken(javax.servlet.http.HttpServletRequest request)
Deprecated.Generates a new tokenCsrfToken
loadToken(javax.servlet.http.HttpServletRequest request)
Deprecated.Delegates to the injectedCsrfTokenRepository
void
saveToken(CsrfToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Deprecated.Does nothing if theCsrfToken
is not null.void
setDeferLoadToken(boolean deferLoadToken)
Deprecated.Determines ifloadToken(HttpServletRequest)
should be lazily loaded.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.security.web.csrf.CsrfTokenRepository
loadDeferredToken
-
-
-
-
Constructor Detail
-
LazyCsrfTokenRepository
public LazyCsrfTokenRepository(CsrfTokenRepository delegate)
Deprecated.Creates a new instance- Parameters:
delegate
- theCsrfTokenRepository
to use. Cannot be null- Throws:
java.lang.IllegalArgumentException
- if delegate is null.
-
-
Method Detail
-
setDeferLoadToken
public void setDeferLoadToken(boolean deferLoadToken)
Deprecated.Determines ifloadToken(HttpServletRequest)
should be lazily loaded.- Parameters:
deferLoadToken
- true if should lazily loadloadToken(HttpServletRequest)
. Default false.
-
generateToken
public CsrfToken generateToken(javax.servlet.http.HttpServletRequest request)
Deprecated.Generates a new token- Specified by:
generateToken
in interfaceCsrfTokenRepository
- Parameters:
request
- theHttpServletRequest
to use. TheHttpServletRequest
must have theHttpServletResponse
as an attribute with the name ofHttpServletResponse.class.getName()
- Returns:
- the
CsrfToken
that was generated. Cannot be null.
-
saveToken
public void saveToken(CsrfToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Deprecated.Does nothing if theCsrfToken
is not null. Saving is done only when theCsrfToken.getToken()
is accessed fromgenerateToken(HttpServletRequest)
. If it is null, then the save is performed immediately.- Specified by:
saveToken
in interfaceCsrfTokenRepository
- Parameters:
token
- theCsrfToken
to save or null to deleterequest
- theHttpServletRequest
to useresponse
- theHttpServletResponse
to use
-
loadToken
public CsrfToken loadToken(javax.servlet.http.HttpServletRequest request)
Deprecated.Delegates to the injectedCsrfTokenRepository
- Specified by:
loadToken
in interfaceCsrfTokenRepository
- Parameters:
request
- theHttpServletRequest
to use- Returns:
- the
CsrfToken
or null if none exists
-
-