Let me preface this by saying I'm an engineer at a big company and am NOT a programmer so I'm sorry if I'm way off. This question has really been tough to google the answer which generally means I'm asking the question terribly. So I'll try to respond to users to work towards a solution if you'll let me.
I've also tagged multiple languages because I'm not sure if this is a javascript solution or a python solution. I apologize.
Basically, when a user fills in a form it runs a python cgi script that stores the information to a database. I want to automate the writing of the username so the user doesn't have to fill it in manually(not for security, just for ease of use)
My program is on an apache RedHat server and in /etc/httpd/conf I have put the following in my httpd.conf file:
<Directory /var/www/html/program>
##### LDAP Login #######################
AuthType Basic
AuthName "ProbeEng Webserver: Enter Your BIGCOMPANY Username and Password"
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPURL "ldap://ldap.city.bigcompany.com/ou=mtworkers,o=bigcompany.com?uid"
##### Require Authentication
Require valid-user
Order deny,allow
Allow from all
</Directory>
When users access my program they are required to put in their BIGCOMPANY username and password. How can I send that username through to my python cgi-script. The program they start the form on is also a python cgi-script that generates the html.
I tried the following:
try:
username = getpass.getuser()
But that doesn't seem to work.
Is this possible while using a cgi-script, if so how do I access the user's username?
Thanks