tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnson, David" <d.john...@Cranfield.ac.uk>
Subject getRemoteUser()
Date Tue, 12 Aug 2003 14:22:32 GMT
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

Mime
View raw message