You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rodney Broom <rb...@Desert.NET> on 2001/06/15 20:35:27 UTC

Setting an auth realm dynamically

I (like everybody else) have a site that is wholy dynamically generated. As such, I can't alway set an auth realm in the config or in .htaccess. What I'd like to do is an access handler like this:

sub handler {
    my $r = shift;
    if ($r->uri =~ m/$some_magic_pattern/|) {
        $r->auth_name($custom_realm);
        $r->auth_type('Basic');
        $r->dir_config('require valid-user');

        return 'OK';
    }
    return DECLINED;
}


Obviously these routines don't work this way... Any thoughts?

---
Rodney Broom
Programmer: Desert.Net


Re: Setting an auth realm dynamically

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 15 Jun 2001, Rodney Broom wrote:

> I (like everybody else) have a site that is wholy dynamically
> generated. As such, I can't alway set an auth realm in the config or in
> .htaccess. What I'd like to do is an access handler like this: 
 
> sub handler {
>     my $r = shift;
>     if ($r->uri =~ m/$some_magic_pattern/|) {
>         $r->auth_name($custom_realm);
>         $r->auth_type('Basic');

those two should work.

>         $r->dir_config('require valid-user');

this will not.  $r->requires could be made writable, but i worry about
getting used to that since it will not work with threaded-2.0 without
changes to apache.