getRemoteUser() and getAuthType()

I am trying to get the remote user name using getRemoteUser() method in the HttpServletRequest Interface. My problem is that it is returning null. I called getAuthType() and it returned "Basic".

I thought it was suppose to work if getAuthType() didn't return null.

How can I get the remote user?

-S-

[332 byte] By [slenzia] at [2007-9-19]
# 1
bump
slenzia at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
one more time
slenzia at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hello,

I too am trying to getRemoteUser() for an Intranet JSP application. I am using Tomcat 3.3 on IIS4. Now in theory it should be possible for the application to use NT logins to determine who the user is and set their pages accordingly. However at present I can't get Tomcat to 'speak' with NT/IIS4.

I have managed to obtain information about the Authorisation header [ System.out.println("Authorisation: " + req.getHeader("Authorization")); ]as a result of altering the web.xml file in the application's web-inf sub-directory but haven't got any further.

The authorisation Type is Negotiate but getRemoteUser is null. I think the problem could well be in the set up for Tomcat and IIS rather than any code, however this is for my particular problem. The reason why I think this is because the pages ran fine on Tomcat 3.2.1 before I did the upgrade last week :?

Daniel.

DanielKSmitha at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi,

In my previous reply i mentioned that I have Tomcat sitting on IIS. On the website I am working on we wanted to use NT Authentication to determine who the users are. (It is an Intranet site so security can be low).

At first I was able to see the results of getAuthType() and getHeader("Authorization") but getRemoteUser() still returned null. However setting tomcatAuthentication to false on the Ajp agents meant getRemoteUser() then started to get results.

<Ajp12Connector port="8007" tomcatAuthentication="false"/>

In my case the web server (IIS) authenticates a user, and then Tomcat authenticates a user, by setting tomcatAuthentication to false this meant that Tomcat accepts IIS/NT authentication of a user.

Hope this information helps, I have written a servlet which may be of use to you. Let me know

Dan.

DanielKSmitha at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5

I was looking on the web this morning and I stumbled accross the following.

<ajp13Connection port="xyz" tomcatAuthentication="false" />

just like you have!

This must be it. I have not tried it yet but hopefully it will work. If you stared to get results from getRemoteUser(), I bet I will. If I'm still having problems I'll post again.

thanks.

Seth

slenzia at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6
that was it. it works.thanks.-S-
slenzia at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hi Seth,

Pleased it worked for you. I don't think it is a perfect fix as it means that every webapp you create will use IIS authentication, if that is the host server behind Tomcat. There could be another way but I've not got round to finding it out. Maybe creating a apps-nameOfProject.xml in the conf directory.

Dan.

DanielKSmitha at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 8

Hi all!

This is my first time here and I don't know where I can post my doubt, so I will use this.

My problem is related do getReMoteUser method. I would like to know how I can show the NT authentication in a page? I tried to use <%= request.getRemoteUser() %>, but returned null. I installed TOMCAT 4.1 in my machine and I am using NT workstation.

Thanks in advance.

jmartins69a at 2007-7-8 > top of java,Enterprise & Remote Computing,Web Tier APIs...