com.groiss.util
Class IPChecker

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

public class IPChecker
extends java.lang.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 Summary
IPChecker(java.lang.String allowPattern, java.lang.String denyPattern)
           
 
Method Summary
 boolean accessAllowed(java.net.InetAddress inetAddress)
          Checks if the specified InetAdress has permission to access.
 boolean accessAllowed(java.net.Socket socket)
          Checks if a (connection from a) socket has permission to access.
 boolean accessAllowed(java.lang.String hostName)
          Checks if the host with the specified name has the permission to access.
static IPChecker getConfiguredIPChecker()
          Returns an IPChecker which is initialized with the patterns from the configuration
static void init()
          initializes the ip-checker;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPChecker

public IPChecker(java.lang.String allowPattern,
                 java.lang.String denyPattern)
Method Detail

getConfiguredIPChecker

public static IPChecker getConfiguredIPChecker()
Returns an IPChecker which is initialized with the patterns from the configuration

Returns:
the IPChecker according to the configuration

init

public static void init()
initializes the ip-checker;


accessAllowed

public boolean accessAllowed(java.lang.String hostName)
Checks if the host with the specified name has the permission to access.

Parameters:
hostName - the name or string IP representation.
Returns:
true if the host name is known and is allowed to access.

accessAllowed

public boolean accessAllowed(java.net.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(java.net.InetAddress inetAddress)
Checks if the specified InetAdress has permission to access.

Parameters:
inetAddress - the InetAdress to check access for.
Returns:
true if the InetAdress is allowed to access.


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.