Hi all, I have been able to set the storage engine when I use Auth, but when I call a regular Zend_Session_Namespace will it know to store my sessions in the right place? Here is my simple code calling a new session, and my token class:
Code:
<?php
class Share_Auth_Token
{
protected $_session;
/**
* Constructor
*
*/
public function __construct()
{
$this->_session = new Zend_Session_Namespace('auth_token');
}
/**
* Setup
* @param int $expiration
*/
public function setup($expiration = NULL)
{
if (is_null($expiration)) {
$expiration = 900;
}
$this->_session->setExpirationSeconds($expiration);
$this->_session->auth_token = $hash = md5(uniqid(rand(), 1));
}
/**
* Token
* @return string
*/
public function getToken()
{
return $this->_session->auth_token;
}
/**
* Check
* @param string $auth_token
* @return boolean
*/
public function checkToken($auth_token = NULL)
{
if (is_null($auth_token)) {
$auth_token = '';
}
if ($this->_session->auth_token == $auth_token) {
return true;
} else {
return false;
}
}
}
In my auth module I dictate the storage engine as follows:
Code:
<?php
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session($this->_module == 'admin' ? 'Zend_Auth_Admin' : 'Zend_Auth_User'));
Is there a way I could dictate the storage engine in the token class?
Thanks,
Darren