Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

getRemoteUser()

Johnson, David

2003-08-12

Replies:

I'm having some difficulty making the getRemoteUser() method work. It's
possible I have missed the point of this method, but I'll explain what
I'm trying to do anyway.

I'm using mod_jk to map the url /lemons to a servlet which is running on
Tomcat 1.4.27. I've got mod_jk set up okay and the mapping works fine:

JkMount /lemons ajp13

I have then set up a Limit directive in my apache configuration for the
url, thus:

<Location /lemons>
<Limit GET PUT POST>
  require user dave
</Limit>
</Location>

This works as expected. If I go to this url I am prompted for a username
and password. If I enter dave and the correct password then the request
is passed through to my servlet. If I enter an incorrect username and
password I get our server's authentication/authorization failed page and
it doesn't get anywhere near the servlet.

Within my servlet I then want to use getRemoteUser() method of the
HttpServletRequest object to obtain the username which was supplied.
Whenever I try this though, it always returns null. The request does
contain an authorization header, but I can't seem to get a username out
of it.

Any ideas please? (If I need to RTFM, please point me in the right
direction.)

Thanks, Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.