?
Solved

How to get REMOTE_USER Environment Variable

Posted on 1998-12-07
7
Medium Priority
?
891 Views
Last Modified: 2013-11-24
When using Netscape Serever's security,
it pops up a dialog box.  When the person's
login is validated, the login name is stored
it the browser environment variable REMOTE_USER.
This can be grabbed using CGI.  My problem is that
I hava a java applet that needs to know who
the validated user is.  Anybody know how I can
get this variable in Java, or pass it as a
parameter to the applet using javascript or something?
0
Comment
Question by:revferret
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1228877
one way is to write a cgi program/java servlet which you invoke from java applet and that program/servlet returns you the remove user name. This is the only way also to get any client certificates of the browser.

Vijay

0
 
LVL 1

Expert Comment

by:GregL
ID: 1228878
Try HttpServletRequest.getHeader( "REMOTE_USER" );
0
 

Author Comment

by:revferret
ID: 1228879
Sorry, but this didn't work.
Java didn't find the class HpptServletRequest, and I don't seem to have any
class libraries that have this?  Do you know which set of libraries have this?
I have imported all the libraries that came with netscape server.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:conick
ID: 1228880
The HttpServletRequest class is part of the Servlet API (its a separate download)
This involves writing a servlet. (its suprisingly easy)
Make sure your server is capable of running servlets
If you decide to do this you can get the Servlet API from:
http://java.sun.com/products/servlet/index.html


0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1228881
>> ... This can be grabbed using CGI. ...

you sure need some kind of server support ...
 evijay suggests to use a simple CGI, and GregL suggests to use servlets (which is some kinf of Java CGI)... in both cases you need a server program (CGI) that will give your applet the  REMOTE_USER variable (the applet simply sends "Give me the value of REMOTE_USER" and the CGI returns it).

hope this helps
  heyhey

P.S.
i just sow that line
>> it the browser environment variable REMOTE_USER.
if you browser can see this variable (if it is client variable, not server variable) you can use JavaScript and give this value as applet parameter.
0
 
LVL 7

Accepted Solution

by:
yoren earned 200 total points
ID: 1228882
REMOTE_USER is a server environment variable, not a browser variable. This is an important distinction. Keep reading.

It sounds like you have a CGI program which is returning a page containing an applet. If this is the case, your CGI program should dynamically add an applet parameter that contains the value of REMOTE_USER. If your CGI program is written in Perl, it will look something like this:

print "<APPLET...>\n";
print "<PARAM NAME=\"REMOTE_USER\" VALUE=\"$ENV{'REMOTE_USER'}\">\n";
print "</APPLET>\n";

Then use Applet.getParameter() in your applet to retrieve the value.

BUT BE WARNED: Don't use this as your method of security, because it would be very easy for a hacker to crack this security. You should assume that anyone who can run the CGI can pretend to be anyone else who can run the CGI.

Yuval
0
 

Author Comment

by:revferret
ID: 1228883
Thanks for the suggestion, but I figured out how to write a WAI application
and register it as a service with the Web Server.  My applet just calls this
service and then the REMOTE_USER is returned to the applet.

Thanks all for the help!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question