public class CsrfValidator extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CSRF_PARAMETER |
static String |
CSRF_SESSION_TOKEN |
| Constructor and Description |
|---|
CsrfValidator() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getRequestToken(javax.servlet.http.HttpServletRequest request)
Retrieve the CSRF token parameter that is on the given request, or null if the request has none.
|
static String |
getSessionToken(javax.servlet.http.HttpServletRequest request)
Retrieve the CSRF token that is associated with the session for the given request, or null if the session has none.
|
static void |
placeSessionToken(javax.servlet.http.HttpServletRequest request)
If the session associated with the given request has no CSRF token, this method will generate that token and
add it as an attribute on the session.
|
static boolean |
validateCsrf(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Applies CSRF protection for any HTTP method other than GET, HEAD, or OPTIONS.
|
public static final String CSRF_PARAMETER
public static final String CSRF_SESSION_TOKEN
public CsrfValidator()
public static boolean validateCsrf(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request - the http request to checkresponse - the http response associated with the given requestpublic static String getSessionToken(javax.servlet.http.HttpServletRequest request)
request - the request to check the session for the CSRF tokenpublic static String getRequestToken(javax.servlet.http.HttpServletRequest request)
request - the request to check for the CSRF token parameterpublic static void placeSessionToken(javax.servlet.http.HttpServletRequest request)
request - the request with the session on which to place the session token if neededCopyright © 2005–2016 The Kuali Foundation. All rights reserved.