|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.org.iscream.cms.util.ACL
Access Control List for use primarily with the ACLServerSocket. It could, however have other uses as it has a fairly generic behaviour. Rules are added using the add method, and then checks can be made using the relevant check method.
Nested Class Summary | |
private class |
ACL.ACLRule
Wrapper class for an ACL rule. |
Field Summary | |
private ArrayList |
_acl
The ACL is stored in this ArrayList. |
private boolean |
_defaultMode
The default mode of this ACL. |
private String |
_name
This is the friendly identifier of the component this class is running in. |
static boolean |
ALLOW
static to be used when adding an ALLOW rule to the ACL. |
static boolean |
DEFMODE
default setting for the default mode for a new ACL. |
static boolean |
DENY
static to be used when adding a DENY rule to the ACL. |
static String |
REVISION
The current CVS revision of this class |
Constructor Summary | |
ACL()
Construct a new Access Control List. |
|
ACL(boolean defaultMode)
Construct a new Access Control List with a given default mode. |
|
ACL(String acl)
Construct a new Access Control List with a given String representation of the ACL rules. |
Method Summary | |
void |
add(boolean allow,
String expression)
Add a new rule to the ACL immediately after the previous rule. |
void |
add(String acl)
Add some new rules to the Access Control List in the form of a String. |
boolean |
check(InetAddress address)
Check to see if an InetAddress is permitted by the ACL. |
boolean |
check(String address)
Check to see if a string is permitted by the ACL. |
void |
clear()
Clears the ACL and resets the default mode. |
private boolean |
compareShorts(short[] first,
short[] second)
Compares two short arrays. |
private short[] |
ipStringToShort(String ip)
Converts an IP address in String format into a short array of length 4. |
void |
setDefaultMode(boolean defaultMode)
Changes the default mode of the ACL. |
String |
toString()
Gives a String representation of this ACL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String REVISION
public static final boolean ALLOW
public static final boolean DENY
public static final boolean DEFMODE
private String _name
private ArrayList _acl
private boolean _defaultMode
Constructor Detail |
public ACL()
public ACL(boolean defaultMode)
defaultMode
- the default mode for non-matched checkspublic ACL(String acl)
acl
- a String representation of the ACL.Method Detail |
public void add(boolean allow, String expression)
public void add(String acl)
acl
- a String representation of the ACL.public boolean check(String address)
address
- the string to check
public boolean check(InetAddress address)
address
- the InetAddress to check
public void clear()
public void setDefaultMode(boolean defaultMode)
defaultMode
- the new default modepublic String toString()
private short[] ipStringToShort(String ip)
ip
- The IP address in String format
private boolean compareShorts(short[] first, short[] second)
first
- The first array to compare (with -1 wildcard if required)second
- The second array to compare
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |