Class XsrfTokenUtils


  • public class XsrfTokenUtils
    extends Object
    • Method Detail

      • getTokenFromRequestParameters

        public static String getTokenFromRequestParameters​(javax.servlet.http.HttpServletRequest request)
        Returns the xsrf token value from the request parameters.
        Parameters:
        request - the request to obtain the xsrf token from.
        Returns:
        the xsrf token value derived from the parameters of the given request.
      • getXsrfTokenSource

        public static String getXsrfTokenSource​(javax.servlet.http.HttpServletRequest request)
      • getOrCreateXsrfCookie

        @Nullable
        public static @Nullable String getOrCreateXsrfCookie​(@NotNull
                                                             @NotNull javax.servlet.http.HttpServletRequest request,
                                                             @NotNull
                                                             @NotNull javax.servlet.http.HttpServletResponse response)
        Returns a pair of a xsrf cookie and whether the request contains a xsrf cookie already. When the request did not include a xsrf cookie then a new one is created.
        Parameters:
        request - the executing request.
        response -
        Returns:
        an existing xsrf token value or null if it has only just been created
      • getXsrfToken

        @Nullable
        public static @Nullable String getXsrfToken​(@NotNull
                                                    @NotNull javax.servlet.http.HttpServletRequest request)
        Returns value of the xsrf token for the given request
        Parameters:
        request - the executing request
        Returns:
        the xsrf token for the given request.