You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jonathan Pierce <Jo...@seagram.com> on 2002/02/15 22:35:15 UTC

Re:cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/

It looks like you accidently removed the empty string check needed here for
ajp.RemoteUser ().
ajp.RemoteUser () should probably also be checked whether it is null before
calling toString.


//if ((!(((Ajp13Connector) connector).getTomcatAuthentication())) 
 //&& (ajp.remoteUser() != null)) {
 //setUserPrincipal(new
//Ajp13Principal(ajp.remoteUser().toString()));
//           } else {
 //              setUserPrincipal(null);
 //          }

should be:

    Ajp13Principal theUserPrincipal = null;
    if ((Ajp13Connector) connector).getTomcatAuthentication())
    {   
        MessageBytes theRemoteUser = ajp.remoteUser ();
        if (theRemoteUser != null)
        {
            String theRemoteUserName = theRemoteUser.toString ();
            if (! theRemoteUserName.equals (""))
            {
                theUserPrincipal = new Ajp13Principal (theRemoteUserName);
            }
        }
    }
    setUserPrincipal(theUserPrincipal);

Jonathan


____________________Reply Separator____________________
Subject:    cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp
Author: "Tomcat Developers List" <to...@jakarta.apache.org>
Date:       2/15/2002 9:13 PM

remm        02/02/15 13:13:19

  Modified:    jk/java/org/apache/ajp/tomcat4 Ajp13Connector.java
                        Ajp13Request.java
  Log:
  - Add a 'tomcatAuthentication' flag, which defaults to true.
  - If the flag is true, Tomcat is 100% responsible of the authentication. If
false,
    the user authenticated by the native webserver will be used.
  - This new flag will be added in the docs, after reviewing.
  - I didn't know I would end up contributing stuff to JK ;-)
  
  Revision  Changes    Path
  1.13      +31 -4    
jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java
  
  Index: Ajp13Connector.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connecto
r.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Ajp13Connector.java       7 Feb 2002 00:44:40 -0000       1.12
  +++ Ajp13Connector.java       15 Feb 2002 21:13:19 -0000      1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connecto
r.java,v 1.12 2002/02/07 00:44:40 costin Exp $
  - * $Revision: 1.12 $
  - * $Date: 2002/02/07 00:44:40 $
  + * $Header:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connecto
r.java,v 1.13 2002/02/15 21:13:19 remm Exp $
  + * $Revision: 1.13 $
  + * $Date: 2002/02/15 21:13:19 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * Implementation of an Ajp13 connector.
    *
    * @author Kevin Seguin
  - * @version $Revision: 1.12 $ $Date: 2002/02/07 00:44:40 $
  + * @version $Revision: 1.13 $ $Date: 2002/02/15 21:13:19 $
    */
   
   
  @@ -273,6 +273,14 @@
   
       private String secret = null;
   
  +
  +    /**
  +     * Tomcat authentication flag. If true, the authnetication is done by
  +     * Tomcat, otherwise, it is done by the native webserver.
  +     */
  +    private boolean tomcatAuthentication = true;
  +
  +
       // -------------------------------------------------------------
Properties
   
   
  @@ -623,6 +631,7 @@
   
       }
   
  +
       /**
        * Returns the <code>Service</code> with which we are associated.
        */
  @@ -630,12 +639,30 @@
        return service;
       }
   
  +
       /**
        * Set the <code>Service</code> with which we are associated.
        */
       public void setService(Service service) {
        this.service = service;
       }
  +
  +
  +    /**
  +     * Get the value of the tomcatAuthentication flag.
  +     */
  +    public boolean getTomcatAuthentication() {
  +        return tomcatAuthentication;
  +    }
  +
  +
  +    /**
  +     * Set the value of the tomcatAuthentication flag.
  +     */
  +    public void setTomcatAuthentication(boolean tomcatAuthentication) {
  +        this.tomcatAuthentication = tomcatAuthentication;
  +    }
  +
   
       // --------------------------------------------------------- Public
Methods
   
  
  
  
  1.8       +3 -3     
jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Request.java
  
  Index: Ajp13Request.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Request.
java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Ajp13Request.java 15 Feb 2002 00:54:43 -0000      1.7
  +++ Ajp13Request.java 15 Feb 2002 21:13:19 -0000      1.8
  @@ -112,9 +112,9 @@
           setServerName(ajp.serverName().toString());
           setServerPort(ajp.getServerPort());
   
  -        String remoteUser = ajp.remoteUser().toString();
  -        if ((remoteUser != null) && (!(remoteUser.equals("")))) {
  -            setUserPrincipal(new Ajp13Principal(remoteUser));
  +        if ((!(((Ajp13Connector) connector).getTomcatAuthentication())) 
  +            && (ajp.remoteUser() != null)) {
  +            setUserPrincipal(new
Ajp13Principal(ajp.remoteUser().toString()));
           } else {
               setUserPrincipal(null);
           }
  
  
  

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


************************************************************************
This email and any files transmitted with it are for the named person's use
only.  It may contain confidential, proprietary or legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistransmission.  If you receive this message in error, please immediately
delete it and all copies of it from your system, destroy any hard copies
of it and notify the sender.  You must not, directly or indirectly, use,
disclose, distribute, print, or copy any part of this message if you
are not the intended recipient.

This email message has been swept by a virus software product for the
presence of computer viruses.
*************************************************************************

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