01: // HTTPPrincipal.java
02: // $Id: HTTPPrincipal.java,v 1.8 2005/02/18 17:35:13 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigsaw.acl;
07:
08: import java.net.InetAddress;
09: import java.security.Principal;
10:
11: import org.w3c.jigsaw.http.Request;
12:
13: /**
14: * @version $Revision: 1.8 $
15: * @author Benoît Mahé (bmahe@w3.org)
16: */
17:
18: /**
19: * This class implements the most basic HTTP principal, allowing
20: * you to check the IP of the request only
21: */
22:
23: public class HTTPPrincipal implements Principal {
24:
25: protected Request request = null;
26: protected boolean lenient = false;
27:
28: protected Request getRequest() {
29: return request;
30: }
31:
32: protected InetAddress getInetAddress() {
33: return request.getClient().getInetAddress();
34: }
35:
36: public boolean equals(Object another) {
37: return false;
38: }
39:
40: public String getName() {
41: return null;
42: }
43:
44: public String getOriginalName() {
45: return null;
46: }
47:
48: public String getRealm() {
49: return null;
50: }
51:
52: public String toString() {
53: return request.getClient().getInetAddress().toString();
54: }
55:
56: public HTTPPrincipal(Request request) {
57: this .request = request;
58: }
59:
60: public HTTPPrincipal(Request request, boolean lenient) {
61: this.lenient = lenient;
62: this.request = request;
63: }
64: }
|