Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.mit.wi.omnigene.service.mitog.webservice.server
Class AuthenticateIP  view AuthenticateIP download AuthenticateIP.java

java.lang.Object
  extended byedu.mit.wi.omnigene.service.mitog.webservice.server.AuthenticateIP

public class AuthenticateIP
extends java.lang.Object

Authenticates an IP address to a specified system or datastore. AuthenticateIP checks the incoming IP address to see if it's allowed to access the specified system or datastore. The access control list is a properties file that has a format of ip-address=system-name1,system-name2. The value is a comma delimited value of system names that the IP address is allowed to access. If a value of "all" is found then the IP address can access all systems and datastores. A value of "none" rejects the incoming request to any systems.

Version:
$Revision: 1.4

Field Summary
private static AuthenticateIP instance
           
private  java.util.Properties props
           
private  boolean securityEnabled
           
 
Constructor Summary
private AuthenticateIP()
          Constucts an AuthenticateIP object
 
Method Summary
 boolean authenticate(java.lang.String ip, java.lang.String system)
          Authenticates an IP address for a specific system.
private  boolean checkSystemList(java.lang.String allowedSystemsList, java.lang.String system)
          Checks the systems that ip address is allowed to use.
static AuthenticateIP getInstance()
          Returns an instance of AuthenticateIP
private  java.lang.String getIPRangeValue(java.lang.String ip)
          Get value for IP range key.
private  java.lang.String getPropValue(java.lang.String ip)
          Gets the property value for the specified ip address.
 boolean isSecurityEnabled()
          Check to see if security is enabled.
private  void loadPropertyFile()
          Loads the properties file containing approved IP addresses.
static void main(java.lang.String[] args)
          Used for testing the AuthenticateIP class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static AuthenticateIP instance

props

private java.util.Properties props

securityEnabled

private boolean securityEnabled
Constructor Detail

AuthenticateIP

private AuthenticateIP()
                throws java.lang.InstantiationException
Constucts an AuthenticateIP object

Method Detail

getInstance

public static AuthenticateIP getInstance()
                                  throws java.lang.InstantiationException
Returns an instance of AuthenticateIP


authenticate

public boolean authenticate(java.lang.String ip,
                            java.lang.String system)
Authenticates an IP address for a specific system.


isSecurityEnabled

public boolean isSecurityEnabled()
Check to see if security is enabled.


getIPRangeValue

private java.lang.String getIPRangeValue(java.lang.String ip)
Get value for IP range key. If none exists then null is returned.


checkSystemList

private boolean checkSystemList(java.lang.String allowedSystemsList,
                                java.lang.String system)
Checks the systems that ip address is allowed to use.


getPropValue

private java.lang.String getPropValue(java.lang.String ip)
Gets the property value for the specified ip address.


loadPropertyFile

private void loadPropertyFile()
                       throws java.io.IOException
Loads the properties file containing approved IP addresses.


main

public static void main(java.lang.String[] args)
Used for testing the AuthenticateIP class.