File:  [Public] / java / classes / org / w3c / jigsaw / acl / HTTPPrincipal.java
Revision 1.9: download - view: text, annotated - select for diffs
Fri Oct 18 13:42:12 2013 UTC (10 years, 8 months ago) by ylafon
Branches: MAIN
CVS tags: HEAD
generics + raw types + serializer

// HTTPPrincipal.java
// $Id: HTTPPrincipal.java,v 1.9 2013/10/18 13:42:12 ylafon Exp $
// (c) COPYRIGHT MIT, INRIA and Keio, 1999.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.jigsaw.acl;

import java.net.InetAddress;
import java.security.Principal;

import org.w3c.jigsaw.http.Request;

/**
 * @version $Revision: 1.9 $
 * @author Benoît Mahé (bmahe@w3.org)
 */

/**
 * This class implements the most basic HTTP principal, allowing
 * you to check the IP of the request only
 */

public class HTTPPrincipal implements Principal {

    protected Request request = null;
    protected boolean lenient = false;

    protected Request getRequest() {
        return request;
    }

    protected InetAddress getInetAddress() {
        return request.getClient().getInetAddress();
    }

    public boolean equals(Object another) {
        return false;
    }

    public String getName() {
        return null;
    }

    public String getOriginalName() {
        return null;
    }

    public String getRealm() {
        return null;
    }

    public String toString() {
        return request.getClient().getInetAddress().toString();
    }

    public HTTPPrincipal(Request request) {
        this.request = request;
    }

    public HTTPPrincipal(Request request, boolean lenient) {
        this.lenient = lenient;
        this.request = request;
    }
}

Webmaster