$r->auth_name($realm), $r->auth_type($basic) did not work for me, which is why I used the $r->header_out method. Also, after I set the outgoing header and returned AUTH_REQUIRED, I got prompted but the $realm did not show. Instead it displayed 'unknown' as the realm name. But when I set the $r->status and sent out the response via $r->send_http_header and returned AUTH_REQUIRED, the $realm name showed?

I read the docs as i started this exercise and was aware of $r->auth_name, $r->auth_type, but since they did'nt work and I kept getting segfaults when using them I decided to try other routes. But anyways I'm glad that I read the docs right and that you can indeed set the AuthName using $r->auth_name.

As for the authenticate subroutine, I just copied that from the eagle book, just as a demonstration...

I'll upgrade my mod_perl from 1.2.1 -> latest and see if these work for me.

Thanks for the helpful insights and explanations Doug....I have seen the light ;)

-Carlos
 
 
 
 

Doug MacEachern wrote:

On Wed, 27 Sep 2000, Carlos Ramirez wrote:

>     my $authheader = 'Basic realm="'.$realm.'"';
>
>     $r->header_out("WWW-Authenticate" ,$authheader);

there's a cleaner way for that:
$r->auth_name($realm);
$r->note_basic_auth_failure;

>     $r->status(AUTH_REQUIRED);

no need for that.

>     $r->send_http_header("text/html");

or this because..

>     return AUTH_REQUIRED;

..apache will send the headers when you return an error

>     return OK if $r->sub_request;

there's no Apache::sub_request method

>     my ($res,$password) = $r->get_basic_auth_pw;

this will core dump if AuthName is not set in the configuration file.
not with the current cvs though, see previous message.

>            $r->note_basic_auth_failure;

this won't work right unless you've set $r->auth_name($val)

-- 
-----------------------------------------------------------------------
Carlos Ramirez + Boeing + Reusable Space Systems + 714.372.4181
-----------------------------------------------------------------------
- Someday I'll find that peer and reset his connection!
 


Reply via email to