You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Johnson, David" <d....@Cranfield.ac.uk> on 2003/08/12 16:22:32 UTC

getRemoteUser()

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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: getRemoteUser()

Posted by Rick Roberts <te...@ait-web.com>.
Have you set up your Tomcat container managed security?

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html

-- 
*******************************************
* Rick Roberts                            *
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com                  *
*******************************************

Johnson, David wrote:
> 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@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


Re: getRemoteUser()

Posted by Rick Roberts <te...@ait-web.com>.
Have you set up your Tomcat container managed security?

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html

-- 
*******************************************
* Rick Roberts                            *
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com                  *
*******************************************

Johnson, David wrote:
> 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@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>