|
Sea 0.4.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.lbl.dsd.sea.nio.auth.SmartHostAuthorizationRules
Powerful authorization rules to be used by SmartHostAuthorizer
;
Supports allow and deny rules based on exact or patterned DNS host names,
exact or patterned IP addresses, as well as regular expressions on
"hostName/IPaddress" pairs.
Can be configured programmatically or via a configuration file (see file "authorization.properties") for an example.
Field Summary | |
static String |
ALL
Meta match all hosts (no matter what DNS name or IP address) |
static String |
COMMON_DOMAIN
Relative to localhost, meta match hosts in the same DNS domain |
static String |
COMMON_SUBNET
Relative to localhost, meta match hosts in the same IP subnet |
static String |
LOOPBACK
Relative to localhost, meta match loopback hosts (including localhost) |
Constructor Summary | |
SmartHostAuthorizationRules()
Creates an empty instance with no rules (isMatch(x) returns false). |
Method Summary | |
SmartHostAuthorizationRules |
addHost(String host)
Adds the given host or pattern to the set of rules. |
SmartHostAuthorizationRules |
addRegex(String regex)
Adds the given regular expression on "hostName/IPaddress" to the set of rules. |
static SmartHostAuthorizer |
createHostAuthorizer(ExtendedProperties properties)
Creates an authorizer from the given configuration properties. |
static SmartHostAuthorizer |
createHostAuthorizer(String fileName)
Creates an authorizer from the properties in the given configuration file. |
boolean |
isMatch(InetAddress address)
Returns whether or not the given host (aka InetAddress) matches ANY of the current rules. |
static void |
main(String[] args)
Program to quickly test whether or not a given host is allowed; Useful to assist in becoming familiar with the configuration file syntax; Example usage: java [class] [configFileName] [hostName] |
String |
toString()
Returns a summary string representation of the receiver. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String ALL
public static final String LOOPBACK
public static final String COMMON_DOMAIN
public static final String COMMON_SUBNET
Constructor Detail |
public SmartHostAuthorizationRules()
Method Detail |
public static SmartHostAuthorizer createHostAuthorizer(ExtendedProperties properties)
properties
- the configuration properties to usepublic static SmartHostAuthorizer createHostAuthorizer(String fileName) throws IOException
fileName
- the configuration file to use
IOException
public SmartHostAuthorizationRules addHost(String host)
host
- the host to pattern to add.
Exact address example: "131.243.2.165", Prefix patterned address example: "131.243."
Exact name example: "doggy.lbl.gov", Suffix patterned name example: ".lbl.gov"
Meta pattern examples: "all", "loopback", "common-domain", "common-subnet"
public SmartHostAuthorizationRules addRegex(String regex)
regex
- Example: "clusternode.+?\.lbl\.gov/.*"
public boolean isMatch(InetAddress address)
isMatch
in interface HostAuthorizationRules
public String toString()
public static void main(String[] args) throws IOException
IOException
|
Sea 0.4.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |