The way in which I understand the pod and the code, is that you don't have to do anything to get the requires as a list/array : they just come that way. The first element of the array seems to be the "keyword" (like "user" in "Require user xxx yyy" etc.), and the following list elements are then "xxx", "yyy", etc).

On 22.12.2015 19:55, Sergei Gerasenko wrote:
The only thing I don't get how to do is to make apache collect all of the 
requires into an
array and pass it to the authz handler. The way it works right now is that the 
authz
handler is ran for every require.

You will notice that Apache2_4/AuthCookie.pm expects the 3rd param to be an 
array, which
is puzzling. Maybe the module does some magic on aggregating the requires into 
an array.
Haven't looked at that yet.

On Tue, Dec 22, 2015 at 11:06 AM, A. Warnier <a...@ice-sa.com 
<mailto:a...@ice-sa.com>> wrote:

    Hi Sergei.
    My turn to thank you for providing the information below (and also to 
Michael Schout
    of course). That will also be invaluable to me, when I get around to update 
my own
    mod_perl AAA modules.

    On 22.12.2015 17:57, Sergei Gerasenko wrote:

        Yep, I can see what I should do now. For the benefit of others here are 
the
        differences:

        OLD STYLE
        =========

        <Location blah>
              PerlAuthzHandler YOUR_MODULE->YOUR_METHOD
              require user fred
              require group fred
        </Location>```


        Then in your YOUR_METHOD you would do something like:

        my $requires = $r->requires
        process your requires ..


        ​NEW STYLE:
        ​==========​

        PerlAddAuthzProvider user YOUR_MODULE->YOUR_USER_AUTHZ_METHOD
        PerlAddAuthzProvider group YOUR_MODULE->YOUR_GROUP_AUTHZ_METHOD

        <Location blah>
             require user fred
             required group fred
        </Location>```


        And in your YOUR_MODULE:

        sub YOUR_USER_AUTHZ_METHOD {
             my ($self, $r, @requires) = @_;
        }

        sub YOUR_GROUP_AUTHZ_METHOD {
             my ($self, $r, @requires) = @_;
        }

        Thanks, André for helping me finally solve this problem. From your link 
on
        Apache-AuthCookie, I also found this:
        ​ ​
        
http://search.cpan.org/~mschout/Apache-AuthCookie-3.23/README.apache-2.4.pod and
        in there
        I read under APACHE 2.4 PORTING NOTES.


        ​Thanks again,​
        ​   ​
        Sergei

        On Tue, Dec 22, 2015 at 2:19 AM, André Warnier <a...@ice-sa.com
        <mailto:a...@ice-sa.com> <mailto:a...@ice-sa.com 
<mailto:a...@ice-sa.com>>> wrote:

             Hi.

             I don't have anything very precise to tell you, but here is what I 
know :
             The AAA part has been significantly changed in Apache httpd 2.4, 
as compared
        to 2.2.
             Therefore I suspect - but I am not sure - that some corresponding 
changes had
        to be
             made in mod_perl, to adapt to these changes.
             One of the changes that I see when looking at the Apache 2.4 vs 
2.2 on-line
             documentation (for Apache, not for mod_perl), concerns the syntax 
- and who
        handles -
             the "Require" directives.

             I also believe that the on-line mod_perl documentation does not 
yet reflect these
             changes, and it seems a bit hard to find an up-to-date 
documentation yet.

             But anyway, I just found this on CPAN :
        
https://metacpan.org/source/MSCHOUT/Apache-AuthCookie-3.23/lib/Apache2_4/AuthCookie.pm

             That - along with the module name - seems to show a way to obtain 
the
        "Require" that
             you need.  Why don't you give it a try ?

             Another way that I can think of, would be to use the 
Apache2::Directive module
             (http://perl.apache.org/docs/2.0/api/Apache2/Directive.html), to 
obtain the
        Require
             via the server's configuration tree.
             That should be independent of the specific Apache version being 
used.


             On 20.12.2015 03 <tel:20.12.2015%2003> <tel:20.12.2015%2003>:35, 
Sergei
        Gerasenko wrote:

                 Hello,

                 I’m using mod_perl-2.0.8-10 and I’ve been googling for days 
for this info
        w/o any
                 luck.

                 I need to access the value for the Require directive in the 
apache
        configs. I need
                 to access that info in my authorization handler 
(PerlAuthzHandler). It
        used to be
                 that $r->requires provided that information, but it’s gone now 
according
        to the
                 changelog. It has been replaced with register_auth_provider 
and according
        to this:

                 perl -MModPerl::MethodLookup -e print_method 
register_auth_provider
                 To use method 'register_auth_provider' add:
                           use Apache2::RequestUtil ();

                 … it should be in Apache2::RequestUtil. But I can’t find 
anything about that
                 method in the description of Apache2::RequestUtil. Further, I 
get “undefined
                 method” when I try to even mention it in my handler.

                 I must be missing something really simple? Can somebody point 
me to a
        full example
                 of using that method?

                 Thanks!

                 Sergei






Reply via email to