ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/ACL/ACLTest.java
Revision: 1.1
Committed: Wed Dec 19 23:43:27 2001 UTC (22 years, 10 months ago) by tdb
Branch: MAIN
Log Message:
Initial checkin of ACL code for i-scream server. At present it should allow for
ServerSocket's to be wrapped up with an access control list. Very simple to
use, will javadoc sometime soon. Essentially construct a ACLServerSocket
instead of a ServerSocket, then set an ACL (defaults to open ACL). Then it
can be used as a ServerSocket due to inheritance, and will only return from
the allow() method if the connecting Socket is permitted by the ACL.

File Contents

# User Rev Content
1 tdb 1.1 class ACLTest {
2    
3     public static void main(String args[]) {
4     ACL acl = new ACL(ACL.DENY);
5    
6     acl.add(ACL.ALLOW, "*.ukc.ac.uk");
7     acl.add(ACL.ALLOW, "129.12.*");
8     // not really needed if we default to deny :)
9     acl.add(ACL.DENY, "*");
10    
11     System.out.println(acl.getACL());
12    
13     System.out.println("killigrew.ukc.ac.uk: " + acl.check("killigrew.ukc.ac.uk"));
14     System.out.println("129.12.41.13: " + acl.check("129.12.41.13"));
15     System.out.println("kruskal.18hp.net: " + acl.check("kruskal.18hp.net"));
16     System.out.println("192.168.1.1: " + acl.check("192.168.1.1"));
17     }
18    
19     }