You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/02/02 18:49:11 UTC

cvs commit: jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication AbstractAuthentication.java BasicAuthentication.java

vmassol     02/02/02 09:49:10

  Modified:    src/framework/share/org/apache/cactus/client/authentication
                        AbstractAuthentication.java
                        BasicAuthentication.java
  Log:
  more reformatting
  
  Revision  Changes    Path
  1.4       +52 -14    jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/AbstractAuthentication.java
  
  Index: AbstractAuthentication.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/AbstractAuthentication.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractAuthentication.java	27 Jan 2002 20:00:38 -0000	1.3
  +++ AbstractAuthentication.java	2 Feb 2002 17:49:10 -0000	1.4
  @@ -57,61 +57,99 @@
   
   /**
    * This class was designed with the simple assumption that ALL authentication
  - * implementations will have a String <code>UserId</code> and a string
  - * <code>Password</code>. Two abstract functions <code>validateUserId</code> and
  + * implementations will have a String <code>Name</code> and a String
  + * <code>Password</code>. Two abstract functions <code>validateName</code> and
    * <code>validatePassword</code> provide for concrete implementations to
    * perform character validation. All the work is then done in the
    * <code>configure</code> abstract function. In the
    * <code>BasicAuthentication</code> class, for example, the configuring is done
    * by adding the request property "Authorization" with a value
  - * "Basic <base64encode of 'userid:password'>".
  + * "Basic &lt;base64encode of 'userid:password'&gt;".
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    * @author <a href="mailto:Jason.Robertson@acs-inc.com">Jason Robertson</a>
    *
  - * @version $Id: AbstractAuthentication.java,v 1.3 2002/01/27 20:00:38 vmassol Exp $
  + * @version $Id: AbstractAuthentication.java,v 1.4 2002/02/02 17:49:10 vmassol Exp $
    */
   public abstract class AbstractAuthentication
   {
       /**
  -     * User id part of the Credential
  +     * User name part of the Credential
        */
  -    private String userId;
  +    private String name;
   
       /**
        * Password part of the Credential
        */
       private String password;
   
  -    public AbstractAuthentication(String theUserId, String thePassword)
  +    /**
  +     * @param theName user name of the Credential
  +     * @param thePassword user password of the Credential
  +     */
  +    public AbstractAuthentication(String theName, String thePassword)
       {
  -        setUserId(theUserId);
  +        setName(theName);
           setPassword(thePassword);
       }
   
  -    public void setUserId(String theUserId)
  +    /**
  +     * Sets the user name.
  +     *
  +     * @param theName user name of the Credential
  +     */
  +    public void setName(String theName)
       {
  -        validateUserId(theUserId);
  -        this.userId = theUserId;
  +        validateName(theName);
  +        this.name = theName;
       }
   
  -    public String getUserId()
  +    /**
  +     * @return the user name of the Credential
  +     */
  +    public String getName()
       {
  -        return this.userId;
  +        return this.name;
       }
   
  +    /**
  +     * Sets the user password of the Credential.
  +     *
  +     * @param thePassword the user password of the Credential
  +     */
       public void setPassword(String thePassword)
       {
           validatePassword(thePassword);
           this.password = thePassword;
       }
   
  -    protected abstract void validateUserId(String theUserId);
  +    /**
  +     * Verify that the user name passed as parameter is a valid user name
  +     * for the current authentication scheme.
  +     *
  +     * @param theName the user name to validate
  +     */
  +    protected abstract void validateName(String theName);
   
  +    /**
  +     * Verify that the user password passed as parameter is a valid user
  +     * password for the current authentication scheme.
  +     *
  +     * @param thePassword the user password to validate
  +     */
       protected abstract void validatePassword(String thePassword);
   
  +    /**
  +     * Modify the <code>HttpURLConnection</code> passed as parameter so
  +     * that it will carry authentication information.
  +     *
  +     * @param theConnection the HTTP connection to the server URL
  +     */
       public abstract void configure(HttpURLConnection theConnection);
   
  +    /**
  +     * @return the user password of the Credential
  +     */
       protected String getPassword()
       {
           return this.password;
  
  
  
  1.5       +14 -5     jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/BasicAuthentication.java
  
  Index: BasicAuthentication.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/BasicAuthentication.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasicAuthentication.java	27 Jan 2002 20:00:38 -0000	1.4
  +++ BasicAuthentication.java	2 Feb 2002 17:49:10 -0000	1.5
  @@ -64,7 +64,10 @@
           super(userid, password);
       }
   
  -    protected void validateUserId(String userid)
  +    /**
  +     * @see AbstractAuthentication.validateName(String)
  +     */
  +    protected void validateName(String userid)
       {
           // According to HTTP 1.0 Spec:
           // userid   = [ token ]
  @@ -103,6 +106,9 @@
           }
       }
   
  +    /**
  +     * @see AbstractAuthentication.validatePassword(String)
  +     */
       protected void validatePassword(String password)
       {
           // According to HTTP 1.0 Spec:
  @@ -143,6 +149,9 @@
           }
       }
   
  +    /**
  +     * @see AbstractAuthentication.configure(HttpURLConnection)
  +     */
       public void configure(HttpURLConnection connection)
       {
           // According to HTTP 1.0 Spec:
  @@ -151,9 +160,9 @@
           //                     except not limited to 76 char/line>
           // userid-password   = [ token ] ":" *TEXT
           //
  -        // see setUserId and setPassword for details of token and TEXT
  +        // see setName and setPassword for details of token and TEXT
   
  -        String basicCookie = getUserId() + ":" + getPassword();
  +        String basicCookie = getName() + ":" + getPassword();
           String basicCredentials = "Basic " +
               new String(base64Encode(basicCookie.getBytes()));
   
  @@ -225,10 +234,10 @@
                   quad = true;
               }
   
  -            out[index + 3] = alphabet[(quad ? (val & 0x3F): 64)];
  +            out[index + 3] = alphabet[(quad ? (val & 0x3F) : 64)];
               val >>= 6;
   
  -            out[index + 2] = alphabet[(trip ? (val & 0x3F): 64)];
  +            out[index + 2] = alphabet[(trip ? (val & 0x3F) : 64)];
               val >>= 6;
   
               out[index + 1] = alphabet[val & 0x3F];
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>