ZF-2292: Zend_Auth_Adapter_DbTable authenticate() could be split into subroutines to facilitate subclassing

Issue Type: Improvement Created: 2007-12-11T11:34:16.000+0000 Last Updated: 2008-03-21T16:25:16.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Toby Boudreaux (tobyjoe) Assignee: Ralph Schindler (ralph) Tags: - Zend_Auth

Related issues: Attachments:


I've written a DbTable adapter that subclasses from Zend_Auth_Adapter_DbTable, overloading only the authenticate() method. This is standard fare, of course, but I had to duplicate a lot of code within that overload in order to sub it. It would be wonderful to have the authenticate() method split into finer-grained protected methods such as:

<pre class="highlight">
protected function _validate # Zend_Auth_Adapter_Exception
protected function _buildAuthResult() # array, or an instance of a new data transfer class?
protected function _sanitizeCredentialTreatment($treatment = "?") # string
protected function _buildCredentialExpression() # Zend_Db_Expr
protected function _buildSelect() # Zend_Db_Select
protected function _doSelect($dbSelect) # array or rowset OR throw Zend_Auth_Adapter_Exception
protected function _validateIdentities($resultIdentities = array()) # Zend_Auth_Result

I will submit a patch as soon as my CLA is faxed and approved, but I thought I'd open dialogue now.

This would make subclassing a lot cleaner and less brittle as Zend_Auth_Adapter_DbTable grows.


Posted by Darby Felton (darby) on 2007-12-11T12:02:30.000+0000

I like this idea... Ralph, what do you think?

Posted by Ralph Schindler (ralph) on 2007-12-11T12:08:14.000+0000

I like this idea too actually, I think overall we can reduce the authenticate to perhaps 4 sub protected methods, (a lower number would also reduce the number of class properties we'd need to add to maintain state from protected method to protected method)

Posted by Ralph Schindler (ralph) on 2008-01-23T12:08:33.000+0000

Resolved in r7598

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.