You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Alexander <mo...@humak.edu> on 2003/03/03 08:59:08 UTC

Override Authentication for one sub directory

Hi,

I'm using Apache-AuthCookie-3.04 for authentication
I have a protected directory with 10 sub directories, one directory needs
to be open to any user.

I could write 10 <Directory /usr/local/systems/work/directory_1> or use a
<PERL> section in the conf file to create the 10 directory directives.

Can I override the settings for one directory somehow? So any user with no
login or password will get in. Actually I don't even want the login prompt
to appear.

In my httpd.conf file I have

<Directory /usr/local/systems/work/>
        PerlSendHeader On
        SetHandler perl-script
        PerlHandler Apache::Registry
        Options +ExecCGI

        AuthType Apache::Authenticate
        AuthName protected
        PerlAuthenHandler Apache::Authenticate->authenticate
        require valid-user

</Directory>


<Directory /usr/local/systems/work/open/>
        # in this directory I need to allow any user
</Directory>

Thanks

Scott


Re: Override Authentication for one sub directory

Posted by Jean-Michel Hiver <jh...@mkdoc.com>.
This might be a bit OT, but since I've read somewhere on apache.org that
Apache2 was using the same regex engine as Perl 5's...

So I'm under the impression that with Apache2 you could do something
like:

<DirectoryMatch "^/usr/local/systems/works/(?!open/)">
   # your auth handler goes here
</DirectoryMatch>

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver@mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/

Re: Override Authentication for one sub directory

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Scott Alexander wrote:
> Hi,
> 
> I'm using Apache-AuthCookie-3.04 for authentication
> I have a protected directory with 10 sub directories, one directory needs
> to be open to any user.
> 
> I could write 10 <Directory /usr/local/systems/work/directory_1> or use a
> <PERL> section in the conf file to create the 10 directory directives.
> 
> Can I override the settings for one directory somehow? So any user with no
> login or password will get in. Actually I don't even want the login prompt
> to appear.

we talk about this in the cookbook - recipe 13.5.

basically, you need to disable authentication for the directories in 
question.  see

http://www.modperlcookbook.org/code/ch13/Cookbook/PassLocalIP.pm

for the example from the book, which disables auth phases for allowed IPs.

also keep in mind the Satisfy Any directive, which is what you probably 
should use if you're thinking about IP based stuff :)

HTH

--Geoff