Class SessionManagement

java.lang.Object
de.elo.ix.client.plugin.SessionManagement

public class SessionManagement extends Object
This class is internally used by Indexserver and plugins to mange HTTP session attributes. EIX-1817: CSRF protection for REST calls
  • Field Details

  • Method Details

    • apply

      public static void apply(IXConnection conn, Optional<String> csrfTokenOpt, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Add ticket, IXConnection and CSRF token into HTTP session.
      Parameters:
      conn - IXConnection
      csrfTokenOpt - Token to refuse CSRF attacks aganist rest-plugin.
      request - HTTP request
      response - HTTP response
    • isApproved

      public static boolean isApproved(jakarta.servlet.http.HttpServletRequest request)
      Check CSRF token. This function is called by the REST framework for methods annotated with de.elo.ix.rest.api.Approved to check for a CSRF attack. The client application receives a CSRF token as HTTP cookie in the login response. In each subsequent request to the rest-plugin, the token must be submitted as HTTP header. The cookie name and header name for the CSRF token is HTTP_SESSION_HEADER_APPROVED.
      Parameters:
      request - HTTP request
      Returns:
      true, if CSRF token is correct.