2009年4月8日星期三

Re: [fw-auth] Configuring Session in Zend_Auth

kadams wrote:
>
>
> and in my app.ini, I have a line:
> session.remember_me_seconds=7200
>
> My problem, I think, was that I wasn't using 'Zend_Auth' as the namespace
> of the session. The preDispatch method basically resets the
> remember_me_seconds any time the user does anything (including AJAX calls)
> and it redirects to the login page otherwise. It's a pretty simple code
> example, but I think it's pretty powerful. The reason I didn't use a
> Plugin helper for this was because not all my controllers inherit from my
> base controller, so I couldn't make it universal like that.
>
> I'd love to see any feedback, and hopefully this example helps people
> avoid the problems that I had.
>

Hi kadams,

your problem seems to be affected by this bug ->
http://framework.zend.com/issues/browse/ZF-3324 and the snippet you posted
probably works just because you are calling setExpirationSeconds()
explicitly in your base controller.

I would suggest you to remove session configuration from your base
controller.

Although, In your case I would remove the whole base controller because you
don't really need it and it is just bloating your scripts.

If you want to access your Zend_Config object from your Controller write an
Action plugin, it is really simple.

You would also be better of creating a view helper for the menu generation
instead of adding another action to the stack (see documentation and
appendix on performance).

Checking for identity and redirecting appropriately should also be done in
your controller and if you need to check for identity for access to the
certain parts of your site (controllers and action) you should take a look
at Zend_Acl and create a Front Controller plugin.

Regards,

Goran Juric
http://gogs.info/
--
View this message in context: http://www.nabble.com/Configuring-Session-in-Zend_Auth-tp22652278p22953758.html
Sent from the Zend Auth mailing list archive at Nabble.com.

没有评论: