Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do you retrieve the signed on user ID in a web CGI program?

50 views
Skip to first unread message

a4ginatl

unread,
Dec 1, 2009, 6:49:35 PM12/1/09
to dfre...@assignment400.com
I have CGI programs that are working normally. I have 1 program where
I need to retrieve the user ID of the signed on user so that I can
retrieve records for this user.

At this point the system is returning the user ID QTMHHTTP which is
the user ID that the apache server jobs run under.

I tried to retrieve the REMOTE_USER environment variable, but it is
returned as blanks.

I have configured apache to validate user ID when signing on and this
is working.

How do you retrieve the user profile used to sign on to the browser
session?

Thanks

Darryl.

Dr.Ugo Gagliardelli

unread,
Dec 2, 2009, 10:11:27 AM12/2/09
to
il 02.12.2009 0.49, Scrive a4ginatl 43514776:
What stated above is correct, is the cgi program itself inside the same
apache configuration structure protected with the same validation rule?
In other words, if you try the complete url of the cgi program, does
apache ask the browser to prompt for user/password?

eb

unread,
Dec 2, 2009, 2:42:19 PM12/2/09
to
I have found 2 ways either one will work. But neither maybe the
correct answer.

1st Option:
Require SSL port 443 connections. Then REMOTE_USER will get populated.

2nd Option:
Specify UserId %%CLIENT%% in your directory path to your program
library.
Each user will spawn their own Apache instance, but REMOTE_USER will
get populated.

<Directory /QSYS.LIB/INTRANET.LIB/>
AuthName Intranet-Security
AuthType Basic
Require valid-user
PasswdFile %%SYSTEM%%
UserId %%CLIENT%%
</Directory>

a4ginatl

unread,
Dec 3, 2009, 6:47:59 PM12/3/09
to
On Dec 2, 10:11 am, "Dr.Ugo Gagliardelli"

Yes the browser does prompt for the user ID and password.

a4ginatl

unread,
Dec 3, 2009, 6:51:12 PM12/3/09
to
> > Darryl.- Hide quoted text -
>
> - Show quoted text -

Thank you, I was missing the "require valid-user". It got dropped
somehow.

When I added it back, the Current User in the rtvjoba was corrected
populated with the user id in the browser.

Thanks

Dr.Ugo Gagliardelli

unread,
Dec 4, 2009, 7:59:37 AM12/4/09
to
il 04.12.2009 0.47, Scrive a4ginatl 41471840:
So the cgi program should be able to retrieve what the user typed into
the login prompt via getenv("REMOTE_USER");
If apache access-log is active, you should also see the user name inside
the log file.
0 new messages