Re: setting user and logging
[prev]
[thread]
[next]
[Date index for 2005/02/18]
On Feb 18, 2005, at 9:16 AM, Geoffrey Young wrote:
>
>
> Sean Davis wrote:
>> I am using mod_perl 1.29 and apache 1.33 on macos. I have a content
>> handler that does its own authen and authz. I would like to log the
>> username. When I set the user using $r->user($username) in the
>> content
>> handler, I don't see the username in my log. I thought log handlers
>> came after content, so why can't I see the username? (I am doing
>> custom
>> logging into a database and get the username if I use basic auth in
>> other scripts).
>
> hmm, I'm confused here...
>
> if you use any form of basic auth (such as calling
> $r->get_basic_auth_wd)
> then $r->user should be set to whatever it is the user provided via the
> Authorization header.
>
> if you are using some kind of custom auth that isn't Basic auth then
> your
> PerlAuthenHandler is required to set $r->user (and
> $r->connection->auth_type) from the auth phase. see recipe 13.7 for an
> example of what I mean
>
> http://www.modperlcookbook.org/chapters/ch13.pdf
>
> so, then... why are you setting $r->user from the content handler and
> why do
> you want it to be different than the user you authenticated?
>
Sorry. I wasn't very clear. In the handler (converted from an old CGI
script), I do all of the authentication IN THE CONTENT HANDLER. In the
handler, I was trying to set the user, but wasn't seeing it. It turns
out I was not setting it correctly--when I do
$r->connection->user($user), it works as expected....
Thanks,
Sean