On Aug 1, 5:18 am, "Stephen A. Cochran Lists"
<[EMAIL PROTECTED]> wrote:
> On Jul 31, 2007, at 3:00 PM, Noah Kantrowitz wrote:
>
> > The easiest way will be to make a plugin that has a new
> > IAuthenticator. Specifically you want to inherit from
> > trac.web.auth.LoginModule and override _do_login. s/req.remote_user/
> > req.environ['REMOTE_USER_FULLNAME'].
>
> > --Noah
>
> So I tried something similar, I'm simply modifying web/auth.py in
> _do_login. I tried your change:
>
> req.environ['REMOTE_USER_FULLNAME']

Should be:

  req.subprocess_env['REMOTE_USER_FULLNAME']

if it is passed as equivalent of SetEnv directive, or:

  req.notes['REMOTE_USER_FULLNAME']

if other modules is using notes table for request.

> but I'm getting a "'ModPythonRequest' object has no attribute
> 'environ'" error.
>
> I also wasn't sure if req.remote_user was a standard Python thing or
> if that was being set somewhere else like in modpython_frontend.py.

The user as determined by standard authentication modules is stored in
req.user.

Note that the standard way that Apache authentication modules are
supposed to work is that they set req.user to the authenticated user
id. This is also turned into REMOTE_USER variable in
req.subprocess_env when req.add_common_vars() is called. If
add_common_vars() isn't being called by a mod_python handler you will
thus not have access to REMOTE_USER and would have to use req.user.

FWIW, you seem to deliberately doing things to break how Apache
normally works. Why can't your other module simply set req.user in the
correct manner to what you want rather than using the request
environment variables. If the module is a C module it is the 'user'
attribute of request_rec structure. If you need whether this is done
to be selectable then add a directive to enable passing full name in
req.user. Do note though that your full names better be unique
otherwise you might have issues in Trac.

Perhaps provide more explanation of the reasons for wanting to so
this, rather than simply what you want to achieve. It may be the case
that you shouldn't be changing Trac but that the other module should
be changed to do things in a more customisable way inline with how
Apache should be used.

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to