Package com.atlassian.jira.security.xsrf
Class BootstrapXsrfTokenGenerator
java.lang.Object
com.atlassian.jira.security.xsrf.BootstrapXsrfTokenGenerator
- All Implemented Interfaces:
XsrfTokenGenerator
A no-op XsrfTokenGenerator that is added to the Bootstrap container because it is required in Servlet Filters.
- Since:
- v6.4.5
-
Field Summary
Fields inherited from interface com.atlassian.jira.security.xsrf.XsrfTokenGenerator
TOKEN_HTTP_SESSION_KEY, TOKEN_WEB_PARAMETER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis returns true of the token was generated by an authenticated userGets the token from the current request, generating a new one if none is foundgenerateToken(boolean create) Gets the token from the current request, optionally generating a new one if none is foundgenerateToken(javax.servlet.http.HttpServletRequest request) Gets the token from the current request, generating a new one if none is foundgenerateToken(javax.servlet.http.HttpServletRequest request, boolean create) Gets the token from the current request, optionally generating a new one if none is foundgetToken(javax.servlet.http.HttpServletRequest request) Gets the token from the current request, generating a new one if none is foundConvenience method which will return the name to be used for a supplied XsrfToken in a request.booleanvalidateToken(javax.servlet.http.HttpServletRequest request, String token) Validate a form token received as part of a web request
-
Constructor Details
-
BootstrapXsrfTokenGenerator
public BootstrapXsrfTokenGenerator()
-
-
Method Details
-
generateToken
Description copied from interface:XsrfTokenGeneratorGets the token from the current request, generating a new one if none is found- Specified by:
generateTokenin interfaceXsrfTokenGenerator- Returns:
- a valid XSRF form token
-
generateToken
Description copied from interface:XsrfTokenGeneratorGets the token from the current request, optionally generating a new one if none is found- Specified by:
generateTokenin interfaceXsrfTokenGenerator- Parameters:
create- true to create token if none is found- Returns:
- a valid XSRF form token
-
generateToken
Description copied from interface:XsrfTokenGeneratorGets the token from the current request, generating a new one if none is found- Specified by:
generateTokenin interfaceXsrfTokenGenerator- Parameters:
request- the request the token is being generated for- Returns:
- a valid XSRF form token
-
generateToken
Description copied from interface:XsrfTokenGeneratorGets the token from the current request, optionally generating a new one if none is found- Specified by:
generateTokenin interfaceXsrfTokenGenerator- Parameters:
request- the request the token is being generated forcreate- true to create token if none is found- Returns:
- a valid XSRF form token
-
getToken
Description copied from interface:XsrfTokenGeneratorGets the token from the current request, generating a new one if none is found- Specified by:
getTokenin interfaceXsrfTokenGenerator- Parameters:
request- request that contains the form token.- Returns:
- the token stored in the cookie of this request.
-
getXsrfTokenName
Description copied from interface:XsrfTokenGeneratorConvenience method which will return the name to be used for a supplied XsrfToken in a request.- Specified by:
getXsrfTokenNamein interfaceXsrfTokenGenerator- Returns:
- the name in the request for the Xsrf token.
-
validateToken
Description copied from interface:XsrfTokenGeneratorValidate a form token received as part of a web request- Specified by:
validateTokenin interfaceXsrfTokenGenerator- Parameters:
request- the request the token was received intoken- the token- Returns:
- true iff the token is valid
-
generatedByAuthenticatedUser
Description copied from interface:XsrfTokenGeneratorThis returns true of the token was generated by an authenticated user- Specified by:
generatedByAuthenticatedUserin interfaceXsrfTokenGenerator- Parameters:
token- the XSRF token in question- Returns:
- true if the token was generated by an authenticated user.
-