Class IPAuthentificator

java.lang.Object
fr.paris.lutece.util.signrequest.IPAuthentificator
All Implemented Interfaces:
RequestAuthenticator

public class IPAuthentificator extends Object implements RequestAuthenticator
IPAuthentificator is a class that authenticates requests based on the client's IP address. It can be configured to either allow or block requests from specific IP addresses.
  • Constructor Details

    • IPAuthentificator

      public IPAuthentificator()
  • Method Details

    • getIPs

      public Set<String> getIPs()
      Gets the list of IP addresses.
      Returns:
      the list of IP addresses
    • setIPs

      public void setIPs(Set<String> list)
      Sets the list of IP addresses.
      Parameters:
      list - The list of IP addresses
    • setAuthorizedPaths

      public void setAuthorizedPaths(Set<String> list)
      Sets the list of authorized path exclusions for IP restriction
      Parameters:
      list - The list of excluded paths
    • getAuthorizedPaths

      public Set<String> getAuthorizedPaths()
      Gets the list of authorized path exclusions for IP restriction
      Returns:
      the list of excluded paths
    • getMode

      public IPAuthentificator.MODE getMode()
      Gets the enum value that defines if the IPs in the set will be allowed or denied.
      Returns:
      the enum case (either ALLOW or BLOCK)
    • setMode

      public void setMode(IPAuthentificator.MODE mode)
      Sets the enum value that defines if the IPs in the set will be allowed or denied.
      Parameters:
      mode - The enum value of allow or block
    • isRequestAuthenticated

      public boolean isRequestAuthenticated(javax.servlet.http.HttpServletRequest request)
      Check the Authentication of a request Authenticates the request based on the client's IP address. (Do not apply IP restriction if the Servlet path starts with one of the authorized path)
      Specified by:
      isRequestAuthenticated in interface RequestAuthenticator
      Parameters:
      request - The HTTP request to authenticate
      Returns:
      true if the request is authenticated, false otherwise
    • getSecurityInformations

      public AuthenticateRequestInformations getSecurityInformations(List<String> elements)
      return Security informations to put in the request headers and request parameters Gets security information for the request.
      Specified by:
      getSecurityInformations in interface RequestAuthenticator
      Parameters:
      elements - The list of elements to include in the security information
      Returns:
      An instance of AuthenticateRequestInformations containing the security information