Solved

How to get REMOTE_USER Environment Variable

Posted on 1998-12-07
7
800 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

773 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