what handler phase as we in?

what handler phase as we in?

am 07.04.2008 22:26:26 von Anthony R Fletcher

I have a module that does authentication and authorisation. In my Apache
configs I have:

PerlAuthenHandler Apache2::AuthX::authenticate
PerlAuthzHandler Apache2::AuthX::authorise

I'd rather just use:

PerlAuthenHandler Apache2::AuthX
PerlAuthzHandler Apache2::AuthX

and let the handler function Apache2::AuthX::handler() deduce what has
to be done (i.e. authenticate or authorise).

How can handlers tell which phase they are currently in?

Anthony.

Re: what handler phase as we in?

am 07.04.2008 22:39:02 von gozer

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigEBA80EB8BF71FC3AD7F1F75C
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Anthony R Fletcher wrote:
> I have a module that does authentication and authorisation. In my Apach=
e
> configs I have:
>=20
> PerlAuthenHandler Apache2::AuthX::authenticate
> PerlAuthzHandler Apache2::AuthX::authorise
>=20
> I'd rather just use:
>=20
> PerlAuthenHandler Apache2::AuthX
> PerlAuthzHandler Apache2::AuthX
>=20
> and let the handler function Apache2::AuthX::handler() deduce what has
> to be done (i.e. authenticate or authorise).

You do end up paying a small overhead in forcing that determination at
run time in your code, but I agree it's somewhat neater.

> How can handlers tell which phase they are currently in?

ModPerl::Util::current_callback()

http://perl.apache.org/docs/2.0/api/ModPerl/Util.html#C_curr ent_callback_=


--=20
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/


--------------enigEBA80EB8BF71FC3AD7F1F75C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+oZmyzKhB4jDpaURAoMIAJ4xX0hIu/OaoQQ0rAM4wk5YClgrLQCf c0zZ
UxX2/gbpaLBicaSoRjCpCNQ=
=UV99
-----END PGP SIGNATURE-----

--------------enigEBA80EB8BF71FC3AD7F1F75C--

Re: what handler phase as we in?

am 08.04.2008 00:28:04 von Anthony R Fletcher

Hello Philippe

Perfect - thanks.

Anthony

On 07 Apr 2008 at 16:39:02, Philippe M. Chiasson wrote:
> Anthony R Fletcher wrote:
>> I have a module that does authentication and authorisation. In my Apache
>> configs I have:
>>
>> PerlAuthenHandler Apache2::AuthX::authenticate
>> PerlAuthzHandler Apache2::AuthX::authorise
>>
>> I'd rather just use:
>>
>> PerlAuthenHandler Apache2::AuthX
>> PerlAuthzHandler Apache2::AuthX
>>
>> and let the handler function Apache2::AuthX::handler() deduce what has
>> to be done (i.e. authenticate or authorise).
>
> You do end up paying a small overhead in forcing that determination at
> run time in your code, but I agree it's somewhat neater.
>
>> How can handlers tell which phase they are currently in?
>
> ModPerl::Util::current_callback()
>
> http://perl.apache.org/docs/2.0/api/ModPerl/Util.html#C_curr ent_callback_
>
> --
> Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
> http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/
>



--
Anthony R Fletcher
Room 2033, Building 12A, http://dcb.cit.nih.gov/~arif
National Institutes of Health, arif@mail.nih.gov
12A South Drive, Bethesda, Phone: (+1) 301 402 1741.
MD 20892-5624, USA.