Class SecurityTokenHandler

java.lang.Object
fr.paris.lutece.portal.service.security.SecurityTokenHandler

@ApplicationScoped public class SecurityTokenHandler extends Object
Handles the Security token related to the SecurityTokenFilter.
  • Field Details

  • Constructor Details

    • SecurityTokenHandler

      public SecurityTokenHandler()
  • Method Details

    • registerActions

      public void registerActions(String strName, Method[] methods)
      Registers disabled action methods from XPage or MVCAdminJspBean
    • handle

      public void handle(jakarta.servlet.http.HttpServletRequest request)
      Activates the token handling on the request.
      Parameters:
      request - The request
    • shouldNotFilter

      public boolean shouldNotFilter(jakarta.servlet.http.HttpServletRequest request)
      Checks if the request should validate the security token.
      Parameters:
      request - The request
      Returns:
      True if the request should be skipped from the SecurityTokenFilter validation, false otherwise.
    • handleToken

      public void handleToken(jakarta.servlet.http.HttpServletRequest request, MvcEvent.ControllerInvocationType invocationType, Method method)
      Handles the generation and storage of the security token.
      Parameters:
      request - The request
      invocationType - The invocation type
      methods - The MVC methods
    • resolveTokenValue

      public String resolveTokenValue(jakarta.servlet.http.HttpServletRequest request)
      Resolves security token value from the request.
      Parameters:
      request - The request
      Returns:
      The security token value
    • addSessionTokenValue

      public void addSessionTokenValue(jakarta.servlet.http.HttpServletRequest request, Map<String,Object> model)
      Adds the session security token for confirm type actions (SiteMessageHandler / AdminMessageJspBean).
      Parameters:
      request - The request
      model - The model
    • validate

      public boolean validate(jakarta.servlet.http.HttpServletRequest request, String strAction)
      Validates the token for the given request.
      Parameters:
      request - The request
      strAction - The MVC action
      Returns:
      True if the token was valid.
    • addSecurityToken

      public static String addSecurityToken(String strSource, Object model)
      Adds the hidden field to forms located in the given template data.
      Parameters:
      strSource - The template data.
      model - The model
      Returns:
      The updated template data.
    • onControllerInvocation

      public void onControllerInvocation(@Observes BeforeControllerEvent event)
      Observes controller invocations and handles token validation for selected invocation types (ACTION, VIEW, DEFAULT_VIEW).
      Parameters:
      event - the controller event