You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sandeep Shenvi <Sa...@lntinfotech.com> on 2009/10/15 06:05:52 UTC

struts 1.2 - HttpServletRequest.getRemoteUser() returns NULL

Hi,

We are developing a web application with Single Sign On (SSO) feature using
struts 1.2 and are using tomcat 6.0 container for deployment. We want to
achieve a scenario similar to Windows Authentication.
For this we want to know the user (user name who has logged in to the
Windows OS)  who has hit the website URL.

I tried to use APIs of HttpServletRequest class.  It gives me client IP
address, but when I try something like httpServletRequest.getRemoteUser()
it returns null (Struts documentation says that getRemoteUser() will return
username only if the user is already authenticated).

Does the HttpServletRequest object contain this information? Is there any
other way to get the user name?

Thanks in advance...


______________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts 1.2 - HttpServletRequest.getRemoteUser() returns NULL

Posted by Jari Fredriksson <ja...@iki.fi>.

15.10.2009 7:05, Sandeep Shenvi kirjoitti:
>
> Hi,
>
> We are developing a web application with Single Sign On (SSO) feature using
> struts 1.2 and are using tomcat 6.0 container for deployment. We want to
> achieve a scenario similar to Windows Authentication.
> For this we want to know the user (user name who has logged in to the
> Windows OS)  who has hit the website URL.
>
> I tried to use APIs of HttpServletRequest class.  It gives me client IP
> address, but when I try something like httpServletRequest.getRemoteUser()
> it returns null (Struts documentation says that getRemoteUser() will return
> username only if the user is already authenticated).
>
> Does the HttpServletRequest object contain this information? Is there any
> other way to get the user name?
>
> Thanks in advance...
>

HttpServletRequest.getRemoteUser() returns the username ONLY after the
user has authenticated to the Application Server. It has no knowledge of
the Windows (or any operating system) user or session.

Googling "tomcat windows auth" gives many results. The first one is

http://www.velocityreviews.com/forums/t146038-windows-authentication-in-tomcat.html

Have a look, and try Google. You are not alone in this..

--
http://www.iki.fi/jarif/

You will be surprised by a loud noise.