You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gareth Kirwan <gb...@thermeoneurope.com> on 2003/01/07 10:30:32 UTC

Apache::AuthCookie and what's required

Gareth StationeryMorning all,

Diving straight in... This is my first time using Apache::AuthCookie for
Authorization and Authentication ... but when I've been pencilling my plan
out I'm already afraid
I might need to go a different route - so I thought I'd post here and see
what kind of response I got.

My problem is that I can't find enough documentation on how to use the
further require statements.
The user's group is defined in a database, and so is the access level of the
page requested.
Hence I'm thinking that I'll need something using the model of require
species hamster ( from Apache::AuthCookie documentation )
However I can't find out the significance of the word species ...

hamster is the subroutine in the subclass that will be called and sent $r
and $args, but where does the notion of species come from ?

Hope this question is too bad :D

Cheers

Gareth Kirwan
Programming & Development,
Thermeon Europe Ltd,
gbjk@thermeoneurope.com
Tel: +44 (0) 1293 864 303
Thermeon Europe e-Card: gbjk

Re: Apache::AuthCookie and what's required

Posted by do...@zsi.at.
Hi!

On Tue, Jan 07, 2003 at 11:20:25AM +0100, domm@zsi.at wrote:

> From perldoc Apache::AuthCookie:
> 
> o authorize()
>     This will step through the "require" directives you've
>     given for protected documents and make sure the user
>     passes muster.  The "require valid-user" and "require
>     user joey-jojo" directives are handled for you.  You
>     can implement custom directives, such as "require
>     species hamster", by defining a method called
>     "species()" in your subclass, which will then be
>     called.  The method will be called as "$r->species($r,
>     $args)", where "$args" is everything on your "require"
>     line after the word "hamster".  The method
>     should return OK on success and FORBIDDEN on failure.

After reading this again, I wonder if there is an error in the doc.

Shouldn't this
     $args)", where "$args" is everything on your "require"
     line after the word "hamster".  The method
                          ^^^^^^^^^
be
     $args)", where "$args" is everything on your "require"
     line after the word "species".  The method
                         ^^^^^^^^^
?



-- 
#!/usr/bin/perl                               http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

RE: Apache::AuthCookie and what's required

Posted by Gareth Kirwan <gb...@thermeoneurope.com>.
Now THAT makes perfect sense to me!

However that's not what you'll find here:
http://www.perldoc.com/cpan/Apache/AuthCookie.html

This will step through the require directives you've given for protected
documents and make sure the user passes muster. The require valid-user and
require user joey-jojo directives are handled for you. You can implement
custom directives, such as require species hamster, by defining a method
called hamster() in your subclass, which will then be called. The method
will be called as $r->hamster($r, $args), where $args is everything on your
require line after the word hamster. The method should return OK on success
and FORBIDDEN on failure.

Here you'll say that it'll call the method hamster!

What do you think of that ? Typo ?

> it's the other way round:
>
> if you say in httpd.conf
>   require species hamster
>
> Apache::AuthCookie will call
>  species() in your subclass and passing "haster" in $args
>
> >From perldoc Apache::AuthCookie:
>
> o authorize()
>     This will step through the "require" directives you've
>     given for protected documents and make sure the user
>     passes muster.  The "require valid-user" and "require
>     user joey-jojo" directives are handled for you.  You
>     can implement custom directives, such as "require
>     species hamster", by defining a method called
>     "species()" in your subclass, which will then be
>     called.  The method will be called as "$r->species($r,
>     $args)", where "$args" is everything on your "require"
>     line after the word "hamster".  The method
>     should return OK on success and FORBIDDEN on failure.
>
> --
> #!/usr/bin/perl                               http://domm.zsi.at
> for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
>



Re: Apache::AuthCookie and what's required

Posted by do...@zsi.at.
Hi!

On Tue, Jan 07, 2003 at 09:30:32AM -0000, Gareth Kirwan wrote:

> Hence I'm thinking that I'll need something using the model of require
> species hamster ( from Apache::AuthCookie documentation )
> However I can't find out the significance of the word species ...
> 
> hamster is the subroutine in the subclass that will be called and sent $r
> and $args, but where does the notion of species come from ?

it's the other way round:

if you say in httpd.conf
  require species hamster
  
Apache::AuthCookie will call
 species() in your subclass and passing "haster" in $args

>From perldoc Apache::AuthCookie:

o authorize()
    This will step through the "require" directives you've
    given for protected documents and make sure the user
    passes muster.  The "require valid-user" and "require
    user joey-jojo" directives are handled for you.  You
    can implement custom directives, such as "require
    species hamster", by defining a method called
    "species()" in your subclass, which will then be
    called.  The method will be called as "$r->species($r,
    $args)", where "$args" is everything on your "require"
    line after the word "hamster".  The method
    should return OK on success and FORBIDDEN on failure.

-- 
#!/usr/bin/perl                               http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}