Solved

How to get REMOTE_USER Environment Variable

Posted on 1998-12-07
7
816 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
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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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 100 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
arguments to jar 5 33
Why my table column Id is not passed to java object? 4 44
hibernate example issues from command prompt 10 50
Running JavaFX on the Raspberry Pi 27 38
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

840 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