Hello, everybody:

I've got a controller helper plugin that has a preDispatch method in it.

It's checking to see if the user has logged in via an off-site
authentication service, and if not, redirects the user to an Authentication
controller do that part of the work.

However, the redirect isn't working. I took a look at the header stack and
it wasn't there. However, if I add a dummy header, it works. Here's some
code to help explain:


class Plugin_CasAuth extends Zend_Controller_Plugin_Abstract
{
   
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $request = $this->getRequest();
        $response = $this->getResponse();
        $session = new Zend_Session_Namespace('Zend_Auth');

        // No need for any more processing if this is the Authenticate
controller.
        if ('authenticate' === $request->getControllerName()) {
            return true;
        }
             
        if (empty($session->storage))
        {
            $response->setRedirect('authenticate');
            // If I comment the following line, there's no redirect. User
gets sent
            // directly to the main index controller.
            $response->setHeader("Test", "This is a test!");
        }
    }
}


The problem is in the last if block.

Any ideas?

Thanks!
Greg 
-- 
View this message in context: 
http://www.nabble.com/Problem-with-setRedirect%28%29----it%27s-not-redirecting-tp25193870p25193870.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to