Class SecurityTokenService

java.lang.Object
fr.paris.lutece.portal.service.security.SecurityTokenService
All Implemented Interfaces:
ISecurityTokenService

@ApplicationScoped public class SecurityTokenService extends Object implements ISecurityTokenService
This class provides a security service for getting and verify tokens
  • Field Details

  • Method Details

    • getInstance

      @Deprecated(since="8.0", forRemoval=true) public static ISecurityTokenService getInstance()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use @Inject to obtain the SecurityTokenService instance. This method will be removed in future versions.
      Returns the unique instance of the SecurityTokenService service.

      This method is deprecated and is provided for backward compatibility only. For new code, use dependency injection with @Inject to obtain the SecurityTokenService instance instead.

      Returns:
      The unique instance of SecurityTokenService.
    • getToken

      public String getToken(jakarta.servlet.http.HttpServletRequest request, String strAction)
      return a security token
      Specified by:
      getToken in interface ISecurityTokenService
      Parameters:
      request - The Http request
      strAction - the action type
      Returns:
      a security token
    • validate

      public boolean validate(jakarta.servlet.http.HttpServletRequest request, String strAction)
      verify if the request contains the securiy token
      Specified by:
      validate in interface ISecurityTokenService
      Parameters:
      request - The Http request
      strAction - the action type
      Returns:
      true if the request contains the security token associated to the action type
    • consumeToken

      public boolean consumeToken(jakarta.servlet.http.HttpServletRequest request, String strAction, String strToken)
      Validates a token of an action and removes it: a token is used once
      Parameters:
      request - The request
      strAction - The action (key of the token)
      strToken - The token posted
      Returns:
      true if the token was stored for this action