Class IPChecker

java.lang.Object
com.groiss.util.IPChecker

public class IPChecker extends Object
IPChecker allows to check IP Addresses with respect to the allow/deny patterns specified in the configuration. Works with IPV4 and IPV6 adress formats.
  • Constructor Details

  • Method Details

    • getConfiguredIPChecker

      public static IPChecker getConfiguredIPChecker(HttpServletRequest request)
      Returns an IPChecker which is initialized with the patterns from the configuration
      Returns:
      the IPChecker according to the configuration
    • accessAllowed

      public boolean accessAllowed(String hostName, String proxyName)
      Checks if the host with the specified name /from the specified proxy has the permission to access.
      Parameters:
      hostName - the name or string IP representation.
      proxyName - the name or string IP representation.
      Returns:
      true if the host name is known and is allowed to access.
    • accessAllowed

      public boolean accessAllowed(Socket socket)
      Checks if a (connection from a) socket has permission to access.
      Parameters:
      socket - the Socket to check access for.
      Returns:
      true if the connection from the socket is allowed to access.
    • accessAllowed

      public boolean accessAllowed(InetAddress inetAddress, InetAddress proxyAddress)
      Checks if the specified InetAdress has permission to access.
      Parameters:
      inetAddress - the InetAdress to check access for.
      proxyAddress - the InetAdress to check access for (if a rule is defined as proxyRule)
      Returns:
      true if the InetAdress is allowed to access.