Database and File Salt for Zend_Auth

1.1k views Asked by At

In my application I have a table row salt, and a static salt set in my Zend_Registry. I'm trying to both, without having to write my own Auth_Adapter. Here's what I have right now for just one salting method.

$adapter->setCredentialTreatment("SHA1(CONCAT(?, salt))");
$adapter->setCredential($values['password']);

Is this possible, or do I have to write an entire adapter for this?

1

There are 1 answers

1
satrun77 On BEST ANSWER

Just add another item to the CONCAT function.

$staticSalt = Zend_Registry::get('static_salt');
$treatment = "SHA1(CONCAT(?, salt, '" . $staticSalt . "'))";
$adapter->setCredentialTreatment($treatment);
$adapter->setCredential($values['password']);