Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 85289 invoked from network); 28 May 2003 20:10:31 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 28 May 2003 20:10:31 -0000 Received: (qmail 23420 invoked by uid 97); 28 May 2003 20:12:47 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 23412 invoked from network); 28 May 2003 20:12:47 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 28 May 2003 20:12:47 -0000 Received: (qmail 83908 invoked by uid 500); 28 May 2003 20:10:12 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 83897 invoked from network); 28 May 2003 20:10:12 -0000 Received: from unknown (HELO isis.tis.com.ar) (63.69.230.251) by daedalus.apache.org with SMTP; 28 May 2003 20:10:12 -0000 Received: from localhost (isis [127.0.0.1]) by isis.tis.com.ar (Postfix) with ESMTP id 9BC1333DD9 for ; Wed, 28 May 2003 17:07:04 -0300 (ART) Received: by isis.tis.com.ar (Postfix, from userid 515) id 32FFC33DE0; Wed, 28 May 2003 17:07:00 -0300 (ART) Received: from hotpop.com (venus.tis.com.ar [63.69.231.252]) by isis.tis.com.ar (Postfix) with ESMTP id 9F58033DD5 for ; Wed, 28 May 2003 17:06:55 -0300 (ART) Message-ID: <3ED5163A.9060402@hotpop.com> Date: Wed, 28 May 2003 17:04:10 -0300 From: seb_esp User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: getUserPrincipal() returning null after authenticated References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,HTML_20_30,IN_REP_TO, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MOZILLA_UA,WEIRD_PORT,X_ACCEPT_LANG version=2.54 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Sanitizer: Sanitized by Technisys Mailserver X-Sanitizer-URL: http://mailtools.anomy.net/ X-Sanitizer-Rev: $Id: Sanitizer.pm,v 1.68 2003/05/09 16:59:41 bre Exp $ X-Antivirus: Scanned X-Virus-Scanned: by AMaViS 0.3.12 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N That's the expected behavior. It's in Sun's Servlet spec., don't remember exactly where... The user will be null if you are in an unprotected resource, EVEN if your are authenticated. Regards, Brian K Bonner wrote: > Hello, > > I'm seeing something wierd with 4.1.24. If I access an unprotected > resource after I am authenticated, I receive null from getUserPrincipal(). > I am using the Coyote Http 1.1 connector, although I've tried it with the > old catalina Http 1.1 connector. > > Here's the test case: > 1) access the unprotected servlet first you'll see "testing unprotected > servlet. user is null" using either: > http://localhost:8083/testing/unprotected or > http://localhost:8080/testing/unprotected > 2) access the protected servlet, you'll be challenged with the basic auth > dialog and then see: "testing protected servlet. user is > GenericPrincipal[tomcat]" using either: > http://localhost:8083/testing/protected or > http://localhost:8080/testing/protected > 3) access the unprotected servlet, I still see: "testing unprotected > servlet. user is null" access it the same as in #1 > > This should return the same as #2, but it doesn't. Can someone explain > why?? and How can I workaround this problem?? I've been searching on the > web, but www.mail-archive appears to be down. > > Brian > > > > Using Tomcat 4.1.24 standalone with the memory realm. > > Here's my abbreviated conf/tomcat-users.xml: > > > > > > > The get methods of my two servlets (protected and unprotected) > > unprotected servlet's doGet: > > PrintWriter out = res.getWriter(); > out.println("testing unprotected servlet"); > out.print("user is "); > Principal p = req.getUserPrincipal(); > out.print(p); > > protected servlet's doGet: > > PrintWriter out = res.getWriter(); > out.println("testing protected servlet"); > out.print("user is "); > Principal p = req.getUserPrincipal(); > out.print(p); > > Here's my web.xml file: > > > 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > > > testing > Test Unsecured Pages App > > protected > com.paraware.test.TestServlet > > > unprotected > com.paraware.test.TestServlet2 > > > protected > /protected > > > unprotected > /unprotected > > > > Secure > Servlets > Files secured for > testing > /protected > GET > POST > > > Editors > editor > > > > BASIC > > > Page Editors > editor > > > > > > And from the server.xml: > > port="8080" minProcessors="5" maxProcessors="75" > enableLookups="true" redirectPort="8443" > acceptCount="100" debug="4" connectionTimeout="20000" > useURIValidationHack="false" disableUploadTimeout="true" /> > > > port="8009" minProcessors="5" maxProcessors="75" > enableLookups="true" redirectPort="8443" > acceptCount="10" debug="0" connectionTimeout="0" > useURIValidationHack="false" > protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/> > > className="org.apache.catalina.connector.http.HttpConnector" > port="8083" minProcessors="5" maxProcessors="75" > enableLookups="true" redirectPort="8443" > acceptCount="10" debug="0" /> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org