wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to get user ID information - not in the Principal or remote user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get user ID information - not in the Principal or remote user" Watch "How to get user ID information - not in the Principal or remote user" New topic
Author

How to get user ID information - not in the Principal or remote user

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
I need to duplicate/replace a Perl module which is getting the user ID information (I think) from some CGI information which is not available to my servlet via request.getRemoteUser() or request.getPrincipal().getName(). I can look at all of the request paramaeters as well as all request and session attributes and this user ID info is not present. However the Perl module can find it using the following code:

my $r = shift;
my($user_id) = $r->connection->user;

It looks as if there is information available to the Perl module (in the $r->connection object, some CGI variables perhaps ?) which I am yet unable to access from my servlet. Is anyone aware of how I might get this info ?

Thanks in advance for any assistance or insight.


-James
Jason Milliron
Greenhorn

Joined: Jan 25, 2004
Posts: 22
Originally posted by James Adams:
I need to duplicate/replace a Perl module which is getting the user ID information (I think) from some CGI information which is not available to my servlet via request.getRemoteUser() or request.getPrincipal().getName(). I can look at all of the request paramaeters as well as all request and session attributes and this user ID info is not present. However the Perl module can find it using the following code:

my $r = shift;
my($user_id) = $r->connection->user;

It looks as if there is information available to the Perl module (in the $r->connection object, some CGI variables perhaps ?) which I am yet unable to access from my servlet. Is anyone aware of how I might get this info ?

Thanks in advance for any assistance or insight.


-James
Moody Hopkins
Greenhorn

Joined: Nov 24, 2003
Posts: 10
You can get the user information using:
request.getRemoteUser();

look at the javadocs for HttpServletRequest.
There are a lot of methods that might help.

( request.getUserPrincipal() is also available )

Good Luck!
Brahim Bakayoko
Ranch Hand

Joined: Aug 29, 2003
Posts: 155
The first step is really to determine what that user ID represent.

Username? Password? IP? session ID, etc.?

request.getRemoteUser() works only when basic or digest authentication is used.


SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
 
jQuery in Action, 2nd edition
 
subject: How to get user ID information - not in the Principal or remote user
 
Similar Threads
Tomcat + Apache configuration servlet access problem
Losing user ID info between Servlets
using one bean across several forms
Integrating J2ee system to perl/CGI app
New JavaRanch Journal article: Authentication using JAAS