[mod_python] how to set req.user?

Bud P. Bruegger bud at comune.grosseto.it
Thu Apr 21 12:45:12 EDT 2005


I would like to write a simple handler that sets the REMOTE_USER 
cgi-variable.  The incentive of this is that no matter how the user 
authenticates (with HTTP BASIC or with SSL client-cert-auth and 
+fakeBasicAuth), I would like to present the same person ID to the (cgi) 
application.  In particular, I would like to set REMOTE_USER to the 
national unique person identifier (similar to a U.S. social security 
number).  For example, the handler should take the HTTP BASIC user name or 
Distinguished Name returned by mod_ssl, use it to look up the national 
person ID, and then assign it to REMOTE_USER.

My problem is that the Request Member "user" documented to be 
read-only.  Does this mean that I have to intervene some time after the 
authentication phase and before the request is passed off to the cgi 
application?  Should I maybe act on req.subprocess_env in the Fixup handler?
Maybe it is relevant that in a simple test with Apache 1.3, a SetEnv 
REMOTE_USER <someLiteral> worked and was visible from the CGI App.

Many thanks in advance for any help

Ing. Bud P. Bruegger, Ph.D.                 +39-0564-488577 
(voice),  -21139 (fax)
Servizio Elaborazione Dati                    e-mail:  bud at comune.grosseto.it
Comune di 
Grosseto                            http://www.comune.grosseto.it/cie/
Via Ginori, 
43                                      http://OpenPortalGuard.sf.net
58100 Grosseto (Tuscany, Italy)           jabber:  bud at amessage.info

Free Software in Public Administration:  not just a good idea, but a necessity

Perfection is attained, not when there is nothing more to be added, but 
when there is nothing more to be taken away -- Antoine de Saint-Exupery  

More information about the Mod_python mailing list