public class SimpleXsrfTokenGenerator extends Object implements XsrfTokenGenerator
TOKEN_HTTP_SESSION_KEY, TOKEN_WEB_PARAMETER_KEY| Constructor and Description |
|---|
SimpleXsrfTokenGenerator(JiraAuthenticationContext authenticationContext,
JiraServerIdProvider jiraServerIdProvider) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
generatedByAuthenticatedUser(String token)
This returns true of the token was generated by an authenticated user
|
String |
generateToken()
Gets the token from the current request, generating a new one if none is found
|
String |
generateToken(boolean create)
Gets the token from the current request, optionally generating a new one if none is found
|
String |
generateToken(javax.servlet.http.HttpServletRequest httpServletRequest)
Gets the token from the current request, generating a new one if none is found
|
String |
generateToken(javax.servlet.http.HttpServletRequest httpServletRequest,
boolean create)
Gets the token from the current request, optionally generating a new one if none is found
|
String |
getToken(javax.servlet.http.HttpServletRequest request)
Gets the token from the current request, generating a new one if none is found
|
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 httpServletRequest,
String token)
Validate a form token received as part of a web request
|
public SimpleXsrfTokenGenerator(JiraAuthenticationContext authenticationContext, JiraServerIdProvider jiraServerIdProvider)
public String generateToken(javax.servlet.http.HttpServletRequest httpServletRequest)
XsrfTokenGeneratorgenerateToken in interface XsrfTokenGeneratorhttpServletRequest - the request the token is being generated forpublic String generateToken(javax.servlet.http.HttpServletRequest httpServletRequest, boolean create)
XsrfTokenGeneratorgenerateToken in interface XsrfTokenGeneratorhttpServletRequest - the request the token is being generated forcreate - true to create token if none is foundpublic String generateToken()
XsrfTokenGeneratorgenerateToken in interface XsrfTokenGeneratorpublic String generateToken(boolean create)
XsrfTokenGeneratorgenerateToken in interface XsrfTokenGeneratorcreate - true to create token if none is foundpublic String getXsrfTokenName()
XsrfTokenGeneratorgetXsrfTokenName in interface XsrfTokenGeneratorpublic boolean validateToken(javax.servlet.http.HttpServletRequest httpServletRequest,
String token)
XsrfTokenGeneratorvalidateToken in interface XsrfTokenGeneratorhttpServletRequest - the request the token was received intoken - the tokenpublic boolean generatedByAuthenticatedUser(String token)
XsrfTokenGeneratorgeneratedByAuthenticatedUser in interface XsrfTokenGeneratortoken - the XSRF token in questionpublic String getToken(javax.servlet.http.HttpServletRequest request)
XsrfTokenGeneratorgetToken in interface XsrfTokenGeneratorrequest - request that contains the form token.Copyright © 2002-2019 Atlassian. All Rights Reserved.