There is a situation: I store some structured data (e.g. array or object, or even string) as a Zend_Auth identity. From version to version the structure of identity could be changed thus identity from one version could (or could not) be compatible with application code of another version.
I'd like to have an ability to validate whether the stored identity data conform to current version requirements.
As I see from the manual, the verification of whether the identity exists is performed like:
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
// Identity exists; get it
$identity = $auth->getIdentity();
}
But there is no ability to hook into hasIdentity()
method or somewhere else to perform the validation.
The only way I see to do that is to implement my own Zend_Auth_Storage_Interface
class that will use some other storage as implementation and perform the validation of stored data.
Is there any more proper solution?