Diff for /java/classes/org/w3c/jigsaw/acl/AclPrincipal.java between versions 1.2 and 1.3

version 1.2, 1999/04/27 12:33:26 version 1.3, 1999/04/27 15:05:47
Line 5 Line 5
     
 package org.w3c.jigsaw.acl;  package org.w3c.jigsaw.acl;
   
 import java.net.InetAddress;  
 import java.security.Principal;  import java.security.Principal;
 import java.util.Hashtable;  import java.net.InetAddress;
   
 import org.w3c.jigsaw.auth.AuthUser;  
 import org.w3c.jigsaw.auth.IPMatcher;  
   
 /**  /**
  * @version $Revision$   * @version $Revision$
  * @author  Benoît Mahé (bmahe@w3.org)   * @author  Benoît Mahé (bmahe@w3.org)
  */   */
 public class AclPrincipal implements Principal {  abstract public interface AclPrincipal extends Principal {
           
     protected String    name      = null;      /**
     protected String    password  = null;       * Get the realm associated to this principal.(could be his group)
     protected String    realm     = null;       * @return the realm name.
     protected Hashtable values    = null;       */
     protected IPMatcher ipmatcher = null;      abstract public String getRealm();
   
     public boolean equals(Object another) {      /**
         if (another instanceof AclPrincipal) {       * Get the password associated to this principal.
             return toString().equals(another.toString());       * @return the password
         } else {       */
             return another.equals(this);      abstract public String getPassword();
         }  
     }      /**
        * Set a parameter.
     public String toString() {       * @param name the parameter name
         if (password == null)       * @param value the parameter value
             return name;       */
         else      abstract public void setValue(String name, Object value);
             return name+":"+password;  
     }      /**
        * Get a parameter value.
     public int hashCode() {       * @param name the parameter name.
         return toString().hashCode();       * @return the parameter value
     }       */
       abstract public Object getValue(String name);
     public String getName() {  
         return name;      /**
     }       * Return true if the IPadress associated to this principal match
        * the given one.
     public String getRealm() {       * @param adr an IP adress
         return realm;       * @return true if the ip adress match.
     }       */
       abstract public boolean matchIP(InetAddress adr);
     public String getPassword() {  
         return password;  
     }  
   
     public void setValue(String name, Object value) {  
         values.put(name, value);  
     }  
   
     public Object getValue(String name) {  
         return values.get(name);  
     }  
   
     public boolean matchIP(InetAddress adr) {  
         return (ipmatcher.lookup(adr) == Boolean.TRUE);  
     }  
   
     public AclPrincipal(AuthUser user, String realm) {  
         this.name      = user.getName();  
         this.password  = user.getPassword();  
         this.realm     = realm;  
         this.ipmatcher = new IPMatcher();  
         this.values    = new Hashtable();  
   
         short ips[][]  = user.getIPTemplates();  
         if ( ips != null ) {  
             for (int i = 0 ; i < ips.length ; i++)   
                 ipmatcher.add(ips[i], Boolean.TRUE);  
         }  
     }  
   
       
 }  }
   

Removed from v.1.2  
changed lines
  Added in v.1.3


Webmaster