Package jade.util

Class 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.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
    • Constructor Detail

      • AccessControlList

        public AccessControlList()
    • 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.