Ok, a few notes:

* your _initAuth() boostrapper should probably be more concerened with createing a Zend_Auth instance instead of a Zend_Auth_Adapter_DbTable.

The reason being is that the Adapter_DbTable is only needed during the AuthController::identifyAction(), its never really needed outside of that. Zend_Auth instance on the other hand, is.

* before $result = $auth->authenticate( $authAdapter );, try calling
this:  echo $auth->getDbSelect();  It will give you a good sense for the
query being generated (minus the CASE PART described in the protected method _authenticateCreateSelect).

In general, Adapter_DbTable should not care that you are querying against a view. Your view should have both the identity (username) and credential (password) available in it.

Do you get an error code from the query statement? YOu can find this by examining the contents of the Exception thrown inside _authenticateQuerySelect(Zend_Db_Select $dbSelect) where the original exception is thrown.

Hope this helps,
Ralph


Joseph Crawford wrote:
Sorry I failed to show my code, here is the bootstrap method along with my AuthController
http://pastebin.com/f5d37bef4

Thanks,
Joseph Crawford

On Jul 6, 2009, at 4:59 PM, Joseph Crawford wrote:

Hello Everyone,

I had my authentication adapter working just fine using the actual database table of isp_partners_aux. I needed to join it with isp_partners though so that I could have the joined data in the users identity.

I created a view in Mysql and it works find under the mysql command line client.

I seem to get this error when using it with the Auth Adapter though.

*Message:* The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity.

I did some debugging by adding echo $dbSelect->__toString(); on line 306 of Auth/Adapter/DbTable.php and got shown the following query with the username and password marked with ** only for security in the email.

SELECT `isp_partners_view`.*, (CASE WHEN `password` = '*****' THEN 1 ELSE 0 END) AS `zend_auth_credential_match` FROM `isp_partners_view` WHERE (`username` = '*****')

This query works fine in the mysql command line client so I am not sure why it is not working well when used with Zend_Auth_Adapter_DbTable

Has anyone else here successfully used the auth adapter with an MySQL view?

Thanks,
Joseph Crawford

Reply via email to