Skip Menu |

This queue is for tickets about the Apache-AuthCookie CPAN distribution.

Report information
The Basics
Id: 81474
Status: resolved
Priority: 0/
Queue: Apache-AuthCookie

People
Owner: Nobody in particular
Requestors: kas [...] fi.muni.cz
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 3.18
Fixed in: 3.19



Subject: recognize_user() should retur DECLINED when not recognized
I want to combine Apache2::AuthCookie with optional basic auth for legacy reasons. I wanted to use ->recognize_user() as the first PerlAuthenHandler, and the other auth module as the second PerlAuthenHandler. The problem is that ->recognize_user returns OK even when no user is recognized, so no further handlers of the same type are executed. I have wrapped recognize_user() to my own method recognize_or_decline() in my subclass of Apache2::AuthCookie, which runs recognize_user(), and then returns DECLINED iff recognize_user() returned OK but no $r->user is set. I think modifying the ->recognize_user() method to return DECLINED when no user is recognized would not hurt the intended use in PerlFixupHandler (as described in the POD), and would help in my case. Please consider changing the behaviour of ->recognize_user() to the one I suggest above. Thanks!
Subject: Proposed patch
From: kas [...] fi.muni.cz
Here is the proposed patch implementing the above.
Subject: AuthCookie-recognize-user.patch
Author: Jan "Yenya" Kasprzak <kas@fi.muni.cz> Apache2::AuthCookie::recognize_user() OK/DECLINED recognize_user() should return OK if and only if the user is really recognized. This allows the handlers to be stacked not only as PerlFixupHandlers (as described in the POD), but also as PerlAuthenHandlers and so on. diff --git a/perllib/Apache2/AuthCookie.pm b/perllib/Apache2/AuthCookie.pm index 498a720..378a8af 100644 --- a/perllib/Apache2/AuthCookie.pm +++ b/perllib/Apache2/AuthCookie.pm @@ -63,7 +63,7 @@ sub recognize_user { return $auth_type->custom_errors($r, $user, @args); } - return OK; + return defined $user ? OK : DECLINED; } sub cookie_name {
Fixed in 3.19_01 (developer release), which I have just uploaded to CPAN.
From: kas [...] fi.muni.cz
On Sat Dec 01 22:50:05 2012, MSCHOUT wrote: Show quoted text
> Fixed in 3.19_01 (developer release), which I have just uploaded to CPAN.
Thanks!