Re: $r->requires and register_auth_provider

Sergei Gerasenko <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CADM1pVxTfuNq7CQFqQDgzG-CbfcBZgHf78FCUj=_mJ14XvBZHQ@mail.gmail.com>
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 <[email protected]> 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: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
>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.