Solved

How to get REMOTE_USER Environment Variable

Posted on 1998-12-07
7
750 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

706 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now