Getting User Name With Apache Basic Authentication 
Author Message
 Getting User Name With Apache Basic Authentication

I would like to set up password protected directories for my Web site (Apache) using the htpasswd/.htaccess.  This means that whenever a user requests a page in the protected directory, they get prompted for a userid/password.  I would like to capture the userid that the user enters from within my python CGI script.  This seems like it would be a common thing to do, but I can't find anything in the Python library or this newsgroup that addresses it.  Anyone have any suggestions?

Kurt Jansen

___________________________________________________
GO.com Mail                                    
Get Your Free, Private E-mail at http://www.*-*-*.com/



Tue, 10 Feb 2004 07:52:43 GMT  
 Getting User Name With Apache Basic Authentication

Quote:

> I would like to set up password protected directories for my Web site
> (Apache) using the htpasswd/.htaccess.  This means that whenever a user
> requests a page in the protected directory, they get prompted for a
> userid/password.  I would like to capture the userid that the user enters
> from within my Python CGI script.  This seems like it would be a common
> thing to do, but I can't find anything in the Python library or this
> newsgroup that addresses it.  Anyone have any suggestions?

   It has nothing with Python library. User name is available to a CGI
program in OS environment. Just read CGI specification and figure it out.
The variable name is REMOTE_USER. I hope you can read env vars in Python.

Oleg.
----

           Programmers don't die, they just GOSUB without RETURN.



Tue, 10 Feb 2004 16:02:22 GMT  
 Getting User Name With Apache Basic Authentication
Thanks Oleg,

I had to password protect my cgi-bin directory also with .htaccess, and then this environment variable worked.  I accessed it with the os.environ['REMOTE_USER'] function.
Kurt

Quote:
-----Original Message-----



Date: Fri Aug 24 01:02:22 PDT 2001
Subject: Re: Getting User Name With Apache Basic Authentication


>> I would like to set up password protected directories for my Web site
>> (Apache) using the htpasswd/.htaccess.  This means that whenever a user
>> requests a page in the protected directory, they get prompted for a
>> userid/password.  I would like to capture the userid that the user enters
>> from within my Python CGI script.  This seems like it would be a common
>> thing to do, but I can't find anything in the Python library or this
>> newsgroup that addresses it.  Anyone have any suggestions?

>   It has nothing with Python library. User name is available to a CGI
>program in OS environment. Just read CGI specification and figure it out.
>The variable name is REMOTE_USER. I hope you can read env vars in Python.

>Oleg.
>----

>           Programmers don't die, they just GOSUB without RETURN.

___________________________________________________
GO.com Mail                                    
Get Your Free, Private E-mail at http://mail.go.com



Wed, 11 Feb 2004 06:30:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Basic Authentication on non-Apache servers?

2. Bobo, Apache and user authentication...

3. Urgent: User authentication problems using ODBC thru Mod_python/Apache

4. basic user authentication

5. Getting user-variable/equate name at runtime

6. Getting currently logged in user name in VisualWorks

7. Getting the User Name From Windows 95

8. "Getting the NetWare User Name"

9. Getting User Name from Novell and NT Wkstns

10. Getting user names

11. Digest Authentication to Apache

12. Bobo and Apache -- authentication

 

 
Powered by phpBB® Forum Software