jade.util
Class AccessControlList
java.lang.Object
jade.util.AccessControlList
public class AccessControlList
- extends java.lang.Object
An ACL object represents an Access Control List and
wraps a White list and a Black list,
Both lists make use of regular expressions for
allowing/denying access to a certain resource.
//#APIDOC_EXCLUDE_BEGIN
Example, a ACL object is initialized as follows:
ACL myacl = new ACL();
acl.setBlack( new File("black.txt") );
acl.setWhite( new File("white.txt") );
Properties client = new Property();
client.setProperty();
boolean ok = acl.isAllowed();
and the two files look as follows:
white.txt
# this is a commant
# the section 'user' (allowed usernames)
user:
# all users are allowed
.+?
# the section 'msisdn' (allowed phone numbers)
msisdn:
# all business customers
39335.+?
black.txt
user:
# specific users denied
badboy
goodgirl
msisdn:
# specific numbers denied
3933555.+?
39333444111
//#APIDOC_EXCLUDE_END
Into each file, multiple sections are allowed.
A specific client is allowed if:
- it is not present into the black list, AND
- it is present into the white list.
More about regular expressions:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
http://java.sun.com/docs/books/tutorial/extra/regex/
- Author:
- Giosue Vitaglione - Telecom Italia LAB
|
Method Summary |
boolean |
isAllowed(java.lang.String section,
java.lang.String value)
A specific client is allowed if:
it is not present into the black list, AND
it is present into the white list. |
void |
refresh()
Update this AccessControlList object
reading again the white and black files. |
void |
setBlack(java.lang.String blackFileName)
|
void |
setWhite(java.lang.String whiteFileName)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AccessControlList
public AccessControlList()
setBlack
public void setBlack(java.lang.String blackFileName)
setWhite
public void setWhite(java.lang.String whiteFileName)
isAllowed
public boolean isAllowed(java.lang.String section,
java.lang.String value)
- A specific client is allowed if:
- it is not present into the black list, AND
- it is present into the white list.
isAllow("section", value) returns is the client
having that specific value for that property is allowed.
refresh
public void refresh()
- Update this AccessControlList object
reading again the white and black files.