Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 71627 invoked from network); 13 Mar 2006 03:33:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Mar 2006 03:33:23 -0000 Received: (qmail 3095 invoked by uid 500); 13 Mar 2006 03:33:18 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 3074 invoked by uid 500); 13 Mar 2006 03:33:18 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 3063 invoked by uid 99); 13 Mar 2006 03:33:18 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Mar 2006 19:33:18 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [210.193.32.133] (HELO 2perfection.com) (210.193.32.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Mar 2006 19:33:16 -0800 Received: (qmail 6385 invoked from network); 13 Mar 2006 03:32:09 -0000 Received: from 63.210-193-15.adsl.qala.com.sg (HELO ?192.168.1.200?) (jhfoo-ml@extracktor.com@210.193.15.63) by www.nexlabs.com with SMTP; 13 Mar 2006 03:32:09 -0000 Message-ID: <4414E7EC.10807@extracktor.com> Date: Mon, 13 Mar 2006 11:33:00 +0800 From: Foo Ji-Haw User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Fred Moyer CC: Fred Moyer , yperl , Frank Wiles , modperl@perl.apache.org Subject: Re: Modperl2 + PerlAccessHandler + Sending Cookie References: <44122AFC.3000704@club-internet.fr> <20060310200644.5873ea9f.frank@wiles.org> <44128F95.5000603@club-internet.fr> <44129C62.7080400@taperfriendlymusic.org> <4414D684.4060508@extracktor.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello Fred, Ok, the 12 layers of Apache is as cool as the OSI layers. Let's say that in my PerlAuthzHandler I verified the user via a cookie (given to the client during login). It sounds like double work to retrieve the user details again during the PerlResponseHandler phase (I have to do that to process the page based on the user). Following the mailing list thread, is the only/ preferred way to use the bucket brigade? Fred Moyer wrote: > On Mon, 13 Mar 2006, Foo Ji-Haw wrote: >> Wow, a little tangent to the topic here: I didn't know that you can >> do this >> PerlResponseHandler Apache2::Const::OK >> Is that 'legal'? It's interesting to know, but I wouldn't know of a >> practical use for this trick. > > Specifying a return code for a handler phase is perfectly legal. I > first saw this technique used in 'PerlMapToStorageHandler > Apache2::Const::OK' to skip the request phase which maps the uri to a > location on disk, but you can use it with any phase. > >> Last question: is it a best practice to do the user and access >> authentication check at the PerlAccessHandler level? I like the idea >> (obviously I've not been trying this way). A single authentication >> module that can be used across various PerlResponseHandler. Easy to >> maintain and propogate. > > The PerlAccessHandler phase runs in the same phase of the request > cycle as Apache's mod_access module, and is meant to handle the > request based on IP and domain information. In httpd.conf, you can > say 'Order Allow, Deny', > 'Deny from 123.456.789.012', or you can use the PerlAccessHandler > phase and > examine the request IP and accomplish the same functionality ( see > http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAccessHandler). > It is best practice to do access checks. > > Best practice for user authentication is to use PerlAuthenHandler, and > best practice for user authorization is the PerlAuthzHandler. This > way, you can modify the request, and return DECLINED, and Apaches > authen and authz modules can do additional checks on those phases of > the request. Or you can do authen/authz only in the mod_perl phases > and return OK or UNAUTHORIZED and skip Apache's auth/authz modules. > > Each phase in this diagram - > http://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases > > - has a corresponding hook in Apache which runs after mod_perl if > DECLINED is returned. This is one of mod_perl's greatest strengths.