public class SimpleXsrfTokenGenerator extends Object implements XsrfTokenGenerator
Tokens are chosen to be reasonably unique (60 bits) with reasonably short representations (base64 encoded).
| Modifier and Type | Field and Description |
|---|---|
static String |
TOKEN_SESSION_KEY |
| Constructor and Description |
|---|
SimpleXsrfTokenGenerator() |
| Modifier and Type | Method and Description |
|---|---|
String |
generateToken(javax.servlet.http.HttpServletRequest request)
Generate a new form token for the current request.
|
String |
getToken(javax.servlet.http.HttpServletRequest request,
boolean create)
Retrieves the token from the request.
|
String |
getXsrfTokenName()
Convenience method which will return the name to be used for a supplied XsrfToken in a request.
|
boolean |
validateToken(javax.servlet.http.HttpServletRequest request,
String token)
Validate a form token received as part of a web request
|
public static final String TOKEN_SESSION_KEY
public String getToken(javax.servlet.http.HttpServletRequest request, boolean create)
XsrfTokenGeneratorgetToken in interface XsrfTokenGeneratorrequest - the request the token is retrieved fromcreate - if true, a token will be created if it doesn't already existpublic String generateToken(javax.servlet.http.HttpServletRequest request)
XsrfTokenGeneratorgenerateToken in interface XsrfTokenGeneratorrequest - the request the token is being generated forpublic String getXsrfTokenName()
XsrfTokenGeneratorgetXsrfTokenName in interface XsrfTokenGeneratorpublic boolean validateToken(javax.servlet.http.HttpServletRequest request,
String token)
XsrfTokenGeneratorvalidateToken in interface XsrfTokenGeneratorrequest - the request the token was received intoken - the tokenCopyright © 2018 Atlassian. All rights reserved.