Re: [PATCH] consolidate auth logic into Q::Plugin

[email protected] (Matt Simerson) Tue, 8 May 2012 11:58:13 -0700
Newsgroups perl.qpsmtpd
Message-ID <[email protected]>
On May 8, 2012, at 11:42 AM, Matt Simerson wrote:

> On May 8, 2012, at 10:29 AM, Matt Simerson wrote:
> 
>> On May 8, 2012, at 9:39 AM, Steve Kemp wrote:
>> 
>>> [FWIW I'd agree moving the code to a central location is good, moving it into ::Plugin is a bad plan.]
>> 
>> I didn't like putting in Qpsmtpd::Plugin either. Especially not since Qpsmtpd::Plugin is declared and behaves differently in the test suites, which necessitated putting the code in there too. 
>> 
>> How about Qpsmtpd::Plugin::auth?
>> 
>> That namespace is already the parent of the auth plugins. 
> 
> I just stumbled across an existing class that someone, who shall remain nameless, just refactored and added tests for. It's surprising relevant because it's named Qpsmtpd::Auth.
> 
> It seems like a reasonable place for this. Thoughts?

The more I think about it, Qpsmtpd::Auth seems like the best place. 

The Qpsmtpd::Auth plugin could also cache the login credentials and CRAM-MD5 ticket, so those are no longer required as arguments to validate_password.  I can't think of a reason not to cache the auth info in the Qpsmtpd::Auth class. Plugins that want to normalize that data in any way can do so and pass them in. Most will just use the cached values. Thoughts?

Matt