Package jade.util
Class AccessControlList
- java.lang.Object
-
- jade.util.AccessControlList
-
public class AccessControlList extends 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.txtuser: # 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.
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
-
-
Constructor Summary
Constructors Constructor Description AccessControlList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAllowed(String section, String value)A specific client is allowed if: it is not present into the black list, AND it is present into the white list.voidrefresh()Update this AccessControlList object reading again the white and black files.voidsetBlack(String blackFileName)voidsetWhite(String whiteFileName)
-
-
-
Method Detail
-
setBlack
public void setBlack(String blackFileName)
-
setWhite
public void setWhite(String whiteFileName)
-
isAllowed
public boolean isAllowed(String section, 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.
-
-